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: <CAE3SzaTBzF=W9++d4CmW-vRkKLy9zd2oB4ADX8NuH-woTvJxqg@mail.gmail.com>
Date: Tue, 5 Aug 2025 09:35:34 +0530
From: Akshay Jindal <akshayaj.lkd@...il.com>
To: Andy Shevchenko <andy.shevchenko@...il.com>
Cc: anshulusr@...il.com, jic23@...nel.org, 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] iio: light: ltr390: Add remove callback with needed
 support in device registration

On Tue, Aug 5, 2025 at 2:36 AM Andy Shevchenko
<andy.shevchenko@...il.com> wrote:
>
> Doesn't sound right to me. HAve you investigated PM runtime paths?
Yes I did investigate and found that PM runtime->suspend() callback
co-exists with remove callback.

> Looking at what the code you added there it sounds to me like a part
> of PM runtime ->suspend() callback.
Yes, part of functionality will always be common, because both the
callback implementations put
the device into powered down or low power state which is what has been done here
Both _suspend() and remove are called at different times in the lifecycle of the
driver, but with respect to register setting, they put the device into
power down state.
Additionally .remove() can have code for:
1. disable runtime power management (if enabled while device registration).
2. device cleanup (disabling interrupt and cleaning up other configs done).
2. unregister the device.

For eg: another light sensor bh1750
static void bh1750_remove(struct i2c_client *client)
{
    iio_device_unregister(indio_dev);
    mutex_lock(&data->lock);
    i2c_smbus_write_byte(client, BH1750_POWER_DOWN);
    mutex_unlock(&data->lock);
}

static int bh1750_suspend(struct device *dev)
{
    mutex_lock(&data->lock);
    ret = i2c_smbus_write_byte(data->client, BH1750_POWER_DOWN);
    mutex_unlock(&data->lock);
    return ret;
}

In drivers/iio/light, you can find similar examples in pa12203001,
rpr0521, apds9960,
vcnl4000, isl29028, vcnl4035. You can find many more examples in
sensors other than light sensors.

Thanks,
Akshay

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ