Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp2479197rdb; Tue, 12 Sep 2023 03:17:17 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEqbJdYxXIZs4eoO5IdAGfe1vfzOMAnu9uA4JiKMIl9f+9Haxq56U2EOrEIDDTDz007XbS8 X-Received: by 2002:a17:90a:3cc6:b0:273:f229:a479 with SMTP id k6-20020a17090a3cc600b00273f229a479mr7407971pjd.34.1694513837362; Tue, 12 Sep 2023 03:17:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694513837; cv=none; d=google.com; s=arc-20160816; b=My9RhWQE8dPOSSw9rEdWx8Rt/JbFnObDzSXuNUPnR/2UhkEM1ckWRvfIPjLeL9u35d 81z2hVa770BApRCL6wz3IlVlWzuZAUe0OgSBrPaLzUk54sA532pZXX3p5XQyy5cNADcO IqYrbOtIBLkZBgd+ckQxZtXq7KfVN4BpjtVGW5R7UBkB95mfT6FDOCP/VvupDMc5fpE8 AAGYg+5vxTT0JdutC/ZMjXRfWRRE4vg3MeaSEys+W3rbQBl1RZxkDtcsvSXji8kJ5kmL bN3kfBAQ1jOuDvp8eZ6oVXXbKwUK4rOZE9lN2YLk/3j4ydom37mPtDVvKnHG8n/VjGoR N+YQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:subject:user-agent:mime-version:date:message-id; bh=GvrQFq0NHefH741GIW2b8RfgO2xoGLb8vUlBgLi47Bc=; fh=Nis5Exja9L6qsT9nTNmhOlHDOQ4cOYSKfA0ZGWTBVqI=; b=UcAGvyHVHrrdR/SN5/FhfFiHR+AsWah8i638becA4Fl9BSJ9+jYGsanSlSyC97TUEo fNBOxP0jZAIxJ1HiOtma3Qf7FeT3WHtX6PJdzfpaqoczeSN4rpV71cH83K3jwdg3sVe/ 0VGcQQzUUtyvT6GKiCCX+Tiuf7vWqv3LrlrWtfxRnmWe1xdF3uIRa/F2dzgZ0I7QFAOO k1aw96A7CUY9v13ZvZh3DKQeuqFLh2SHIx6VRTzCV3QSDvH11xXJVMtk3efbdtct1kKV pZTCuIwFfJqLBIIpW9vZ7PFd+oYfxGF/4SB0Kt9CFvujRt4B5mL3ldB0YatRO4zepo2t P1Ww== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from agentk.vger.email (agentk.vger.email. [23.128.96.32]) by mx.google.com with ESMTPS id q15-20020a170902a3cf00b001c224a39c05si6897592plb.635.2023.09.12.03.17.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Sep 2023 03:17:17 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) client-ip=23.128.96.32; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.32 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by agentk.vger.email (Postfix) with ESMTP id 11424811907A; Tue, 12 Sep 2023 03:07:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at agentk.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233900AbjILKHg (ORCPT + 99 others); Tue, 12 Sep 2023 06:07:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50560 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233821AbjILKHU (ORCPT ); Tue, 12 Sep 2023 06:07:20 -0400 Received: from out30-124.freemail.mail.aliyun.com (out30-124.freemail.mail.aliyun.com [115.124.30.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id F136710E2; Tue, 12 Sep 2023 03:07:11 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R101e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046056;MF=baolin.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VrwN.Fm_1694513228; Received: from 30.97.48.71(mailfrom:baolin.wang@linux.alibaba.com fp:SMTPD_---0VrwN.Fm_1694513228) by smtp.aliyun-inc.com; Tue, 12 Sep 2023 18:07:09 +0800 Message-ID: <4b7c8e8a-b97f-6e1e-7c49-889fdd5b921f@linux.alibaba.com> Date: Tue, 12 Sep 2023 18:07:15 +0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.15.0 Subject: Re: [RFT PATCH 2/3] gpio: eic-sprd: use a helper variable for &pdev->dev To: Bartosz Golaszewski , Linus Walleij , Andy Shevchenko , Orson Zhai , Chunyan Zhang Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org, Bartosz Golaszewski References: <20230912094519.22769-1-brgl@bgdev.pl> <20230912094519.22769-2-brgl@bgdev.pl> From: Baolin Wang In-Reply-To: <20230912094519.22769-2-brgl@bgdev.pl> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (agentk.vger.email [0.0.0.0]); Tue, 12 Sep 2023 03:07:37 -0700 (PDT) X-Spam-Status: No, score=-2.2 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS, UNPARSEABLE_RELAY autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on agentk.vger.email On 9/12/2023 5:45 PM, Bartosz Golaszewski wrote: > From: Bartosz Golaszewski > > Instead of dereferencing pdev everywhere, just store the address of the > underlying struct device in a local variable. > > Signed-off-by: Bartosz Golaszewski Reviewed-by: Baolin Wang > --- > drivers/gpio/gpio-eic-sprd.c | 20 ++++++++++---------- > 1 file changed, 10 insertions(+), 10 deletions(-) > > diff --git a/drivers/gpio/gpio-eic-sprd.c b/drivers/gpio/gpio-eic-sprd.c > index 9b2f9ccf8d77..be7f2fa5aa7b 100644 > --- a/drivers/gpio/gpio-eic-sprd.c > +++ b/drivers/gpio/gpio-eic-sprd.c > @@ -591,18 +591,19 @@ static void sprd_eic_unregister_notifier(void *data) > static int sprd_eic_probe(struct platform_device *pdev) > { > const struct sprd_eic_variant_data *pdata; > + struct device *dev = &pdev->dev; > struct gpio_irq_chip *irq; > struct sprd_eic *sprd_eic; > struct resource *res; > int ret, i; > > - pdata = of_device_get_match_data(&pdev->dev); > + pdata = of_device_get_match_data(dev); > if (!pdata) { > - dev_err(&pdev->dev, "No matching driver data found.\n"); > + dev_err(dev, "No matching driver data found.\n"); > return -EINVAL; > } > > - sprd_eic = devm_kzalloc(&pdev->dev, sizeof(*sprd_eic), GFP_KERNEL); > + sprd_eic = devm_kzalloc(dev, sizeof(*sprd_eic), GFP_KERNEL); > if (!sprd_eic) > return -ENOMEM; > > @@ -624,7 +625,7 @@ static int sprd_eic_probe(struct platform_device *pdev) > if (!res) > break; > > - sprd_eic->base[i] = devm_ioremap_resource(&pdev->dev, res); > + sprd_eic->base[i] = devm_ioremap_resource(dev, res); > if (IS_ERR(sprd_eic->base[i])) > return PTR_ERR(sprd_eic->base[i]); > } > @@ -632,7 +633,7 @@ static int sprd_eic_probe(struct platform_device *pdev) > sprd_eic->chip.label = sprd_eic_label_name[sprd_eic->type]; > sprd_eic->chip.ngpio = pdata->num_eics; > sprd_eic->chip.base = -1; > - sprd_eic->chip.parent = &pdev->dev; > + sprd_eic->chip.parent = dev; > sprd_eic->chip.direction_input = sprd_eic_direction_input; > switch (sprd_eic->type) { > case SPRD_EIC_DEBOUNCE: > @@ -659,9 +660,9 @@ static int sprd_eic_probe(struct platform_device *pdev) > irq->num_parents = 1; > irq->parents = &sprd_eic->irq; > > - ret = devm_gpiochip_add_data(&pdev->dev, &sprd_eic->chip, sprd_eic); > + ret = devm_gpiochip_add_data(dev, &sprd_eic->chip, sprd_eic); > if (ret < 0) { > - dev_err(&pdev->dev, "Could not register gpiochip %d.\n", ret); > + dev_err(dev, "Could not register gpiochip %d.\n", ret); > return ret; > } > > @@ -669,11 +670,10 @@ static int sprd_eic_probe(struct platform_device *pdev) > ret = atomic_notifier_chain_register(&sprd_eic_irq_notifier, > &sprd_eic->irq_nb); > if (ret) > - return dev_err_probe(&pdev->dev, ret, > + return dev_err_probe(dev, ret, > "Failed to register with the interrupt notifier"); > > - return devm_add_action_or_reset(&pdev->dev, > - sprd_eic_unregister_notifier, > + return devm_add_action_or_reset(dev, sprd_eic_unregister_notifier, > &sprd_eic->irq_nb); > } >