Message ID | 1478208701-30923-3-git-send-email-vgupta@synopsys.com |
---|---|
State | New |
Headers | show |
On Thu, Nov 03, 2016 at 02:31:33PM -0700, Vineet Gupta wrote: > A standard "C" shift will be handled appropriately by the compiler > dependin gon the endian used fo rbuild. So we don't need the s/dependin gon/depending on/ s/fo rbuild/for build/ > explicit distinction in code > > Signed-off-by: Vineet Gupta <vgupta@synopsys.com> > ---
On 11/03/2016 02:55 PM, Daniel Lezcano wrote: > On Thu, Nov 03, 2016 at 02:31:33PM -0700, Vineet Gupta wrote: >> A standard "C" shift will be handled appropriately by the compiler >> dependin gon the endian used fo rbuild. So we don't need the > > s/dependin gon/depending on/ > s/fo rbuild/for build/ Sorry for fat fingering those. Fixed now. > >> explicit distinction in code >> >> Signed-off-by: Vineet Gupta <vgupta@synopsys.com> >> --- >
Hi Vineet, A couple of misspellings in the commit message below. > -----Original Message----- > From: Vineet Gupta [mailto:vgupta@synopsys.com] > Sent: Friday, November 04, 2016 12:32 AM > To: Daniel Lezcano <daniel.lezcano@linaro.org> > Cc: Noam Camus <noamca@mellanox.com>; tglx@linutronix.de; linux-snps-arc@lists.infradead.org; linux-kernel@vger.kernel.org; > Alexey.Brodkin@synopsys.com; Vineet Gupta <vgupta@synopsys.com> > Subject: [PATCH v2 02/10] ARC: timer: gfrc, rtc: deuglify big endian code > > A standard "C" shift will be handled appropriately by the compiler > dependin gon the endian used fo rbuild. So we don't need the "depending on", "used for build". -Alexey
diff --git a/arch/arc/kernel/time.c b/arch/arc/kernel/time.c index 1a117b999c0c..71bcdc1f9bd0 100644 --- a/arch/arc/kernel/time.c +++ b/arch/arc/kernel/time.c @@ -86,26 +86,19 @@ static int noinline arc_get_timer_clk(struct device_node *node) static cycle_t arc_read_gfrc(struct clocksource *cs) { unsigned long flags; - union { -#ifdef CONFIG_CPU_BIG_ENDIAN - struct { u32 h, l; }; -#else - struct { u32 l, h; }; -#endif - cycle_t full; - } stamp; + u32 l, h; local_irq_save(flags); __mcip_cmd(CMD_GFRC_READ_LO, 0); - stamp.l = read_aux_reg(ARC_REG_MCIP_READBACK); + l = read_aux_reg(ARC_REG_MCIP_READBACK); __mcip_cmd(CMD_GFRC_READ_HI, 0); - stamp.h = read_aux_reg(ARC_REG_MCIP_READBACK); + h = read_aux_reg(ARC_REG_MCIP_READBACK); local_irq_restore(flags); - return stamp.full; + return (((cycle_t)h) << 32) | l; } static struct clocksource arc_counter_gfrc = { @@ -143,14 +136,7 @@ CLOCKSOURCE_OF_DECLARE(arc_gfrc, "snps,archs-timer-gfrc", arc_cs_setup_gfrc); static cycle_t arc_read_rtc(struct clocksource *cs) { unsigned long status; - union { -#ifdef CONFIG_CPU_BIG_ENDIAN - struct { u32 high, low; }; -#else - struct { u32 low, high; }; -#endif - cycle_t full; - } stamp; + u32 l, h; /* * hardware has an internal state machine which tracks readout of @@ -159,12 +145,12 @@ static cycle_t arc_read_rtc(struct clocksource *cs) * - high increments after low has been read */ do { - stamp.low = read_aux_reg(AUX_RTC_LOW); - stamp.high = read_aux_reg(AUX_RTC_HIGH); + l = read_aux_reg(AUX_RTC_LOW); + h = read_aux_reg(AUX_RTC_HIGH); status = read_aux_reg(AUX_RTC_CTRL); } while (!(status & _BITUL(31))); - return stamp.full; + return (((cycle_t)h) << 32) | l; } static struct clocksource arc_counter_rtc = {
A standard "C" shift will be handled appropriately by the compiler dependin gon the endian used fo rbuild. So we don't need the explicit distinction in code Signed-off-by: Vineet Gupta <vgupta@synopsys.com> --- arch/arc/kernel/time.c | 30 ++++++++---------------------- 1 file changed, 8 insertions(+), 22 deletions(-)