lkml.org 
[lkml]   [2020]   [Aug]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [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
>

\
 
 \ /
  Last update: 2020-08-26 09:03    [W:0.172 / U:0.444 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site