rtc: m41t80: remove useless indirection
authorAlexandre Belloni <alexandre.belloni@bootlin.com>
Sun, 25 Feb 2018 22:15:00 +0000 (23:15 +0100)
committerAlexandre Belloni <alexandre.belloni@bootlin.com>
Sat, 17 Mar 2018 13:20:48 +0000 (14:20 +0100)
m41t80_get_datetime and m41t80_set_datetime are only used after casting dev
to an i2c_client. Remove that useless indirection.

Signed-off-by: Alexandre Belloni <alexandre.belloni@bootlin.com>
drivers/rtc/rtc-m41t80.c

index f773209..ad03e2f 100644 (file)
@@ -198,9 +198,9 @@ static irqreturn_t m41t80_handle_irq(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-static int m41t80_get_datetime(struct i2c_client *client,
-                              struct rtc_time *tm)
+static int m41t80_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
+       struct i2c_client *client = to_i2c_client(dev);
        unsigned char buf[8];
        int err, flags;
 
@@ -232,9 +232,9 @@ static int m41t80_get_datetime(struct i2c_client *client,
        return 0;
 }
 
-/* Sets the given date and time to the real time clock. */
-static int m41t80_set_datetime(struct i2c_client *client, struct rtc_time *tm)
+static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm)
 {
+       struct i2c_client *client = to_i2c_client(dev);
        struct m41t80_data *clientdata = i2c_get_clientdata(client);
        unsigned char buf[8];
        int err, flags;
@@ -297,16 +297,6 @@ static int m41t80_rtc_proc(struct device *dev, struct seq_file *seq)
        return 0;
 }
 
-static int m41t80_rtc_read_time(struct device *dev, struct rtc_time *tm)
-{
-       return m41t80_get_datetime(to_i2c_client(dev), tm);
-}
-
-static int m41t80_rtc_set_time(struct device *dev, struct rtc_time *tm)
-{
-       return m41t80_set_datetime(to_i2c_client(dev), tm);
-}
-
 static int m41t80_alarm_irq_enable(struct device *dev, unsigned int enabled)
 {
        struct i2c_client *client = to_i2c_client(dev);
@@ -947,7 +937,7 @@ static int m41t80_probe(struct i2c_client *client,
 
        if (rc >= 0 && rc & M41T80_ALHOUR_HT) {
                if (m41t80_data->features & M41T80_FEATURE_HT) {
-                       m41t80_get_datetime(client, &tm);
+                       m41t80_rtc_read_time(&client->dev, &tm);
                        dev_info(&client->dev, "HT bit was set!\n");
                        dev_info(&client->dev,
                                 "Power Down at %04i-%02i-%02i %02i:%02i:%02i\n",