Messages in this thread | | | Date | Wed, 26 Aug 2020 09:00:35 +0200 | From | Krzysztof Kozlowski <> | Subject | Re: [PATCH v1 5/9] extcon: extcon-ptn5150: Switch to GENMASK() for port attachment macro |
| |
On Tue, Aug 18, 2020 at 02:57:23PM +0800, Ramuthevar,Vadivel MuruganX wrote: > From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com> > > Switch to GENMASK() macro for the port attachment.
Squash it.
Best regards, Krzysztof
> > Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@linux.intel.com> > --- > drivers/extcon/extcon-ptn5150.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c > index 50fff148b772..31b7cbf1551d 100644 > --- a/drivers/extcon/extcon-ptn5150.c > +++ b/drivers/extcon/extcon-ptn5150.c > @@ -38,9 +38,7 @@ enum ptn5150_reg { > #define PTN5150_REG_DEVICE_ID_VERSION GENMASK(7, 3) > #define PTN5150_REG_DEVICE_ID_VENDOR GENMASK(2, 0) > > -#define PTN5150_REG_CC_PORT_ATTACHMENT_SHIFT 2 > -#define PTN5150_REG_CC_PORT_ATTACHMENT_MASK \ > - (0x7 << PTN5150_REG_CC_PORT_ATTACHMENT_SHIFT) > +#define PTN5150_REG_CC_PORT_ATTACHMENT GENMASK(4, 2) > > #define PTN5150_REG_CC_VBUS_DETECTION BIT(7) > > @@ -108,9 +106,8 @@ static void ptn5150_irq_work(struct work_struct *work) > unsigned int port_status; > unsigned int vbus; > > - port_status = ((reg_data & > - PTN5150_REG_CC_PORT_ATTACHMENT_MASK) >> > - PTN5150_REG_CC_PORT_ATTACHMENT_SHIFT); > + port_status = FIELD_GET(PTN5150_REG_CC_PORT_ATTACHMENT, > + reg_data); > > switch (port_status) { > case PTN5150_DFP_ATTACHED: > -- > 2.11.0 >
| |