lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200818065727.50520-6-vadivel.muruganx.ramuthevar@linux.intel.com>
Date:   Tue, 18 Aug 2020 14:57:23 +0800
From:   "Ramuthevar,Vadivel MuruganX" 
        <vadivel.muruganx.ramuthevar@...ux.intel.com>
To:     linux-kernel@...r.kernel.org, myungjoo.ham@...sung.com,
        cw00.choi@...sung.com
Cc:     andriy.shevchenko@...el.com, thomas.langer@...el.com,
        cheol.yong.kim@...el.com, qi-ming.wu@...el.com, yin1.li@...el.com,
        Ramuthevar Vadivel Murugan 
        <vadivel.muruganx.ramuthevar@...ux.intel.com>
Subject: [PATCH v1 5/9] extcon: extcon-ptn5150: Switch to GENMASK() for port attachment macro

From: Ramuthevar Vadivel Murugan <vadivel.muruganx.ramuthevar@...ux.intel.com>

Switch to GENMASK() macro for the port attachment.

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(-)

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ