Re: [PATCH v1 2/9] extcon: extcon-ptn5150: Switch to GENMASK() for VBUS detection macro

From: Krzysztof Kozlowski
Date: Wed Aug 26 2020 - 02:59:28 EST


On Tue, Aug 18, 2020 at 02:57:20PM +0800, Ramuthevar,Vadivel MuruganX wrote:
> From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@xxxxxxxxxxxxxxx>
>
> Switch to GENMASK() for VBUS detection macro.
>
> Signed-off-by: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@xxxxxxxxxxxxxxx>
> ---
> 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
>