Hi,

On 26/8/2020 2:59 pm, Krzysztof Kozlowski wrote:
On Tue, Aug 18, 2020 at 02:57:20PM +0800, Ramuthevar,Vadivel MuruganX wrote:
From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthe...@linux.intel.com>

Switch to GENMASK() for VBUS detection macro.

Signed-off-by: Ramuthevar Vadivel Murugan 
<vadivel.muruganx.ramuthe...@linux.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.
Thank you for the review comments and suggestions.
Sure, I will squash it as mentioned patches mentioned above.

Best Regards
Vadivel

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

Reply via email to