[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20200826065920.GB12271@pi3>
Date: Wed, 26 Aug 2020 08:59:20 +0200
From: Krzysztof Kozlowski <krzk@...nel.org>
To: "Ramuthevar,Vadivel MuruganX"
<vadivel.muruganx.ramuthevar@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org, myungjoo.ham@...sung.com,
cw00.choi@...sung.com, andriy.shevchenko@...el.com,
thomas.langer@...el.com, cheol.yong.kim@...el.com,
qi-ming.wu@...el.com, yin1.li@...el.com
Subject: Re: [PATCH v1 2/9] extcon: extcon-ptn5150: Switch to GENMASK() for
VBUS detection macro
On Tue, Aug 18, 2020 at 02:57:20PM +0800, Ramuthevar,Vadivel MuruganX wrote:
> From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@...ux.intel.com>
>
> Switch to GENMASK() for VBUS detection macro.
>
> Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@...ux.intel.com>
> ---
> drivers/extcon/extcon-ptn5150.c | 9 +++------
> 1 file changed, 3 insertions(+), 6 deletions(-)
This is too simple change, should be squashed with 1, 3, 4 and 5.
There is no point to split each change a define to use BIT or GENMASK.
Best regards,
Krzysztof
>
> diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c
> index 5d9a8767646b..c816a6c1e05c 100644
> --- a/drivers/extcon/extcon-ptn5150.c
> +++ b/drivers/extcon/extcon-ptn5150.c
> @@ -42,9 +42,7 @@ enum ptn5150_reg {
> #define PTN5150_REG_CC_PORT_ATTACHMENT_MASK \
> (0x7 << PTN5150_REG_CC_PORT_ATTACHMENT_SHIFT)
>
> -#define PTN5150_REG_CC_VBUS_DETECTION_SHIFT 7
> -#define PTN5150_REG_CC_VBUS_DETECTION_MASK \
> - (0x1 << PTN5150_REG_CC_VBUS_DETECTION_SHIFT)
> +#define PTN5150_REG_CC_VBUS_DETECTION BIT(7)
>
> #define PTN5150_REG_INT_CABLE_ATTACH_SHIFT 0
> #define PTN5150_REG_INT_CABLE_ATTACH_MASK \
> @@ -130,9 +128,8 @@ static void ptn5150_irq_work(struct work_struct *work)
> case PTN5150_UFP_ATTACHED:
> extcon_set_state_sync(info->edev, EXTCON_USB,
> false);
> - vbus = ((reg_data &
> - PTN5150_REG_CC_VBUS_DETECTION_MASK) >>
> - PTN5150_REG_CC_VBUS_DETECTION_SHIFT);
> + vbus = FIELD_GET(PTN5150_REG_CC_VBUS_DETECTION,
> + reg_data);
> if (vbus)
> gpiod_set_value(info->vbus_gpiod, 0);
> else
> --
> 2.11.0
>
Powered by blists - more mailing lists