lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <3d67442c-87a7-e05b-7f69-de501fc0ad29@linux.intel.com>
Date:   Wed, 15 Dec 2021 09:51:10 +0200
From:   Jarkko Nikula <jarkko.nikula@...ux.intel.com>
To:     Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-i2c@...r.kernel.org, linux-kernel@...r.kernel.org
Cc:     Mika Westerberg <mika.westerberg@...ux.intel.com>
Subject: Re: [PATCH v2 1/6] i2c: designware-pci: Use temporary variable for
 struct device

On 12/13/21 20:00, Andy Shevchenko wrote:
> Use temporary variable for struct device to make code neater.
> 
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> ---
> v2: dropped dev --> i_dev renaming (Jarkko)
>   drivers/i2c/busses/i2c-designware-pcidrv.c | 52 +++++++++++-----------
>   1 file changed, 26 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-designware-pcidrv.c b/drivers/i2c/busses/i2c-designware-pcidrv.c
> index 0f409a4c2da0..5f76010f7dfd 100644
> --- a/drivers/i2c/busses/i2c-designware-pcidrv.c
> +++ b/drivers/i2c/busses/i2c-designware-pcidrv.c
> @@ -207,23 +207,23 @@ static struct dw_pci_controller dw_pci_controllers[] = {
>   };
>   
>   #ifdef CONFIG_PM
> -static int i2c_dw_pci_suspend(struct device *dev)
> +static int i2c_dw_pci_suspend(struct device *d)
>   {
> -	struct dw_i2c_dev *i_dev = dev_get_drvdata(dev);
> +	struct dw_i2c_dev *dev = dev_get_drvdata(d);
>   >   
> -	dev = devm_kzalloc(&pdev->dev, sizeof(struct dw_i2c_dev), GFP_KERNEL);
> +	dev = devm_kzalloc(d, sizeof(*dev), GFP_KERNEL);
Ditto.

> -	i_dev->suspended = true;
> -	i_dev->disable(i_dev);
> +	dev->suspended = true;
> +	dev->disable(dev);
>   
In my opinion this brings more mess than removes. If I see 
dev->something I'll immediatelly think "struct device" and get confused. 
x_dev->something or dev_y->something not so much. And this change adds 
in my opinion more confusion than removes.

>   	if (id->driver_data >= ARRAY_SIZE(dw_pci_controllers)) {
> -		dev_err(&pdev->dev, "%s: invalid driver data %ld\n", __func__,
> -			id->driver_data);
> +		dev_err(d, "%s: invalid driver data %ld\n", __func__, id->driver_data);
>   		return -EINVAL;

Honestly, what's is the value of this change? Yet another differently 
named "device" pointer more to the mess (Inconsistent naming use of 
struct dw_i2c_dev *dev, struct dw_i2c_dev *i_dev and struct device *dev 
in the i2c-designware-*).

Jarkko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ