diff options
Diffstat (limited to 'drivers/rtc/rtc-rs5c372.c')
-rw-r--r-- | drivers/rtc/rtc-rs5c372.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/rtc/rtc-rs5c372.c b/drivers/rtc/rtc-rs5c372.c index 396c8681f66c..7553d797603f 100644 --- a/drivers/rtc/rtc-rs5c372.c +++ b/drivers/rtc/rtc-rs5c372.c | |||
@@ -151,9 +151,8 @@ static int rs5c372_rtc_proc(struct device *dev, struct seq_file *seq) | |||
151 | { | 151 | { |
152 | int err, osc, trim; | 152 | int err, osc, trim; |
153 | 153 | ||
154 | seq_printf(seq, "24hr\t\t: yes\n"); | 154 | err = rs5c372_get_trim(to_i2c_client(dev), &osc, &trim); |
155 | 155 | if (err == 0) { | |
156 | if ((err = rs5c372_get_trim(to_i2c_client(dev), &osc, &trim)) == 0) { | ||
157 | seq_printf(seq, "%d.%03d KHz\n", osc / 1000, osc % 1000); | 156 | seq_printf(seq, "%d.%03d KHz\n", osc / 1000, osc % 1000); |
158 | seq_printf(seq, "trim\t: %d\n", trim); | 157 | seq_printf(seq, "trim\t: %d\n", trim); |
159 | } | 158 | } |
@@ -170,30 +169,31 @@ static struct rtc_class_ops rs5c372_rtc_ops = { | |||
170 | static ssize_t rs5c372_sysfs_show_trim(struct device *dev, | 169 | static ssize_t rs5c372_sysfs_show_trim(struct device *dev, |
171 | struct device_attribute *attr, char *buf) | 170 | struct device_attribute *attr, char *buf) |
172 | { | 171 | { |
173 | int trim; | 172 | int err, trim; |
174 | 173 | ||
175 | if (rs5c372_get_trim(to_i2c_client(dev), NULL, &trim) == 0) | 174 | err = rs5c372_get_trim(to_i2c_client(dev), NULL, &trim); |
176 | return sprintf(buf, "0x%2x\n", trim); | 175 | if (err) |
176 | return err; | ||
177 | 177 | ||
178 | return 0; | 178 | return sprintf(buf, "0x%2x\n", trim); |
179 | } | 179 | } |
180 | static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); | 180 | static DEVICE_ATTR(trim, S_IRUGO, rs5c372_sysfs_show_trim, NULL); |
181 | 181 | ||
182 | static ssize_t rs5c372_sysfs_show_osc(struct device *dev, | 182 | static ssize_t rs5c372_sysfs_show_osc(struct device *dev, |
183 | struct device_attribute *attr, char *buf) | 183 | struct device_attribute *attr, char *buf) |
184 | { | 184 | { |
185 | int osc; | 185 | int err, osc; |
186 | 186 | ||
187 | if (rs5c372_get_trim(to_i2c_client(dev), &osc, NULL) == 0) | 187 | err = rs5c372_get_trim(to_i2c_client(dev), &osc, NULL); |
188 | return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); | 188 | if (err) |
189 | return err; | ||
189 | 190 | ||
190 | return 0; | 191 | return sprintf(buf, "%d.%03d KHz\n", osc / 1000, osc % 1000); |
191 | } | 192 | } |
192 | static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); | 193 | static DEVICE_ATTR(osc, S_IRUGO, rs5c372_sysfs_show_osc, NULL); |
193 | 194 | ||
194 | static int rs5c372_attach(struct i2c_adapter *adapter) | 195 | static int rs5c372_attach(struct i2c_adapter *adapter) |
195 | { | 196 | { |
196 | dev_dbg(&adapter->dev, "%s\n", __FUNCTION__); | ||
197 | return i2c_probe(adapter, &addr_data, rs5c372_probe); | 197 | return i2c_probe(adapter, &addr_data, rs5c372_probe); |
198 | } | 198 | } |
199 | 199 | ||
@@ -233,8 +233,6 @@ static int rs5c372_probe(struct i2c_adapter *adapter, int address, int kind) | |||
233 | 233 | ||
234 | if (IS_ERR(rtc)) { | 234 | if (IS_ERR(rtc)) { |
235 | err = PTR_ERR(rtc); | 235 | err = PTR_ERR(rtc); |
236 | dev_err(&client->dev, | ||
237 | "unable to register the class device\n"); | ||
238 | goto exit_detach; | 236 | goto exit_detach; |
239 | } | 237 | } |
240 | 238 | ||
@@ -260,8 +258,6 @@ static int rs5c372_detach(struct i2c_client *client) | |||
260 | int err; | 258 | int err; |
261 | struct rtc_device *rtc = i2c_get_clientdata(client); | 259 | struct rtc_device *rtc = i2c_get_clientdata(client); |
262 | 260 | ||
263 | dev_dbg(&client->dev, "%s\n", __FUNCTION__); | ||
264 | |||
265 | if (rtc) | 261 | if (rtc) |
266 | rtc_device_unregister(rtc); | 262 | rtc_device_unregister(rtc); |
267 | 263 | ||