From: Mario Limonciello <mario.limonciello@amd.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
Jarkko Nikula <jarkko.nikula@linux.intel.com>,
Herbert Xu <herbert@gondor.apana.org.au>,
Wolfram Sang <wsa@kernel.org>,
linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>,
Jan Dabros <jsd@semihalf.com>, Andi Shyti <andi.shyti@kernel.org>,
Philipp Zabel <p.zabel@pengutronix.de>,
Hans de Goede <hdegoede@redhat.com>
Subject: Re: [PATCH v3 23/25] i2c: designware: Use temporary variable for struct device
Date: Fri, 10 Nov 2023 13:36:58 -0600 [thread overview]
Message-ID: <92e374bd-cb58-4bde-9e84-b7cbaf6fa541@amd.com> (raw)
In-Reply-To: <20231110182304.3894319-24-andriy.shevchenko@linux.intel.com>
On 11/10/2023 12:11, Andy Shevchenko wrote:
> Use temporary variable for struct device to make code neater.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Reviewed-by: Mario Limonciello <mario.limonciello@amd.com>
> ---
> drivers/i2c/busses/i2c-designware-pcidrv.c | 24 +++++++-------
> drivers/i2c/busses/i2c-designware-platdrv.c | 35 ++++++++++-----------
> 2 files changed, 27 insertions(+), 32 deletions(-)
>
> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
> index 826c0c0a7c8d..34002c5eb67c 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 = {
> static int i2c_dw_pci_probe(struct pci_dev *pdev,
> const struct pci_device_id *id)
> {
> + struct device *device = &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;
>
> if (id->driver_data >= 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);
>
> controller = &dw_pci_controllers[id->driver_data];
>
> r = 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");
>
> pci_set_master(pdev);
>
> r = 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");
>
> - dev = devm_kzalloc(&pdev->dev, sizeof(*dev), GFP_KERNEL);
> + dev = devm_kzalloc(device, sizeof(*dev), GFP_KERNEL);
> if (!dev)
> return -ENOMEM;
>
> @@ -242,7 +240,7 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
>
> dev->get_clk_rate_khz = controller->get_clk_rate_khz;
> dev->base = pcim_iomap_table(pdev)[0];
> - dev->dev = &pdev->dev;
> + dev->dev = device;
> dev->irq = pci_irq_vector(pdev, 0);
> dev->flags |= controller->flags;
>
> @@ -281,14 +279,14 @@ static int i2c_dw_pci_probe(struct pci_dev *pdev,
> if ((dev->flags & MODEL_MASK) == MODEL_AMD_NAVI_GPU) {
> dev->slave = 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");
> }
>
> - 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);
>
> return 0;
> }
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 1b76f721bf81..02dc1d1001f2 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -237,6 +237,7 @@ static int dw_i2c_plat_get_reset(struct dw_i2c_dev *dev)
>
> static int dw_i2c_plat_probe(struct platform_device *pdev)
> {
> + struct device *device = &pdev->dev;
> struct i2c_adapter *adap;
> struct dw_i2c_dev *dev;
> int irq, ret;
> @@ -245,15 +246,15 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
> if (irq < 0)
> return irq;
>
> - dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
> + dev = devm_kzalloc(device, sizeof(*dev), GFP_KERNEL);
> if (!dev)
> return -ENOMEM;
>
> - dev->flags = (uintptr_t)device_get_match_data(&pdev->dev);
> - if (device_property_present(&pdev->dev, "wx,i2c-snps-model"))
> + dev->flags = (uintptr_t)device_get_match_data(device);
> + if (device_property_present(device, "wx,i2c-snps-model"))
> dev->flags = MODEL_WANGXUN_SP;
>
> - dev->dev = &pdev->dev;
> + dev->dev = device;
> dev->irq = irq;
> platform_set_drvdata(pdev, dev);
>
> @@ -276,11 +277,11 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
> i2c_dw_configure(dev);
>
> /* Optional interface clock */
> - dev->pclk = devm_clk_get_optional(&pdev->dev, "pclk");
> + dev->pclk = devm_clk_get_optional(device, "pclk");
> if (IS_ERR(dev->pclk))
> return PTR_ERR(dev->pclk);
>
> - dev->clk = devm_clk_get_optional(&pdev->dev, NULL);
> + dev->clk = devm_clk_get_optional(device, NULL);
> if (IS_ERR(dev->clk))
> return PTR_ERR(dev->clk);
>
> @@ -306,23 +307,19 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
> I2C_CLASS_HWMON : I2C_CLASS_DEPRECATED;
> adap->nr = -1;
>
> - 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);
>
> - device_enable_async_suspend(&pdev->dev);
> + device_enable_async_suspend(device);
>
> /* The code below assumes runtime PM to be disabled. */
> - WARN_ON(pm_runtime_enabled(&pdev->dev));
> + WARN_ON(pm_runtime_enabled(device));
>
> - 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);
>
> ret = dw_i2c_plat_pm_setup(dev);
> if (ret)
next prev parent reply other threads:[~2023-11-10 19:42 UTC|newest]
Thread overview: 52+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-10 18:11 [PATCH v3 00/25] i2c: designware: code consolidation & cleanups Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 01/25] i2c: designware: Delete adapter before disabling in i2c_dw_pci_remove() Andy Shevchenko
2023-11-15 9:45 ` Jarkko Nikula
2023-11-15 13:49 ` Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 02/25] i2c: designware: Fix PM calls order in dw_i2c_plat_probe() Andy Shevchenko
2023-11-15 11:14 ` Jarkko Nikula
2023-11-15 13:48 ` Andy Shevchenko
2023-11-15 13:51 ` Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 03/25] i2c: designware: Fix reset call " Andy Shevchenko
2023-11-15 11:26 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 04/25] i2c: designware: Let PCI core to take care about interrupt vectors Andy Shevchenko
2023-11-15 12:08 ` Jarkko Nikula
2023-11-15 13:54 ` Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 05/25] i2c: designware: Fix lock probe call order in dw_i2c_plat_probe() Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 06/25] i2c: designware: Replace a while-loop by for-loop Andy Shevchenko
2023-11-10 19:40 ` Mario Limonciello
2023-11-17 13:51 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 07/25] i2c: designware: Save pointer to semaphore callbacks instead of index Andy Shevchenko
2023-11-17 13:51 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 08/25] i2c: designware: Add missing 'c' into PCI IDs variable name Andy Shevchenko
2023-11-17 13:51 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 09/25] i2c: designware: Replace MODULE_ALIAS() with MODULE_DEVICE_TABLE() Andy Shevchenko
2023-11-10 19:39 ` Mario Limonciello
2023-11-17 14:07 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 10/25] i2c: designware: Unify terminator in device ID tables Andy Shevchenko
2023-11-10 19:38 ` Mario Limonciello
2023-11-17 14:18 ` Jarkko Nikula
2023-11-20 14:17 ` Andy Shevchenko
2023-11-17 14:08 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 11/25] i2c: designware: Always provide " Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 12/25] i2c: designware: Drop return value from i2c_dw_acpi_configure() Andy Shevchenko
2023-11-17 14:46 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 13/25] i2c: designware: Drop return value from dw_i2c_of_configure() Andy Shevchenko
2023-11-10 19:41 ` Mario Limonciello
2023-11-17 14:19 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 14/25] i2c: designware: Rename dw_i2c_of_configure() -> i2c_dw_of_configure() Andy Shevchenko
2023-11-10 19:39 ` Mario Limonciello
2023-11-17 14:46 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 15/25] i2c: designware: Consolidate firmware parsing and configuring code Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 16/25] i2c: designware: Unify the firmware type checks Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 17/25] i2c: designware: Move exports to I2C_DW namespaces Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 18/25] i2c: designware: Remove ->disable() callback Andy Shevchenko
2023-11-14 15:03 ` Jarkko Nikula
2023-11-10 18:11 ` [PATCH v3 19/25] i2c: designware: Consolidate PM ops Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 20/25] i2c: designware: Uninline i2c_dw_probe() Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 21/25] i2c: designware: Propagate firmware node Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 22/25] i2c: designware: Use pci_get_drvdata() Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 23/25] i2c: designware: Use temporary variable for struct device Andy Shevchenko
2023-11-10 19:36 ` Mario Limonciello [this message]
2023-11-10 18:11 ` [PATCH v3 24/25] i2c: designware: Get rid of redundant 'else' Andy Shevchenko
2023-11-10 18:11 ` [PATCH v3 25/25] i2c: designware: Fix spelling and other issues in the comments Andy Shevchenko
2023-11-10 19:35 ` Mario Limonciello
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=92e374bd-cb58-4bde-9e84-b7cbaf6fa541@amd.com \
--to=mario.limonciello@amd.com \
--cc=andi.shyti@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=hdegoede@redhat.com \
--cc=herbert@gondor.apana.org.au \
--cc=jarkko.nikula@linux.intel.com \
--cc=jsd@semihalf.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=p.zabel@pengutronix.de \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox