Re: [PATCH v2 1/6] gpio: pca953x: Convert PCA_TYPE from bits to number

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Oct 26, 2022 at 08:18:57PM +0300, Andy Shevchenko wrote:
> On Wed, Oct 26, 2022 at 01:18:57PM +0200, Levente Révész wrote:

...

> > -#define PCA953X_TYPE		BIT(12)
> > -#define PCA957X_TYPE		BIT(13)
> > -#define PCAL653X_TYPE		BIT(14)
> > +#define PCA953X_TYPE		(0x00 << 12)
> > +#define PCAL653X_TYPE		(0x02 << 12)
> > +#define PCA957X_TYPE		(0x03 << 12)
> >  #define PCA_TYPE_MASK		GENMASK(15, 12)
> 
> Please, use decimal numbers and drop the shifts...
> 
> >  #define PCA_CHIP_TYPE(x)	((x) & PCA_TYPE_MASK)
> 
> ...instead add a shift here.

This might require a new macro

#define PCA_SET_TYPE(x)		((x) << 12)

It's just an idea, look at the result and choose one approach,
that looks best.

-- 
With Best Regards,
Andy Shevchenko





[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux