diff --git a/drivers/bmi088/bmi088_core.c b/drivers/bmi088/bmi088_core.c index ee5a0247..29a017bc 100644 --- a/drivers/bmi088/bmi088_core.c +++ b/drivers/bmi088/bmi088_core.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. /* Device tree example: * @@ -1500,10 +1500,12 @@ static int bmi_init(struct bmi_state *st, const struct i2c_device_id *id) #if defined(NV_I2C_DRIVER_STRUCT_PROBE_WITHOUT_I2C_DEVICE_ID_ARG) /* Linux 6.3 */ static int bmi_probe(struct i2c_client *client) +{ + const struct i2c_device_id *id = i2c_match_id(bmi_i2c_device_ids, client); #else static int bmi_probe(struct i2c_client *client, const struct i2c_device_id *id) -#endif { +#endif struct bmi_state *st; int ret; @@ -1513,11 +1515,7 @@ static int bmi_probe(struct i2c_client *client, const struct i2c_device_id *id) i2c_set_clientdata(client, st); st->i2c = client; -#if KERNEL_VERSION(6, 3, 0) <= LINUX_VERSION_CODE - ret = bmi_init(st, NULL); -#else ret = bmi_init(st, id); -#endif if (ret) { bmi_remove(client); return ret; diff --git a/drivers/bmi088/bmi088_iio.c b/drivers/bmi088/bmi088_iio.c index 3cb4df18..93c8f6ad 100644 --- a/drivers/bmi088/bmi088_iio.c +++ b/drivers/bmi088/bmi088_iio.c @@ -1,5 +1,5 @@ // SPDX-License-Identifier: GPL-2.0-only -// SPDX-FileCopyrightText: Copyright (c) 2023-2024, NVIDIA CORPORATION & AFFILIATES. All rights reserved. +// SPDX-FileCopyrightText: Copyright (c) 2023-2025, NVIDIA CORPORATION & AFFILIATES. All rights reserved. #include #include @@ -222,7 +222,11 @@ static ssize_t bmi_iio_attr_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) { - struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + + if (!indio_dev) + return -EINVAL; + struct bmi_iio_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); char *str; @@ -230,7 +234,7 @@ static ssize_t bmi_iio_attr_store(struct device *dev, unsigned int new; int ret; - if (!indio_dev || !st || !this_attr) + if (!st || !this_attr) return -EINVAL; mutex_lock(BMI_MUTEX(indio_dev)); @@ -275,13 +279,17 @@ static ssize_t bmi_iio_attr_store(struct device *dev, static ssize_t bmi_iio_attr_show(struct device *dev, struct device_attribute *attr, char *buf) { - struct iio_dev *indio_dev = dev_get_drvdata(dev); + struct iio_dev *indio_dev = dev_to_iio_dev(dev); + + if (!indio_dev) + return -EINVAL; + struct bmi_iio_state *st = iio_priv(indio_dev); struct iio_dev_attr *this_attr = to_iio_dev_attr(attr); ssize_t t = 0; unsigned int i; - if (!indio_dev || !st || !this_attr) + if (!st || !this_attr) return -EINVAL; switch (this_attr->address) {