lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:	Wed, 18 Dec 2013 09:43:51 +0000
From:	"Li.Xiubo@...escale.com" <Li.Xiubo@...escale.com>
To:	Russell King - ARM Linux <linux@....linux.org.uk>,
	Tomasz Figa <tomasz.figa@...il.com>,
	Thierry Reding <thierry.reding@...il.com>
CC:	Thierry Reding <thierry.reding@...il.com>,
	"mark.rutland@....com" <mark.rutland@....com>,
	"s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
	"galak@...eaurora.org" <galak@...eaurora.org>,
	"swarren@...dotorg.org" <swarren@...dotorg.org>,
	"t.figa@...sung.com" <t.figa@...sung.com>,
	"grant.likely@...aro.org" <grant.likely@...aro.org>,
	"matt.porter@...aro.org" <matt.porter@...aro.org>,
	"rob@...dley.net" <rob@...dley.net>,
	"ian.campbell@...rix.com" <ian.campbell@...rix.com>,
	"pawel.moll@....com" <pawel.moll@....com>,
	"rob.herring@...xeda.com" <rob.herring@...xeda.com>,
	"linux-arm-kernel@...ts.infradead.org" 
	<linux-arm-kernel@...ts.infradead.org>,
	"linux-pwm@...r.kernel.org" <linux-pwm@...r.kernel.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
	"linux-doc@...r.kernel.org" <linux-doc@...r.kernel.org>,
	Huan Wang <Huan.Wang@...escale.com>,
	"Jingchang Lu" <jingchang.lu@...escale.com>
Subject: RE: [PATCHv7 1/4] pwm: Add Freescale FTM PWM driver support


> On Tue, Dec 17, 2013 at 01:54:35PM +0100, Tomasz Figa wrote:
> > On Tuesday 17 of December 2013 13:45:06 Thierry Reding wrote:
> > > I fail to see how that would eliminate the problem with the types.
> > > That said I don't actually see sparse complaining about any type
> mismatches.
> > > That's probably because the various macros implicitly cast to u32.
> >
> > Well, in BE variant you would read the register using __raw_readl()
> > into a __be32 and then get an u32 from be32_to_cpu() and return it.
> > Similarly for writes
> 
> __raw_readl() returns a u32, so you'll get a warning trying to assign a
> u32 to a __be32.
> 

If all are ok about this method.
How about the following:

+static inline u32 fsl_pwm_readl(struct fsl_pwm_chip *fpc,
+                               const void __iomem *addr)
+{
+       u32 val;
+
+       val = __raw_readl(addr);
+
+       if (likely(fpc->big_endian))
+               val = be32_to_cpu((__force __be32)val);
+       else
+               val = le32_to_cpu((__force __le32)val);
+       rmb();
+
+       return val;
+}
+
+static inline void fsl_pwm_writel(struct fsl_pwm_chip *fpc,
+                               u32 val, void __iomem *addr)
+{
+       wmb();
+       if (likely(fpc->big_endian))
+               val = (__force u32)cpu_to_be32(val);
+       else
+               val = (__force u32)cpu_to_le32(val);
+
+       __raw_writel(val, addr);
+}

Best Regards,
Xiubo
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ