From patchwork Mon Sep 2 13:30:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13787308 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5BAF7CA0ED3 for ; Mon, 2 Sep 2024 13:34:54 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-ID:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=FEamoWTaz/lqIXphALzTz6swVb2wOW+ZuKPqMz+C9jk=; b=m3uVczB0mLgT1GauhWpNlqPr7Z Et2E+YRCTP53gP0tZkKJgBxsCdzpeH4aA78M0e1QQWcgNELnBTxcIg+DZ1Q8QtSW4SQk7M4Cqa688 Z2mFK29pzJbrnnBZTfTQpNQvycbfK4rYVHZWec7XrrkkodTuNB4SNr0hflUYsVTo91BTRxwBtSGDH tewioNMPgqKMYcwDc+xz52DL7cF4CKqzbypGaZ3aMNPWnQPtNo4bE7Dt4urPaXkgHb+lB5z2z3Fhb 9z46hmQgOtbb0D2XlMvTRd3zPG7v67E2jiVIgCz+jy9UijHs5I0RmgQR6zVdXM96x6sJW99A9M1sT JHiFg/mg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl7Ce-0000000EVrL-23mn; Mon, 02 Sep 2024 13:34:44 +0000 Received: from mgamail.intel.com ([198.175.65.13]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1sl7A4-0000000EV86-0cOF for linux-arm-kernel@lists.infradead.org; Mon, 02 Sep 2024 13:32:05 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1725283924; x=1756819924; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=sarn8u6DMiqscknv9atERVdrT9dOoz1FqQ1plDaPSJQ=; b=OXC8DkdI0ogHiPsIEFjgKUfquqvslf6tBzKjnCYVu+Dc2vOrEcPk0chh fV90o76Ir+oUH0MMJJq5KP/NyxIbX9CHZSyaUOxwgyLN6Kfw1bwc0xpMG KpK/QwSkVJQuHLo8kYaf88mU96NxOzRfDgcH6cEG4ckleoxZZ+NWLyqN6 0q45RjgxdsSoT1TPk9vdYn2OSxudokBmToGD6B7wai+nGRSwGsKhRaKo/ 9cSMS56J07gRnAnsMcdTuvOsvI1VxR1Hnu/rCH2bjhvpospEnAGshZAkh y8SiYyk0lxCoSbpS2SZwf8EI0wc15iVB1p16CTmvI7rydC+0wwW3C4aYk w==; X-CSE-ConnectionGUID: W8k2/RfWS6+uZEE6o8pXkg== X-CSE-MsgGUID: dWDBFqH9RrWzjcUMkYpVbg== X-IronPort-AV: E=McAfee;i="6700,10204,11183"; a="35022559" X-IronPort-AV: E=Sophos;i="6.10,195,1719903600"; d="scan'208";a="35022559" Received: from orviesa007.jf.intel.com ([10.64.159.147]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Sep 2024 06:32:02 -0700 X-CSE-ConnectionGUID: hqDPdlbRRteXWf3gwuVu5A== X-CSE-MsgGUID: qV7iHiwEQIOGNMeFdrM7kw== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,195,1719903600"; d="scan'208";a="65114777" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa007.jf.intel.com with ESMTP; 02 Sep 2024 06:31:59 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 570F348C; Mon, 02 Sep 2024 16:31:58 +0300 (EEST) From: Andy Shevchenko To: Andy Shevchenko , linux-gpio@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: Linus Walleij , Bartosz Golaszewski , Maxime Coquelin , Alexandre Torgue Subject: [PATCH v1 3/5] gpio: stmpe: Utilise temporary variable for struct device Date: Mon, 2 Sep 2024 16:30:42 +0300 Message-ID: <20240902133148.2569486-4-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240902133148.2569486-1-andriy.shevchenko@linux.intel.com> References: <20240902133148.2569486-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240902_063204_266726_305E6189 X-CRM114-Status: GOOD ( 13.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org We have a temporary variable to keep a pointer to struct device. Utilise it where it makes sense. Signed-off-by: Andy Shevchenko Reviewed-by: Linus Walleij --- drivers/gpio/gpio-stmpe.c | 19 +++++++++---------- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/gpio/gpio-stmpe.c b/drivers/gpio/gpio-stmpe.c index 99f1482b2ab3..7f2911c478ea 100644 --- a/drivers/gpio/gpio-stmpe.c +++ b/drivers/gpio/gpio-stmpe.c @@ -464,17 +464,17 @@ static void stmpe_gpio_disable(void *stmpe) static int stmpe_gpio_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; - struct stmpe *stmpe = dev_get_drvdata(pdev->dev.parent); - struct device_node *np = pdev->dev.of_node; + struct stmpe *stmpe = dev_get_drvdata(dev->parent); + struct device_node *np = dev->of_node; struct stmpe_gpio *stmpe_gpio; int ret, irq; if (stmpe->num_gpios > MAX_GPIOS) { - dev_err(&pdev->dev, "Need to increase maximum GPIO number\n"); + dev_err(dev, "Need to increase maximum GPIO number\n"); return -EINVAL; } - stmpe_gpio = devm_kzalloc(&pdev->dev, sizeof(*stmpe_gpio), GFP_KERNEL); + stmpe_gpio = devm_kzalloc(dev, sizeof(*stmpe_gpio), GFP_KERNEL); if (!stmpe_gpio) return -ENOMEM; @@ -483,7 +483,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) stmpe_gpio->stmpe = stmpe; stmpe_gpio->chip = template_chip; stmpe_gpio->chip.ngpio = stmpe->num_gpios; - stmpe_gpio->chip.parent = &pdev->dev; + stmpe_gpio->chip.parent = dev; stmpe_gpio->chip.base = -1; if (IS_ENABLED(CONFIG_DEBUG_FS)) @@ -496,7 +496,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) if (ret) return ret; - ret = devm_add_action_or_reset(&pdev->dev, stmpe_gpio_disable, stmpe); + ret = devm_add_action_or_reset(dev, stmpe_gpio_disable, stmpe); if (ret) return ret; @@ -504,9 +504,8 @@ static int stmpe_gpio_probe(struct platform_device *pdev) if (irq > 0) { struct gpio_irq_chip *girq; - ret = devm_request_threaded_irq(&pdev->dev, irq, NULL, - stmpe_gpio_irq, IRQF_ONESHOT, - "stmpe-gpio", stmpe_gpio); + ret = devm_request_threaded_irq(dev, irq, NULL, stmpe_gpio_irq, + IRQF_ONESHOT, "stmpe-gpio", stmpe_gpio); if (ret) return dev_err_probe(dev, ret, "unable to register IRQ handler\n"); @@ -522,7 +521,7 @@ static int stmpe_gpio_probe(struct platform_device *pdev) girq->init_valid_mask = stmpe_init_irq_valid_mask; } - return devm_gpiochip_add_data(&pdev->dev, &stmpe_gpio->chip, stmpe_gpio); + return devm_gpiochip_add_data(dev, &stmpe_gpio->chip, stmpe_gpio); } static struct platform_driver stmpe_gpio_driver = {