From nobody Fri Nov 29 05:28:17 2024 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.11]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A7531A01C6; Wed, 25 Sep 2024 12:49:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.11 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727268569; cv=none; b=kY1K5LGpyobmi5JGu9UIheP7u89ozePOft4MxlTqP8IM+enhCb1FmIJkuK3SaOmAOtlEbmuI+dL2XUAPcoKdY/p7pi4gs2npITnM29/XGyn6nK4/zS2vL4ngGpgbjHX4LIggUpb9An4wTy9tHJ7AZI+9N3+BAE+/C+4QMouP7pY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727268569; c=relaxed/simple; bh=LFjwnhTyAbIo1KKyGMp8jpEjC4AjTZYnoigdh3c5MUY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nQxaNY2wvwLPH3Je+2JLmVZg92qKsPGtfo8nulJiD3tTKfI9IJtcpx+MfR3Oyf76h/gq+aaVCBQzO+3/wkzu8FWzpNy7kfZR6RGxlNOQJKx9tI/qjoQQLyeK/NUmlIU0gzB2ppytpgZsFEEL7ZkhxWZrqp11wODVN4NhJ14A4pY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=J4g5KDA3; arc=none smtp.client-ip=198.175.65.11 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="J4g5KDA3" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1727268566; x=1758804566; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=LFjwnhTyAbIo1KKyGMp8jpEjC4AjTZYnoigdh3c5MUY=; b=J4g5KDA3i1YK8i0cMQj/MAwc7tadK/MxECMlWBa3BAkN1r5UuQ10D3KV RzUCHa96h/m3T6tLLb5x1JTZhEYh3M3K20N97yTQASy5iUSk6l4sSZ0ve s8ywnQrQX1sLuJmebin1HlW2HI/Oy0SnuXCsb0urFHtL+el03ZpnDcvSL FlnPsl1oZdcokK8EuOp6IPGYZktWHjuj4iVnG1Bba4F1OELZge4N3T+gt hmEoa/VNi4pB1MaC5K+7A7HRrMMXUlB6lt/xJZlY0P4ATxhj9erjJ6klt sobYHkaOy5ssid/o0frOqBdzPSkeE5qSSdnAEJFtn0zyRKTrh85SghEDJ A==; X-CSE-ConnectionGUID: PmcskdtbS9a6CHg7NCN0dQ== X-CSE-MsgGUID: 9TTHPTytRe21FS151CKbLw== X-IronPort-AV: E=McAfee;i="6700,10204,11206"; a="36878373" X-IronPort-AV: E=Sophos;i="6.10,257,1719903600"; d="scan'208";a="36878373" Received: from orviesa008.jf.intel.com ([10.64.159.148]) by orvoesa103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 25 Sep 2024 05:49:21 -0700 X-CSE-ConnectionGUID: UIlv9BReRSizonPprhY3cA== X-CSE-MsgGUID: jiDsDSyGQu+rzbLAPxRFjg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.10,257,1719903600"; d="scan'208";a="72577340" Received: from black.fi.intel.com ([10.237.72.28]) by orviesa008.jf.intel.com with ESMTP; 25 Sep 2024 05:49:18 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 9837A192; Wed, 25 Sep 2024 15:49:17 +0300 (EEST) From: Andy Shevchenko To: Mario Limonciello , Andy Shevchenko , Andi Shyti , Jarkko Nikula , linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org Cc: Mika Westerberg , Jan Dabros , Philipp Zabel , Narasimhan.V@amd.com, Borislav Petkov , Kim Phillips Subject: [PATCH v1 1/5] i2c: designware: Use temporary variable for struct device Date: Wed, 25 Sep 2024 15:44:19 +0300 Message-ID: <20240925124916.976173-2-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.43.0.rc1.1336.g36b5255a03ac In-Reply-To: <20240925124916.976173-1-andriy.shevchenko@linux.intel.com> References: <20240925124916.976173-1-andriy.shevchenko@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" Use temporary variable for struct device to make code neater. Reviewed-by: Mario Limonciello Reviewed-by: Andi Shyti Signed-off-by: Andy Shevchenko --- drivers/i2c/busses/i2c-designware-pcidrv.c | 29 ++++++------- drivers/i2c/busses/i2c-designware-platdrv.c | 48 ++++++++++----------- 2 files changed, 37 insertions(+), 40 deletions(-) diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busse= s/i2c-designware-pcidrv.c index 7b2c5d71a7fc..433cb285d3b2 100644 --- a/drivers/i2c/busses/i2c-designware-pcidrv.c +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c @@ -207,6 +207,7 @@ static const struct software_node dgpu_node =3D { static int i2c_dw_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id) { + struct device *device =3D &pdev->dev; struct dw_i2c_dev *dev; struct i2c_adapter *adap; int r; @@ -214,25 +215,22 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, struct dw_scl_sda_cfg *cfg; =20 if (id->driver_data >=3D ARRAY_SIZE(dw_pci_controllers)) - return dev_err_probe(&pdev->dev, -EINVAL, - "Invalid driver data %ld\n", + return dev_err_probe(device, -EINVAL, "Invalid driver data %ld\n", id->driver_data); =20 controller =3D &dw_pci_controllers[id->driver_data]; =20 r =3D pcim_enable_device(pdev); if (r) - return dev_err_probe(&pdev->dev, r, - "Failed to enable I2C PCI device\n"); + return dev_err_probe(device, r, "Failed to enable I2C PCI device\n"); =20 pci_set_master(pdev); =20 r =3D pcim_iomap_regions(pdev, 1 << 0, pci_name(pdev)); if (r) - return dev_err_probe(&pdev->dev, r, - "I/O memory remapping failed\n"); + return dev_err_probe(device, r, "I/O memory remapping failed\n"); =20 - dev =3D devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL); + dev =3D devm_kzalloc(device, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; =20 @@ -242,7 +240,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, =20 dev->get_clk_rate_khz =3D controller->get_clk_rate_khz; dev->base =3D pcim_iomap_table(pdev)[0]; - dev->dev =3D &pdev->dev; + dev->dev =3D device; dev->irq =3D pci_irq_vector(pdev, 0); dev->flags |=3D controller->flags; =20 @@ -281,14 +279,14 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, if ((dev->flags & MODEL_MASK) =3D=3D MODEL_AMD_NAVI_GPU) { dev->slave =3D i2c_new_ccgx_ucsi(&dev->adapter, dev->irq, &dgpu_node); if (IS_ERR(dev->slave)) - return dev_err_probe(dev->dev, PTR_ERR(dev->slave), + return dev_err_probe(device, PTR_ERR(dev->slave), "register UCSI failed\n"); } =20 - pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_put_autosuspend(&pdev->dev); - pm_runtime_allow(&pdev->dev); + pm_runtime_set_autosuspend_delay(device, 1000); + pm_runtime_use_autosuspend(device); + pm_runtime_put_autosuspend(device); + pm_runtime_allow(device); =20 return 0; } @@ -296,11 +294,12 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev, static void i2c_dw_pci_remove(struct pci_dev *pdev) { struct dw_i2c_dev *dev =3D pci_get_drvdata(pdev); + struct device *device =3D &pdev->dev; =20 i2c_dw_disable(dev); =20 - pm_runtime_forbid(&pdev->dev); - pm_runtime_get_noresume(&pdev->dev); + pm_runtime_forbid(device); + pm_runtime_get_noresume(device); =20 i2c_del_adapter(&dev->adapter); } diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/buss= es/i2c-designware-platdrv.c index 2d0c7348e491..a3e86930bf41 100644 --- a/drivers/i2c/busses/i2c-designware-platdrv.c +++ b/drivers/i2c/busses/i2c-designware-platdrv.c @@ -205,6 +205,7 @@ static void i2c_dw_remove_lock_support(struct dw_i2c_de= v *dev) =20 static int dw_i2c_plat_probe(struct platform_device *pdev) { + struct device *device =3D &pdev->dev; struct i2c_adapter *adap; struct dw_i2c_dev *dev; int irq, ret; @@ -213,15 +214,15 @@ static int dw_i2c_plat_probe(struct platform_device *= pdev) if (irq < 0) return irq; =20 - dev =3D devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL); + dev =3D devm_kzalloc(device, sizeof(*dev), GFP_KERNEL); if (!dev) return -ENOMEM; =20 - dev->flags =3D (uintptr_t)device_get_match_data(&pdev->dev); - if (device_property_present(&pdev->dev, "wx,i2c-snps-model")) + dev->flags =3D (uintptr_t)device_get_match_data(device); + if (device_property_present(device, "wx,i2c-snps-model")) dev->flags =3D MODEL_WANGXUN_SP | ACCESS_POLLING; =20 - dev->dev =3D &pdev->dev; + dev->dev =3D device; dev->irq =3D irq; platform_set_drvdata(pdev, dev); =20 @@ -229,7 +230,7 @@ static int dw_i2c_plat_probe(struct platform_device *pd= ev) if (ret) return ret; =20 - dev->rst =3D devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); + dev->rst =3D devm_reset_control_get_optional_exclusive(device, NULL); if (IS_ERR(dev->rst)) return PTR_ERR(dev->rst); =20 @@ -246,13 +247,13 @@ static int dw_i2c_plat_probe(struct platform_device *= pdev) i2c_dw_configure(dev); =20 /* Optional interface clock */ - dev->pclk =3D devm_clk_get_optional(&pdev->dev, "pclk"); + dev->pclk =3D devm_clk_get_optional(device, "pclk"); if (IS_ERR(dev->pclk)) { ret =3D PTR_ERR(dev->pclk); goto exit_reset; } =20 - dev->clk =3D devm_clk_get_optional(&pdev->dev, NULL); + dev->clk =3D devm_clk_get_optional(device, NULL); if (IS_ERR(dev->clk)) { ret =3D PTR_ERR(dev->clk); goto exit_reset; @@ -280,28 +281,24 @@ static int dw_i2c_plat_probe(struct platform_device *= pdev) I2C_CLASS_HWMON : I2C_CLASS_DEPRECATED; adap->nr =3D -1; =20 - if (dev->flags & ACCESS_NO_IRQ_SUSPEND) { - dev_pm_set_driver_flags(&pdev->dev, - DPM_FLAG_SMART_PREPARE); - } else { - dev_pm_set_driver_flags(&pdev->dev, - DPM_FLAG_SMART_PREPARE | - DPM_FLAG_SMART_SUSPEND); - } + if (dev->flags & ACCESS_NO_IRQ_SUSPEND) + dev_pm_set_driver_flags(device, DPM_FLAG_SMART_PREPARE); + else + dev_pm_set_driver_flags(device, DPM_FLAG_SMART_PREPARE | DPM_FLAG_SMART_= SUSPEND); =20 - device_enable_async_suspend(&pdev->dev); + device_enable_async_suspend(device); =20 /* The code below assumes runtime PM to be disabled. */ - WARN_ON(pm_runtime_enabled(&pdev->dev)); + WARN_ON(pm_runtime_enabled(device)); =20 - pm_runtime_set_autosuspend_delay(&pdev->dev, 1000); - pm_runtime_use_autosuspend(&pdev->dev); - pm_runtime_set_active(&pdev->dev); + pm_runtime_set_autosuspend_delay(device, 1000); + pm_runtime_use_autosuspend(device); + pm_runtime_set_active(device); =20 if (dev->shared_with_punit) - pm_runtime_get_noresume(&pdev->dev); + pm_runtime_get_noresume(device); =20 - pm_runtime_enable(&pdev->dev); + pm_runtime_enable(device); =20 ret =3D i2c_dw_probe(dev); if (ret) @@ -319,15 +316,16 @@ static int dw_i2c_plat_probe(struct platform_device *= pdev) static void dw_i2c_plat_remove(struct platform_device *pdev) { struct dw_i2c_dev *dev =3D platform_get_drvdata(pdev); + struct device *device =3D &pdev->dev; =20 - pm_runtime_get_sync(&pdev->dev); + pm_runtime_get_sync(device); =20 i2c_del_adapter(&dev->adapter); =20 i2c_dw_disable(dev); =20 - pm_runtime_dont_use_autosuspend(&pdev->dev); - pm_runtime_put_sync(&pdev->dev); + pm_runtime_dont_use_autosuspend(device); + pm_runtime_put_sync(device); dw_i2c_plat_pm_cleanup(dev); =20 i2c_dw_remove_lock_support(dev); --=20 2.43.0.rc1.1336.g36b5255a03ac