drivers:iio:stm:accel:st_acc33: use dev_to_iio_dev() in sysfs callbacks
On kernel 6.1 the `dev_get_drvdata()` in IIO sysfs callbacks cause a kernel panic because the IIO core as well as most other drivers have switched over to using `dev_to_iio_dev()`. Signed-off-by: Mario Tesi <mario.tesi@st.com> Change-Id: I891493c3562dea8ce71e1653bc5f938947afb876 Reviewed-on: https://gerrit.st.com/c/linuxandroidopen/stm-ldd-iio/+/335869 Tested-by: CITOOLS <MDG-smet-aci-reviews@list.st.com> Reviewed-by: Matteo DAMENO <matteo.dameno@st.com>
This commit is contained in:
parent
492ec504f9
commit
46cffd34d7
@ -103,7 +103,7 @@ ssize_t st_acc33_flush_hwfifo(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t size)
|
||||
{
|
||||
struct iio_dev *iio_dev = dev_get_drvdata(device);
|
||||
struct iio_dev *iio_dev = dev_to_iio_dev(device);
|
||||
struct st_acc33_hw *hw = iio_priv(iio_dev);
|
||||
s64 code;
|
||||
int err;
|
||||
@ -127,7 +127,7 @@ ssize_t st_acc33_get_hwfifo_watermark(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct iio_dev *iio_dev = dev_get_drvdata(device);
|
||||
struct iio_dev *iio_dev = dev_to_iio_dev(device);
|
||||
struct st_acc33_hw *hw = iio_priv(iio_dev);
|
||||
|
||||
return sprintf(buf, "%d\n", hw->watermark);
|
||||
@ -144,7 +144,7 @@ ssize_t st_acc33_set_hwfifo_watermark(struct device *device,
|
||||
struct device_attribute *attr,
|
||||
const char *buf, size_t size)
|
||||
{
|
||||
struct iio_dev *iio_dev = dev_get_drvdata(device);
|
||||
struct iio_dev *iio_dev = dev_to_iio_dev(device);
|
||||
struct st_acc33_hw *hw = iio_priv(iio_dev);
|
||||
int err, val;
|
||||
|
||||
|
@ -374,7 +374,7 @@ static ssize_t st_acc33_get_module_id(struct device *dev,
|
||||
struct device_attribute *attr,
|
||||
char *buf)
|
||||
{
|
||||
struct iio_dev *iio_dev = dev_get_drvdata(dev);
|
||||
struct iio_dev *iio_dev = dev_to_iio_dev(dev);
|
||||
struct st_acc33_hw *hw = iio_priv(iio_dev);
|
||||
|
||||
return scnprintf(buf, PAGE_SIZE, "%u\n", hw->module_id);
|
||||
|
Loading…
Reference in New Issue
Block a user