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: <CAE3SzaRncowQSu4DDT6020hBJiJs0GGkNkjzi8CPxJ5kukoFPw@mail.gmail.com>
Date: Mon, 1 Sep 2025 01:41:33 +0530
From: Akshay Jindal <akshayaj.lkd@...il.com>
To: Jonathan Cameron <jic23@...nel.org>
Cc: anshulusr@...il.com, dlechner@...libre.com, nuno.sa@...log.com, 
	andy@...nel.org, shuah@...nel.org, linux-iio@...r.kernel.org, 
	linux-kernel@...r.kernel.org
Subject: Re: [PATCH v3] iio: light: ltr390: Implement runtime PM support

On Sun, Aug 31, 2025 at 8:41 PM Jonathan Cameron <jic23@...nel.org> wrote:
>
> On Sun, 31 Aug 2025 11:09:26 +0530
> Akshay Jindal <akshayaj.lkd@...il.com> wrote:
>
> > On Sat, Aug 30, 2025 at 11:55 PM Jonathan Cameron <jic23@...nel.org> wrote:
> > >
> > > On Sat, 30 Aug 2025 17:05:00 +0530
> > > Akshay Jindal <akshayaj.lkd@...il.com> wrote:
> > > >  static int ltr390_debugfs_reg_access(struct iio_dev *indio_dev,
> > > >                                               unsigned int reg, unsigned int writeval,
> > > >                                               unsigned int *readval)
> > > >  {
> > > >       struct ltr390_data *data = iio_priv(indio_dev);
> > > > +     struct device *dev = &data->client->dev;
> > > > +     int ret;
> > > >
> > > > -     guard(mutex)(&data->lock);
> > > > +     ret = pm_runtime_resume_and_get(dev);
> > >
> > > So this makes me wonder.  I'd been assuming our disable was only turning the
> > > sensor off, not register access?  Seeing as it's controlled by a register
> > > we can clearly access at least some.
> > >
> > > If that's the case why do we need to runtime resume for debug register
> > > read/write?  We shouldn't care if the sensors are reading or not. In fact
> > > if we do turn the power on we changed the state we are debugging which is
> > > probably not a good plan.
> > Are you suggesting to remove pm_runtime_* calls from all the functions or
> > just the debugfs function?
>
> All the ones where it's not needed.  So as far as I can see it is only
> needed when actually grabbing date.

These are the functions where I have used it currently.
static const struct iio_info ltr390_info = {
        .read_raw = ltr390_read_raw,----> reads sensor data, scale,
int_time, samp_frequency from register
        .write_raw = ltr390_write_raw,-------> writes sampling
frequency, scale, int_time into register.
        .read_avail = ltr390_read_avail, ----------------> no reg read
        .read_event_value = ltr390_read_event_value,-----> reads
interrupt threshold value from register
        .read_event_config = ltr390_read_event_config,----> reads
INT_CFG register
        .write_event_value = ltr390_write_event_value,------> writes
threshold value into register
        .write_event_config = ltr390_write_event_config,-----> writes
into INT_CFG register
        .debugfs_reg_access = ltr390_debugfs_reg_access,-->
reads/writes into all registers
};

Going by your comment, I think I need it only in read_raw and
write_event_config.
There is a similar sensor, ltrf216a (same company, liteon). There only
read_raw has
these pm_runtime_* calls. Let me know your thoughts. I will make the change and
include updated testing details.

Thanks,
Akshay

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ