aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/w1/masters/ds1wm.c
diff options
context:
space:
mode:
authorPaul Mackerras <paulus@samba.org>2008-03-13 00:26:33 -0400
committerPaul Mackerras <paulus@samba.org>2008-03-13 00:26:33 -0400
commitbed04a4413376265746053be2a9cfbfc80c98ec9 (patch)
tree8f582294a655f70496cd08aedeb86de31dbad140 /drivers/w1/masters/ds1wm.c
parente37c772e36a7943b2e0bd8f48312e78474c0df15 (diff)
parentc463be3520065ef8c05e3cbdf946c69604e91ceb (diff)
Merge branch 'linux-2.6'
Diffstat (limited to 'drivers/w1/masters/ds1wm.c')
-rw-r--r--drivers/w1/masters/ds1wm.c23
1 files changed, 12 insertions, 11 deletions
diff --git a/drivers/w1/masters/ds1wm.c b/drivers/w1/masters/ds1wm.c
index 688e435b4d9a..10211e493001 100644
--- a/drivers/w1/masters/ds1wm.c
+++ b/drivers/w1/masters/ds1wm.c
@@ -17,6 +17,7 @@
17#include <linux/pm.h> 17#include <linux/pm.h>
18#include <linux/platform_device.h> 18#include <linux/platform_device.h>
19#include <linux/clk.h> 19#include <linux/clk.h>
20#include <linux/err.h>
20#include <linux/delay.h> 21#include <linux/delay.h>
21#include <linux/ds1wm.h> 22#include <linux/ds1wm.h>
22 23
@@ -102,12 +103,12 @@ struct ds1wm_data {
102static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg, 103static inline void ds1wm_write_register(struct ds1wm_data *ds1wm_data, u32 reg,
103 u8 val) 104 u8 val)
104{ 105{
105 __raw_writeb(val, ds1wm_data->map + (reg << ds1wm_data->bus_shift)); 106 __raw_writeb(val, ds1wm_data->map + (reg << ds1wm_data->bus_shift));
106} 107}
107 108
108static inline u8 ds1wm_read_register(struct ds1wm_data *ds1wm_data, u32 reg) 109static inline u8 ds1wm_read_register(struct ds1wm_data *ds1wm_data, u32 reg)
109{ 110{
110 return __raw_readb(ds1wm_data->map + (reg << ds1wm_data->bus_shift)); 111 return __raw_readb(ds1wm_data->map + (reg << ds1wm_data->bus_shift));
111} 112}
112 113
113 114
@@ -149,8 +150,8 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
149 timeleft = wait_for_completion_timeout(&reset_done, DS1WM_TIMEOUT); 150 timeleft = wait_for_completion_timeout(&reset_done, DS1WM_TIMEOUT);
150 ds1wm_data->reset_complete = NULL; 151 ds1wm_data->reset_complete = NULL;
151 if (!timeleft) { 152 if (!timeleft) {
152 dev_dbg(&ds1wm_data->pdev->dev, "reset failed\n"); 153 dev_err(&ds1wm_data->pdev->dev, "reset failed\n");
153 return 1; 154 return 1;
154 } 155 }
155 156
156 /* Wait for the end of the reset. According to the specs, the time 157 /* Wait for the end of the reset. According to the specs, the time
@@ -167,11 +168,11 @@ static int ds1wm_reset(struct ds1wm_data *ds1wm_data)
167 (ds1wm_data->active_high ? DS1WM_INTEN_IAS : 0)); 168 (ds1wm_data->active_high ? DS1WM_INTEN_IAS : 0));
168 169
169 if (!ds1wm_data->slave_present) { 170 if (!ds1wm_data->slave_present) {
170 dev_dbg(&ds1wm_data->pdev->dev, "reset: no devices found\n"); 171 dev_dbg(&ds1wm_data->pdev->dev, "reset: no devices found\n");
171 return 1; 172 return 1;
172 } 173 }
173 174
174 return 0; 175 return 0;
175} 176}
176 177
177static int ds1wm_write(struct ds1wm_data *ds1wm_data, u8 data) 178static int ds1wm_write(struct ds1wm_data *ds1wm_data, u8 data)
@@ -334,7 +335,7 @@ static int ds1wm_probe(struct platform_device *pdev)
334 if (!pdev) 335 if (!pdev)
335 return -ENODEV; 336 return -ENODEV;
336 337
337 ds1wm_data = kzalloc(sizeof (*ds1wm_data), GFP_KERNEL); 338 ds1wm_data = kzalloc(sizeof(*ds1wm_data), GFP_KERNEL);
338 if (!ds1wm_data) 339 if (!ds1wm_data)
339 return -ENOMEM; 340 return -ENOMEM;
340 341
@@ -374,8 +375,8 @@ static int ds1wm_probe(struct platform_device *pdev)
374 goto err1; 375 goto err1;
375 376
376 ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm"); 377 ds1wm_data->clk = clk_get(&pdev->dev, "ds1wm");
377 if (!ds1wm_data->clk) { 378 if (IS_ERR(ds1wm_data->clk)) {
378 ret = -ENOENT; 379 ret = PTR_ERR(ds1wm_data->clk);
379 goto err2; 380 goto err2;
380 } 381 }
381 382