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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Thu, 17 Aug 2023 15:48:07 +0300
From:   Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To:     Marcus Folkesson <marcus.folkesson@...il.com>
Cc:     Kent Gustavsson <kent@...oris.se>,
        Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        Rob Herring <robh+dt@...nel.org>,
        Krzysztof Kozlowski <krzysztof.kozlowski+dt@...aro.org>,
        Conor Dooley <conor+dt@...nel.org>,
        Cosmin Tanislav <demonsingur@...il.com>,
        Arnd Bergmann <arnd@...db.de>,
        ChiYuan Huang <cy_huang@...htek.com>,
        Haibo Chen <haibo.chen@....com>,
        Ramona Bolboaca <ramona.bolboaca@...log.com>,
        Ibrahim Tilki <Ibrahim.Tilki@...log.com>,
        ChiaEn Wu <chiaen_wu@...htek.com>,
        William Breathitt Gray <william.gray@...aro.org>,
        linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 3/6] iio: adc: mcp3911: simplify usage of spi->dev

On Thu, Aug 17, 2023 at 02:05:15PM +0200, Marcus Folkesson wrote:
> Replace the usage of `adc->spi->dev` with `dev` to make the code prettier.

...

> @@ -277,9 +278,7 @@ static int mcp3911_calc_scale_table(struct mcp3911 *adc)

>  		ret = regulator_get_voltage(adc->vref);
>  		if (ret < 0) {
> -			dev_err(&adc->spi->dev,
> -				"failed to get vref voltage: %d\n",
> -			       ret);
> +			dev_err(dev, "failed to get vref voltage: %d\n", ret);

So, this can be part of the previous patch as this function is the part of the
->probe() stage.

>  			return ret;
>  		}

...

> @@ -396,12 +395,10 @@ static int mcp3911_config(struct mcp3911 *adc)
>  	if (ret)
>  		device_property_read_u32(dev, "device-addr", &adc->dev_addr);
>  	if (adc->dev_addr > 3) {
> -		dev_err(&adc->spi->dev,
> -			"invalid device address (%i). Must be in range 0-3.\n",
> -			adc->dev_addr);
> +		dev_err(dev, "invalid device address (%i). Must be in range 0-3.\n", adc->dev_addr);
>  		return -EINVAL;

Ditto.

>  	}

...

> +		adc->trig = devm_iio_trigger_alloc(dev, "%s-dev%d",
> +						   indio_dev->name,
> +						   iio_device_id(indio_dev));

Seem you already switched to longer lines, hence this can be compressed
to two lines.

>  		if (!adc->trig)
>  			return -ENOMEM;

...

> +		ret = devm_request_irq(dev, spi->irq,
> +				       &iio_trigger_generic_data_rdy_poll,

In the similar way as above.

> +				       IRQF_NO_AUTOEN | IRQF_ONESHOT,
> +				       indio_dev->name, adc->trig);
>  		if (ret)
>  			return ret;


-- 
With Best Regards,
Andy Shevchenko


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ