From: Jonathan Cameron <jic23@kernel.org>
To: Aren Moynihan <aren@peacevolution.org>
Cc: "Lars-Peter Clausen" <lars@metafoo.de>,
"Andy Shevchenko" <andriy.shevchenko@linux.intel.com>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
"Chen-Yu Tsai" <wens@csie.org>,
"Jernej Skrabec" <jernej.skrabec@gmail.com>,
"Samuel Holland" <samuel@sholland.org>,
"Kaustabh Chakraborty" <kauschluss@disroot.org>,
"Barnabás Czémán" <trabarni@gmail.com>,
"Ondrej Jirman" <megi@xff.cz>,
"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
linux-sunxi@lists.linux.dev, "Dragan Simic" <dsimic@manjaro.org>,
phone-devel@vger.kernel.org
Subject: Re: [PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks
Date: Sun, 3 Nov 2024 11:22:08 +0000 [thread overview]
Message-ID: <20241103112208.233f7180@jic23-huawei> (raw)
In-Reply-To: <20241102195037.3013934-7-aren@peacevolution.org>
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,
> };
>
next prev parent reply other threads:[~2024-11-03 11:24 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-11-02 19:50 [PATCH v4 0/6] iio: light: stk3310: support powering off during suspend Aren Moynihan
2024-11-02 19:50 ` [PATCH v4 1/6] dt-bindings: iio: light: stk33xx: add vdd and leda regulators Aren Moynihan
2024-11-02 19:50 ` [PATCH v4 2/6] iio: light: stk3310: handle all remove logic with devm callbacks Aren Moynihan
2024-11-03 11:22 ` Jonathan Cameron [this message]
2024-11-03 16:23 ` Aren
2024-11-04 8:32 ` Andy Shevchenko
2024-11-10 18:38 ` Aren
2024-11-10 19:51 ` Andy Shevchenko
2024-11-10 22:37 ` Aren
2024-11-11 9:38 ` Andy Shevchenko
2024-11-02 19:50 ` [PATCH v4 3/6] iio: light: stk3310: Implement vdd and leda supplies Aren Moynihan
2024-11-03 11:31 ` Jonathan Cameron
2024-11-03 16:11 ` Aren
2024-11-04 8:37 ` Andy Shevchenko
2024-11-04 8:35 ` Andy Shevchenko
2024-11-10 18:54 ` Aren
2024-11-02 19:50 ` [PATCH v4 4/6] iio: light: stk3310: use dev_err_probe where possible Aren Moynihan
2024-11-04 8:40 ` Andy Shevchenko
2024-11-10 19:14 ` Aren
2024-11-10 19:52 ` Andy Shevchenko
2024-11-10 21:34 ` Aren
2024-11-11 9:44 ` Andy Shevchenko
2024-11-12 10:15 ` Uwe Kleine-König
2024-11-12 12:31 ` Andy Shevchenko
2024-11-12 13:28 ` Nuno Sá
2024-11-12 23:11 ` Aren
2024-11-23 14:40 ` Jonathan Cameron
2024-11-02 19:50 ` [PATCH v4 5/6] iio: light: stk3310: log error if reading the chip id fails Aren Moynihan
2024-11-04 8:41 ` Andy Shevchenko
2024-11-10 19:16 ` Aren
2024-11-02 19:50 ` [PATCH v4 6/6] arm64: dts: allwinner: pinephone: Add power supplies to stk3311 Aren Moynihan
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=20241103112208.233f7180@jic23-huawei \
--to=jic23@kernel.org \
--cc=andriy.shevchenko@linux.intel.com \
--cc=aren@peacevolution.org \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dsimic@manjaro.org \
--cc=jernej.skrabec@gmail.com \
--cc=kauschluss@disroot.org \
--cc=krzk+dt@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-sunxi@lists.linux.dev \
--cc=megi@xff.cz \
--cc=phone-devel@vger.kernel.org \
--cc=robh@kernel.org \
--cc=samuel@sholland.org \
--cc=trabarni@gmail.com \
--cc=u.kleine-koenig@pengutronix.de \
--cc=wens@csie.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