Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp2883841pxa; Mon, 17 Aug 2020 23:58:44 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyroOo8Wt0lJz/nQ1ZhdjP1WptshMYX0M0tvFWfK625KxeAoyZmO6vGhyvnkzRIxbLpaXaY X-Received: by 2002:aa7:dbd9:: with SMTP id v25mr19089488edt.137.1597733924305; Mon, 17 Aug 2020 23:58:44 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597733924; cv=none; d=google.com; s=arc-20160816; b=k16Rrjdu90QYF5g5EOH3AunHQKVjicrtZ6ZDdWs6WiN1kdtn+WObhUciG9JPGG+Ssf ViBL0ZaRacoi3Y8pqHQ3Khab9NP6QsYVJv6yd+HAel9Gf2xTJGUWzTMbGLNl7t6wzQxF nSa7d9xgNFhrV1Uj4haTRgh8CuZhMdSNTr9RviSsMN1q+DeFU5y9G+G4P0ANARTQotTy PmLbJ83Yu0pgHSy0t9V6im1LaIsq78DzATYzh+Fu6KPT+RxkKsCcwargKpUIGqMtCwNh wauwgCmXh1kYWFgp33N1RdWrk590fxey3SVtHUxMHYcZOKt+kokQQ1EKA1C0CL9OlQmZ imhw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:ironport-sdr:ironport-sdr; bh=O1JcDCkuO3Ed1tD8DCNNWvTmYoua5/2p4rIMBzSNGGY=; b=H49ifi6W3mKw/k5RtYSqHX7QfqpQcAvzEZ7BCuU5w00PYsnabILXdH/4LUxOuZAnj8 a8Z3VfFjrjz8gORkzsvYEDZxLqx33AIMcamTU9gK7kqLUzt3Cy/MtBFSI28l5IvqGr6c zIg1lacd5ZL/cGVZk7sOr6cXgFZwsYSd7S4ydS3W0fPrCnACj8jVlbXGky/v+QaBo2lX A5gvxtTlLPTRrVQJ2qcZAEEK6wW9q5u+TLHMSEvelVzMRKUymt4ZXk/qeHc55igpFPB6 TaZ1nsCoZtaln01JouBAb1B0nlIPXGW5qZnd6DyoNyli7giFVs8TLZE+dyQzMQ9yZRKv 8GEQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id e11si12350381ejd.431.2020.08.17.23.58.20; Mon, 17 Aug 2020 23:58:44 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726599AbgHRG5g (ORCPT + 99 others); Tue, 18 Aug 2020 02:57:36 -0400 Received: from mga06.intel.com ([134.134.136.31]:30062 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726592AbgHRG5g (ORCPT ); Tue, 18 Aug 2020 02:57:36 -0400 IronPort-SDR: FNTO+9WF1f1lGG65HpgTaVW6ZDBCPrEbzeESN0tVbMeOo8n9RGEeroBT1jAJ7XNSF1kAVvFgAp AEFqAdSGDB0g== X-IronPort-AV: E=McAfee;i="6000,8403,9716"; a="216376928" X-IronPort-AV: E=Sophos;i="5.76,326,1592895600"; d="scan'208";a="216376928" X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Aug 2020 23:57:34 -0700 IronPort-SDR: I60qMgu/w5EprarjySDjWhL/JtxvNsaH4JsuyyewZpJgS9cuFUkhRkP9SkJSlQzSDRkFURSRhQ DRuvYGomiIsw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.76,326,1592895600"; d="scan'208";a="326644462" Received: from sgsxdev004.isng.intel.com (HELO localhost) ([10.226.88.13]) by orsmga008.jf.intel.com with ESMTP; 17 Aug 2020 23:57:32 -0700 From: "Ramuthevar,Vadivel MuruganX" To: linux-kernel@vger.kernel.org, myungjoo.ham@samsung.com, cw00.choi@samsung.com Cc: andriy.shevchenko@intel.com, thomas.langer@intel.com, cheol.yong.kim@intel.com, qi-ming.wu@intel.com, yin1.li@intel.com, Ramuthevar Vadivel Murugan Subject: [PATCH v1 1/9] extcon: extcon-ptn5150: Switch to GENMASK() for vendor and device ID's Date: Tue, 18 Aug 2020 14:57:19 +0800 Message-Id: <20200818065727.50520-2-vadivel.muruganx.ramuthevar@linux.intel.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20200818065727.50520-1-vadivel.muruganx.ramuthevar@linux.intel.com> References: <20200818065727.50520-1-vadivel.muruganx.ramuthevar@linux.intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ramuthevar Vadivel Murugan Switch to GENMASK() for vendor_id and device_id macros. Signed-off-by: Ramuthevar Vadivel Murugan --- drivers/extcon/extcon-ptn5150.c | 16 +++++----------- 1 file changed, 5 insertions(+), 11 deletions(-) diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c index d1c997599390..5d9a8767646b 100644 --- a/drivers/extcon/extcon-ptn5150.c +++ b/drivers/extcon/extcon-ptn5150.c @@ -6,6 +6,7 @@ // Copyright (c) 2018-2019 by Vijai Kumar K // Author: Vijai Kumar K +#include #include #include #include @@ -34,13 +35,8 @@ enum ptn5150_reg { #define PTN5150_UFP_ATTACHED 0x2 /* Define PTN5150 MASK/SHIFT constant */ -#define PTN5150_REG_DEVICE_ID_VENDOR_SHIFT 0 -#define PTN5150_REG_DEVICE_ID_VENDOR_MASK \ - (0x3 << PTN5150_REG_DEVICE_ID_VENDOR_SHIFT) - -#define PTN5150_REG_DEVICE_ID_VERSION_SHIFT 3 -#define PTN5150_REG_DEVICE_ID_VERSION_MASK \ - (0x1f << PTN5150_REG_DEVICE_ID_VERSION_SHIFT) +#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 \ @@ -194,10 +190,8 @@ static int ptn5150_init_dev_type(struct ptn5150_info *info) return -EINVAL; } - vendor_id = ((reg_data & PTN5150_REG_DEVICE_ID_VENDOR_MASK) >> - PTN5150_REG_DEVICE_ID_VENDOR_SHIFT); - version_id = ((reg_data & PTN5150_REG_DEVICE_ID_VERSION_MASK) >> - PTN5150_REG_DEVICE_ID_VERSION_SHIFT); + vendor_id = FIELD_GET(PTN5150_REG_DEVICE_ID_VENDOR, reg_data); + version_id = FIELD_GET(PTN5150_REG_DEVICE_ID_VERSION, reg_data); dev_info(info->dev, "Device type: version: 0x%x, vendor: 0x%x\n", version_id, vendor_id); -- 2.11.0