]> www.infradead.org Git - users/willy/xarray.git/commitdiff
power: supply: bq2415x_charger: use dev_to_psy()
authorThomas Weißschuh <linux@weissschuh.net>
Tue, 10 Dec 2024 21:55:59 +0000 (22:55 +0100)
committerSebastian Reichel <sebastian.reichel@collabora.com>
Wed, 11 Dec 2024 01:00:25 +0000 (02:00 +0100)
Use the new, explicit accessor to go from a 'struct device' to its
'struct power_supply'.

Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
Link: https://lore.kernel.org/r/20241210-power-supply-dev_to_psy-v2-12-9d8c9d24cfe4@weissschuh.net
Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
drivers/power/supply/bq2415x_charger.c

index 25e28dac900deae8c3ab605f1fdab53c397c8ecb..5e174242d2dec49f0dc16822ae862af77a82f3d7 100644 (file)
@@ -1050,7 +1050,7 @@ static ssize_t bq2415x_sysfs_show_status(struct device *dev,
                                         struct device_attribute *attr,
                                         char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        enum bq2415x_command command;
        int ret;
@@ -1083,7 +1083,7 @@ static ssize_t bq2415x_sysfs_set_timer(struct device *dev,
                                       const char *buf,
                                       size_t count)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        int ret = 0;
 
@@ -1104,7 +1104,7 @@ static ssize_t bq2415x_sysfs_show_timer(struct device *dev,
                                        struct device_attribute *attr,
                                        char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
 
        if (bq->timer_error)
@@ -1128,7 +1128,7 @@ static ssize_t bq2415x_sysfs_set_mode(struct device *dev,
                                      const char *buf,
                                      size_t count)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        enum bq2415x_mode mode;
        int ret = 0;
@@ -1180,7 +1180,7 @@ static ssize_t bq2415x_sysfs_show_mode(struct device *dev,
                                       struct device_attribute *attr,
                                       char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        ssize_t ret = 0;
 
@@ -1217,7 +1217,7 @@ static ssize_t bq2415x_sysfs_show_reported_mode(struct device *dev,
                                                struct device_attribute *attr,
                                                char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
 
        if (bq->automode < 0)
@@ -1245,7 +1245,7 @@ static ssize_t bq2415x_sysfs_set_registers(struct device *dev,
                                           const char *buf,
                                           size_t count)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        ssize_t ret = 0;
        unsigned int reg;
@@ -1280,7 +1280,7 @@ static ssize_t bq2415x_sysfs_show_registers(struct device *dev,
                                            struct device_attribute *attr,
                                            char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        ssize_t ret = 0;
 
@@ -1298,7 +1298,7 @@ static ssize_t bq2415x_sysfs_set_limit(struct device *dev,
                                       const char *buf,
                                       size_t count)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        long val;
        int ret;
@@ -1329,7 +1329,7 @@ static ssize_t bq2415x_sysfs_show_limit(struct device *dev,
                                        struct device_attribute *attr,
                                        char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        int ret;
 
@@ -1357,7 +1357,7 @@ static ssize_t bq2415x_sysfs_set_enable(struct device *dev,
                                        const char *buf,
                                        size_t count)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        enum bq2415x_command command;
        long val;
@@ -1392,7 +1392,7 @@ static ssize_t bq2415x_sysfs_show_enable(struct device *dev,
                                         struct device_attribute *attr,
                                         char *buf)
 {
-       struct power_supply *psy = dev_get_drvdata(dev);
+       struct power_supply *psy = dev_to_psy(dev);
        struct bq2415x_device *bq = power_supply_get_drvdata(psy);
        enum bq2415x_command command;
        int ret;