[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241103112208.233f7180@jic23-huawei>
Date: Sun, 3 Nov 2024 11:22:08 +0000
From: Jonathan Cameron <jic23@...nel.org>
To: Aren Moynihan <aren@...cevolution.org>
Cc: Lars-Peter Clausen <lars@...afoo.de>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>, Rob Herring <robh@...nel.org>,
Krzysztof Kozlowski <krzk+dt@...nel.org>, Conor Dooley
<conor+dt@...nel.org>, Chen-Yu Tsai <wens@...e.org>, Jernej Skrabec
<jernej.skrabec@...il.com>, Samuel Holland <samuel@...lland.org>, Kaustabh
Chakraborty <kauschluss@...root.org>, Barnabás Czémán
<trabarni@...il.com>, Ondrej Jirman <megi@....cz>, Uwe Kleine-König <u.kleine-koenig@...gutronix.de>,
linux-iio@...r.kernel.org, devicetree@...r.kernel.org,
linux-kernel@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-sunxi@...ts.linux.dev, Dragan Simic <dsimic@...jaro.org>,
phone-devel@...r.kernel.org
Subject: Re: [PATCH v4 2/6] iio: light: stk3310: handle all remove logic
with devm callbacks
Hi Aren,
> @@ -624,7 +640,7 @@ static int stk3310_probe(struct i2c_client *client)
> device_property_read_u32(&client->dev, "proximity-near-level",
> &data->ps_near_level);
>
> - mutex_init(&data->lock);
> + devm_mutex_init(&client->dev, &data->lock);
ret = devm_mutex_init()
if (ret)
return ret;
It is very unlikely to fail but technically it can. Andy has been fixing
this up across the kernel (including IIO) so let's not introduce another
case that doesn't check it!
If nothing else comes up I can probably tidy that up whilst applying.
Jonathan
>
> ret = stk3310_regmap_init(data);
> if (ret < 0)
> @@ -650,29 +666,17 @@ static int stk3310_probe(struct i2c_client *client)
> if (ret < 0) {
> dev_err(&client->dev, "request irq %d failed\n",
> client->irq);
> - goto err_standby;
> + return ret;
> }
> }
>
> - ret = iio_device_register(indio_dev);
> + ret = devm_iio_device_register(&client->dev, indio_dev);
> if (ret < 0) {
> dev_err(&client->dev, "device_register failed\n");
> - goto err_standby;
> + return ret;
> }
>
> return 0;
> -
> -err_standby:
> - stk3310_set_state(data, STK3310_STATE_STANDBY);
> - return ret;
> -}
> -
> -static void stk3310_remove(struct i2c_client *client)
> -{
> - struct iio_dev *indio_dev = i2c_get_clientdata(client);
> -
> - iio_device_unregister(indio_dev);
> - stk3310_set_state(iio_priv(indio_dev), STK3310_STATE_STANDBY);
> }
>
> static int stk3310_suspend(struct device *dev)
> @@ -736,7 +740,6 @@ static struct i2c_driver stk3310_driver = {
> .acpi_match_table = stk3310_acpi_id,
> },
> .probe = stk3310_probe,
> - .remove = stk3310_remove,
> .id_table = stk3310_i2c_id,
> };
>
Powered by blists - more mailing lists