Received: by 2002:a05:6a10:6006:0:0:0:0 with SMTP id w6csp186798pxa; Wed, 26 Aug 2020 22:14:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyThFwRMOs5UEQP/BbZ6vMTr5ZxQE5iKGjaNuPlzsNbkCACkGGa/Y/2yESekJZ9K2KfsrEi X-Received: by 2002:a17:906:1154:: with SMTP id i20mr15556567eja.243.1598505299677; Wed, 26 Aug 2020 22:14:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598505299; cv=none; d=google.com; s=arc-20160816; b=wMb3x2+IkH1deeVMZ2E/RY00V/4UDAFtA54nWPWOzSpkMTUrpq+2CHhFBtTvXYAekO mOpwHSmwUSmsIDDL6NkwlHCr1koFrjih86Z2mqBRI8xmjM7Y5WS/6SQ3DTJTr4bY9JAL Tre1GdZx/yTArtgFVXX349sn+F3/jU5pp0swEeVt3x4ixbZt0DYheapM/vQN1nKgZx19 bbcMM5+eRp/o5Lz+r/XTn4lFDjK8ARFVeZIfqYDJqOgUOVGhvcdepXvyNq4tHI0V0vW+ h1Pe1mjW73Ht5iHYv99UbI0z8p/833KCgx1Xnub5zoI/4dXMPTbSP91qkm4gOrp8v1i5 ZCOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:dlp-filter:cms-type :content-transfer-encoding:content-language:in-reply-to:mime-version :user-agent:date:message-id:organization:from:cc:to:subject :dkim-signature:dkim-filter; bh=FwxbqIwlwHE2YxMbgHxzdrPe9rdtQUJU7pDa8Ygd5qQ=; b=HoMseffiO0y7fvdl3LIuC+M9w3LmaRtYJiHjl6b/DhinPe+Hv9jrGTkkHGAzIshEBD R86nkrF89YUgquB4rTf566Dga7Gc6D9sWwQCh8R2LYyK4NC9ctkFFX18Cxf/nbLXrzAC 9f1HdJsCDfzaNR31WEJCFnvEy646i9se65+Ga67PsjnGxbEmkhpQvPLZCoIIs9yOPoPy 1zJAkjFg8/NcMvqtQH32Egs6Oa6AHn/ixfXnU87pOUWm2nzZuEGcXVOWqtvKMijfFnBA Hq4nIcWzIbWmEJ/pzS23yDVVpV1Ufmf9w/vU4DM8WlMVXl7Dadun0mhuwrOkH06WqTC+ pUkg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YuuWw0Cn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ce15si854976edb.291.2020.08.26.22.14.36; Wed, 26 Aug 2020 22:14:59 -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; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=YuuWw0Cn; 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=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726098AbgH0FNy (ORCPT + 99 others); Thu, 27 Aug 2020 01:13:54 -0400 Received: from mailout2.samsung.com ([203.254.224.25]:27690 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725909AbgH0FNv (ORCPT ); Thu, 27 Aug 2020 01:13:51 -0400 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout2.samsung.com (KnoxPortal) with ESMTP id 20200827051348epoutp02e65fc6fa20ee270f5cafada24ccc1061~vCAky5nyT1111711117epoutp020 for ; Thu, 27 Aug 2020 05:13:48 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.samsung.com 20200827051348epoutp02e65fc6fa20ee270f5cafada24ccc1061~vCAky5nyT1111711117epoutp020 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1598505228; bh=FwxbqIwlwHE2YxMbgHxzdrPe9rdtQUJU7pDa8Ygd5qQ=; h=Subject:To:Cc:From:Date:In-Reply-To:References:From; b=YuuWw0CnHqUJYrTSO+/wVGHhp+URg+lNIAEpUk4MggnGukqipdswWEq4kg3TDI8rk 6jp+C8NTtsir4UStKyq+ikGRCIgpz+BTW/t79xAxt/aHWAADaPwDd3QWuiLUD9W6l8 OwbKYclH6p173X+4VmoZsVGlDR2LcE22mTsFoDJA= Received: from epsnrtp1.localdomain (unknown [182.195.42.162]) by epcas1p1.samsung.com (KnoxPortal) with ESMTP id 20200827051347epcas1p170b62056070661ea96780e988663d3ad~vCAkW6QZS1968319683epcas1p1B; Thu, 27 Aug 2020 05:13:47 +0000 (GMT) Received: from epsmges1p3.samsung.com (unknown [182.195.40.153]) by epsnrtp1.localdomain (Postfix) with ESMTP id 4BcW953ZQxzMqYlx; Thu, 27 Aug 2020 05:13:45 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p3.samsung.com (Symantec Messaging Gateway) with SMTP id C7.3C.29173.901474F5; Thu, 27 Aug 2020 14:13:45 +0900 (KST) Received: from epsmtrp2.samsung.com (unknown [182.195.40.14]) by epcas1p2.samsung.com (KnoxPortal) with ESMTPA id 20200827051344epcas1p26ad02c360e00aaacd9f56aa74462aed5~vCAhpaCse0931509315epcas1p2z; Thu, 27 Aug 2020 05:13:44 +0000 (GMT) Received: from epsmgms1p2.samsung.com (unknown [182.195.42.42]) by epsmtrp2.samsung.com (KnoxPortal) with ESMTP id 20200827051344epsmtrp2b9503d7712bc056dd285eee2fad620d0~vCAholy8t1168611686epsmtrp2j; Thu, 27 Aug 2020 05:13:44 +0000 (GMT) X-AuditID: b6c32a37-9cdff700000071f5-d7-5f474109ace1 Received: from epsmtip1.samsung.com ( [182.195.34.30]) by epsmgms1p2.samsung.com (Symantec Messaging Gateway) with SMTP id F9.53.08303.801474F5; Thu, 27 Aug 2020 14:13:44 +0900 (KST) Received: from [10.113.221.102] (unknown [10.113.221.102]) by epsmtip1.samsung.com (KnoxPortal) with ESMTPA id 20200827051344epsmtip1ecd82c0f115d8ae5fb0d61ce7c9a6ce4~vCAhckrtN0755507555epsmtip1Z; Thu, 27 Aug 2020 05:13:44 +0000 (GMT) Subject: Re: [PATCH v2 1/2] extcon: ptn5150: Switch to GENMASK() and BIT() macros To: "Ramuthevar,Vadivel MuruganX" , linux-kernel@vger.kernel.org Cc: vijaikumar.kanagarajan@gmail.com, krzk@kernel.org, myungjoo.ham@samsung.com, heikki.krogerus@linux.intel.com, cheol.yong.kim@intel.com, qi-ming.wu@intel.com, yin1.li@intel.com From: Chanwoo Choi Organization: Samsung Electronics Message-ID: <8f26c8cb-3f6b-5933-a0f8-eb765ad5016a@samsung.com> Date: Thu, 27 Aug 2020 14:26:12 +0900 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:59.0) Gecko/20100101 Thunderbird/59.0 MIME-Version: 1.0 In-Reply-To: <20200827035633.37348-2-vadivel.muruganx.ramuthevar@linux.intel.com> Content-Language: en-US Content-Transfer-Encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrEJsWRmVeSWpSXmKPExsWy7bCmri6no3u8wYJZ0hbX30ZYdK3eyWJx /vwGdovLu+awWdxuXMFm8aVjPZvFhmP32Sxe7p/OatHUdJzNgdNj56y77B6L97xk8ti0qpPN Y97JQI++LasYPT5vkgtgi8q2yUhNTEktUkjNS85PycxLt1XyDo53jjc1MzDUNbS0MFdSyEvM TbVVcvEJ0HXLzAG6SUmhLDGnFCgUkFhcrKRvZ1OUX1qSqpCRX1xiq5RakJJTYFmgV5yYW1ya l66XnJ9rZWhgYGQKVJiQnXFh5zTWgsVyFT/3LWZvYLwg2cXIySEhYCIx7ecXJhBbSGAHo8Tr +/5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a1cnm Me9koEffllWMHp83yQWwRXHZpKTmZJalFunbJXBlXNg5jbVgsVzFz32L2RsYL0h2MXJySAiY SPz5epWti5GLQ0hgB6PE7EtX2CASkhLTLh5l7mLkALKFJQ4fLoaoecso8X3KEkaQGmGBYImT h2+wgtgiAvkS72buZgUpYhbYzihx/Pw1FoiO14wS22e9YwepYhPQktj/4gbYBn4BRYmrPx6D TeIVsJP4v2oxC4jNIqAq8f9pI1i9qECYxM4lj5kgagQlTs58AlbDKRAo8WDvTGYQm1lAXeLP vEtQtrjErSfzmSBseYntb+cwT2AUnoWkfRaSlllIWmYhaVnAyLKKUTK1oDg3PbfYsMAoL7Vc rzgxt7g0L10vOT93EyM41rS0djDuWfVB7xAjEwfjIUYJDmYlEV7Bi87xQrwpiZVVqUX58UWl OanFhxilOViUxHm/zloYJySQnliSmp2aWpBaBJNl4uCUamBSm7Dg4uy/XUyiHjvzPly8lirN wmTmV2QzefbFeb5nDfj/nmyQ+c+56mpx90Z9ib7YwPna0tJRDgtdMibEhziL3knOyyvb5nel Y3nL1p+tQffvbVr5z9/lOMejG8Fn/DXZ7b5ZRE6bqKMgyPvR7v6O/P0/Huyrmafh+nTDhyUB r+JF1x/b5PIo7X79srepfa4LnrQ9+H9+MssCptKCb+xPfrmtFElkrnQpNf7eeTr2mPUTZe67 ounbO++Hx7imbTsvnN+8hUfr3RG2hm+yJ82f/uCZ/JGZyY195/nOk+HLrXrf/72StyxhS8ib e8/aT5rylD5V99jQwci9s+qXeLhMheLZsskba8tuLE9vE9ijxFKckWioxVxUnAgAQ2YRLyQD AAA= X-CMS-MailID: 20200827051344epcas1p26ad02c360e00aaacd9f56aa74462aed5 X-Msg-Generator: CA Content-Type: text/plain; charset="utf-8" X-Sendblock-Type: SVC_REQ_APPROVE CMS-TYPE: 101P DLP-Filter: Pass X-CFilter-Loop: Reflected X-CMS-RootMailID: 20200827035649epcas1p3eb6c7abbcd8e0ac28df5be19c9ef3a32 References: <20200827035633.37348-1-vadivel.muruganx.ramuthevar@linux.intel.com> <20200827035633.37348-2-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 On 8/27/20 12:56 PM, Ramuthevar,Vadivel MuruganX wrote: > From: Ramuthevar Vadivel Murugan > > Switch to GENMASK() and BIT() macros. > > Signed-off-by: Ramuthevar Vadivel Murugan > Reviewed-by: Krzysztof Kozlowski > --- > drivers/extcon/extcon-ptn5150.c | 43 +++++++++++------------------------------ > 1 file changed, 11 insertions(+), 32 deletions(-) > > diff --git a/drivers/extcon/extcon-ptn5150.c b/drivers/extcon/extcon-ptn5150.c > index 8ba706fad887..8b930050a3f1 100644 > --- a/drivers/extcon/extcon-ptn5150.c > +++ b/drivers/extcon/extcon-ptn5150.c > @@ -7,6 +7,7 @@ > // Author: Vijai Kumar K > // Copyright (c) 2020 Krzysztof Kozlowski > > +#include > #include > #include > #include > @@ -35,29 +36,13 @@ 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 GENMASK(7, 3) > +#define PTN5150_REG_DEVICE_ID_VENDOR GENMASK(2, 0) > > -#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_CC_PORT_ATTACHMENT_SHIFT 2 > -#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_INT_CABLE_ATTACH_SHIFT 0 > -#define PTN5150_REG_INT_CABLE_ATTACH_MASK \ > - (0x1 << PTN5150_REG_INT_CABLE_ATTACH_SHIFT) > - > -#define PTN5150_REG_INT_CABLE_DETACH_SHIFT 1 > -#define PTN5150_REG_INT_CABLE_DETACH_MASK \ > - (0x1 << PTN5150_REG_CC_CABLE_DETACH_SHIFT) > +#define PTN5150_REG_CC_PORT_ATTACHMENT GENMASK(4, 2) > +#define PTN5150_REG_CC_VBUS_DETECTION BIT(7) > +#define PTN5150_REG_INT_CABLE_ATTACH_MASK BIT(0) > +#define PTN5150_REG_INT_CABLE_DETACH_MASK BIT(1) > > struct ptn5150_info { > struct device *dev; > @@ -95,9 +80,7 @@ static void ptn5150_check_state(struct ptn5150_info *info) > return; > } > > - 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: > @@ -107,8 +90,7 @@ static void ptn5150_check_state(struct ptn5150_info *info) > break; > 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_cansleep(info->vbus_gpiod, 0); > else > @@ -191,11 +173,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_dbg(info->dev, "Device type: version: 0x%x, vendor: 0x%x\n", > version_id, vendor_id); > > Applied it. Thanks. -- Best Regards, Chanwoo Choi Samsung Electronics