mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Satyam Gupta <sgsatyam@google.com>
Cc: "Jonathan Cameron" <jic23@kernel.org>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	"Andy Shevchenko" <andriy.shevchenko@intel.com>,
	"Benson Leung" <bleung@chromium.org>,
	"Guenter Roeck" <groeck@chromium.org>,
	"Enric Balletbo i Serra" <eballetbo@kernel.org>,
	linux-iio@vger.kernel.org, chrome-platform@lists.linux.dev,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v2] iio: cros_ec: Use platform sensor_num to unregister FIFO callback
Date: Fri, 6 Nov 2026 03:10:15 +0000	[thread overview]
Message-ID: <au1FF5K9EALuqnNR@google.com> (raw)
In-Reply-To: <20261105132057.2429385-1-sgsatyam@google.com>

On Thu, Nov 05, 2026 at 01:20:57PM +0000, Satyam Gupta wrote:
> No in-tree driver changes the field after probe, so mainline is not
> known to hit this. The ChromeOS RGB light sensor support does: it
> changes the field while a command is in flight, and unbinding the
> device then leaves a stale callback. Found by an AI code review agent.

I think this paragraph can be moved after "---" so that it isn't part of
the commit message.

>  static void cros_ec_sensors_core_clean(void *arg)
>  {
>  	struct platform_device *pdev = (struct platform_device *)arg;
> -	struct cros_ec_sensorhub *sensor_hub =
> -		dev_get_drvdata(pdev->dev.parent);
> -	struct iio_dev *indio_dev = platform_get_drvdata(pdev);
> -	struct cros_ec_sensors_core_state *st = iio_priv(indio_dev);
> -	u8 sensor_num = st->param.info.sensor_num;
> +	struct device *dev = &pdev->dev;
> +	struct cros_ec_sensorhub *sensor_hub = dev_get_drvdata(dev->parent);
> +	struct cros_ec_sensor_platform *pdata = dev_get_platdata(dev);
>  
> -	cros_ec_sensorhub_unregister_push_data(sensor_hub, sensor_num);
> +	cros_ec_sensorhub_unregister_push_data(sensor_hub, pdata->sensor_num);

So now `pdev` is only used to carry `dev`.  How about just passing `dev`
to this function in [1] so that it can be simplified?

[1] https://elixir.bootlin.com/linux/v7.3/source/drivers/iio/common/cros_ec_sensors/cros_ec_sensors_core.c#L394

  reply	other threads:[~2026-11-06  3:10 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-05 13:20 Satyam Gupta
2026-11-06  3:10 ` Tzung-Bi Shih [this message]
2026-11-06  7:19   ` [PATCH v3] " Satyam Gupta

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=au1FF5K9EALuqnNR@google.com \
    --to=tzungbi@kernel.org \
    --cc=andriy.shevchenko@intel.com \
    --cc=andy@kernel.org \
    --cc=bleung@chromium.org \
    --cc=chrome-platform@lists.linux.dev \
    --cc=dlechner@baylibre.com \
    --cc=eballetbo@kernel.org \
    --cc=groeck@chromium.org \
    --cc=jic23@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=sgsatyam@google.com \
    /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

all inboxes | Powered by JetHome®