]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
iio: accel: hid-sensor-accel-3d: Get platform data via dev_get_platdata()
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 2 Sep 2024 22:16:46 +0000 (01:16 +0300)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Mon, 30 Sep 2024 08:21:00 +0000 (09:21 +0100)
Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Link: https://patch.msgid.link/20240902222824.1145571-2-andy.shevchenko@gmail.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/hid-sensor-accel-3d.c

index 431a12171504689180a3ca01fc4eae434b338f20..2d5fa3a5d3be79c4814a01d08092f2acdf0447bc 100644 (file)
@@ -328,6 +328,7 @@ static int accel_3d_parse_report(struct platform_device *pdev,
 /* Function to initialize the processing for usage id */
 static int hid_accel_3d_probe(struct platform_device *pdev)
 {
+       struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
        int ret = 0;
        const char *name;
        struct iio_dev *indio_dev;
@@ -335,8 +336,6 @@ static int hid_accel_3d_probe(struct platform_device *pdev)
        const struct iio_chan_spec *channel_spec;
        int channel_size;
 
-       struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
-
        indio_dev = devm_iio_device_alloc(&pdev->dev,
                                          sizeof(struct accel_3d_state));
        if (indio_dev == NULL)
@@ -424,7 +423,7 @@ error_remove_trigger:
 /* Function to deinitialize the processing for usage id */
 static void hid_accel_3d_remove(struct platform_device *pdev)
 {
-       struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data;
+       struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev);
        struct iio_dev *indio_dev = platform_get_drvdata(pdev);
        struct accel_3d_state *accel_state = iio_priv(indio_dev);