aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/pnp/driver.c
diff options
context:
space:
mode:
authorBjorn Helgaas <bjorn.helgaas@hp.com>2007-07-26 13:41:20 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-07-26 14:35:20 -0400
commit9dd78466c956ac4b4f38e12032dc4249ccf57ad1 (patch)
tree57ee3822b79049d38c1df952fe77e72a97c718f3 /drivers/pnp/driver.c
parent8ec3cf7d29aef773eee5bc6cd9b0fa4d3fb42480 (diff)
PNP: Lindent all source files
Run Lindent on all PNP source files. Produced by: $ quilt new pnp-lindent $ find drivers/pnp -name \*.[ch] | xargs quilt add $ quilt add include/linux/{pnp.h,pnpbios.h} $ scripts/Lindent drivers/pnp/*.c drivers/pnp/*/*.c include/linux/pnp*.h $ quilt refresh --sort Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com> Cc: Len Brown <lenb@kernel.org> Cc: Adam Belay <ambx1@neo.rr.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/pnp/driver.c')
-rw-r--r--drivers/pnp/driver.c58
1 files changed, 29 insertions, 29 deletions
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 1432806451cd..913d926f8baf 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -17,11 +17,9 @@ static int compare_func(const char *ida, const char *idb)
17{ 17{
18 int i; 18 int i;
19 /* we only need to compare the last 4 chars */ 19 /* we only need to compare the last 4 chars */
20 for (i=3; i<7; i++) 20 for (i = 3; i < 7; i++) {
21 {
22 if (ida[i] != 'X' && 21 if (ida[i] != 'X' &&
23 idb[i] != 'X' && 22 idb[i] != 'X' && toupper(ida[i]) != toupper(idb[i]))
24 toupper(ida[i]) != toupper(idb[i]))
25 return 0; 23 return 0;
26 } 24 }
27 return 1; 25 return 1;
@@ -31,18 +29,19 @@ int compare_pnp_id(struct pnp_id *pos, const char *id)
31{ 29{
32 if (!pos || !id || (strlen(id) != 7)) 30 if (!pos || !id || (strlen(id) != 7))
33 return 0; 31 return 0;
34 if (memcmp(id,"ANYDEVS",7)==0) 32 if (memcmp(id, "ANYDEVS", 7) == 0)
35 return 1; 33 return 1;
36 while (pos){ 34 while (pos) {
37 if (memcmp(pos->id,id,3)==0) 35 if (memcmp(pos->id, id, 3) == 0)
38 if (compare_func(pos->id,id)==1) 36 if (compare_func(pos->id, id) == 1)
39 return 1; 37 return 1;
40 pos = pos->next; 38 pos = pos->next;
41 } 39 }
42 return 0; 40 return 0;
43} 41}
44 42
45static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev) 43static const struct pnp_device_id *match_device(struct pnp_driver *drv,
44 struct pnp_dev *dev)
46{ 45{
47 const struct pnp_device_id *drv_id = drv->id_table; 46 const struct pnp_device_id *drv_id = drv->id_table;
48 if (!drv_id) 47 if (!drv_id)
@@ -59,7 +58,7 @@ static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct
59int pnp_device_attach(struct pnp_dev *pnp_dev) 58int pnp_device_attach(struct pnp_dev *pnp_dev)
60{ 59{
61 spin_lock(&pnp_lock); 60 spin_lock(&pnp_lock);
62 if(pnp_dev->status != PNP_READY){ 61 if (pnp_dev->status != PNP_READY) {
63 spin_unlock(&pnp_lock); 62 spin_unlock(&pnp_lock);
64 return -EBUSY; 63 return -EBUSY;
65 } 64 }
@@ -86,7 +85,8 @@ static int pnp_device_probe(struct device *dev)
86 pnp_dev = to_pnp_dev(dev); 85 pnp_dev = to_pnp_dev(dev);
87 pnp_drv = to_pnp_driver(dev->driver); 86 pnp_drv = to_pnp_driver(dev->driver);
88 87
89 pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name); 88 pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
89 dev->bus_id, pnp_drv->name);
90 90
91 error = pnp_device_attach(pnp_dev); 91 error = pnp_device_attach(pnp_dev);
92 if (error < 0) 92 if (error < 0)
@@ -99,7 +99,7 @@ static int pnp_device_probe(struct device *dev)
99 return error; 99 return error;
100 } 100 }
101 } else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE) 101 } else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE)
102 == PNP_DRIVER_RES_DISABLE) { 102 == PNP_DRIVER_RES_DISABLE) {
103 error = pnp_disable_dev(pnp_dev); 103 error = pnp_disable_dev(pnp_dev);
104 if (error < 0) 104 if (error < 0)
105 return error; 105 return error;
@@ -110,22 +110,22 @@ static int pnp_device_probe(struct device *dev)
110 if (dev_id != NULL) 110 if (dev_id != NULL)
111 error = pnp_drv->probe(pnp_dev, dev_id); 111 error = pnp_drv->probe(pnp_dev, dev_id);
112 } 112 }
113 if (error >= 0){ 113 if (error >= 0) {
114 pnp_dev->driver = pnp_drv; 114 pnp_dev->driver = pnp_drv;
115 error = 0; 115 error = 0;
116 } else 116 } else
117 goto fail; 117 goto fail;
118 return error; 118 return error;
119 119
120fail: 120 fail:
121 pnp_device_detach(pnp_dev); 121 pnp_device_detach(pnp_dev);
122 return error; 122 return error;
123} 123}
124 124
125static int pnp_device_remove(struct device *dev) 125static int pnp_device_remove(struct device *dev)
126{ 126{
127 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 127 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
128 struct pnp_driver * drv = pnp_dev->driver; 128 struct pnp_driver *drv = pnp_dev->driver;
129 129
130 if (drv) { 130 if (drv) {
131 if (drv->remove) 131 if (drv->remove)
@@ -138,8 +138,8 @@ static int pnp_device_remove(struct device *dev)
138 138
139static int pnp_bus_match(struct device *dev, struct device_driver *drv) 139static int pnp_bus_match(struct device *dev, struct device_driver *drv)
140{ 140{
141 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 141 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
142 struct pnp_driver * pnp_drv = to_pnp_driver(drv); 142 struct pnp_driver *pnp_drv = to_pnp_driver(drv);
143 if (match_device(pnp_drv, pnp_dev) == NULL) 143 if (match_device(pnp_drv, pnp_dev) == NULL)
144 return 0; 144 return 0;
145 return 1; 145 return 1;
@@ -147,8 +147,8 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
147 147
148static int pnp_bus_suspend(struct device *dev, pm_message_t state) 148static int pnp_bus_suspend(struct device *dev, pm_message_t state)
149{ 149{
150 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 150 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
151 struct pnp_driver * pnp_drv = pnp_dev->driver; 151 struct pnp_driver *pnp_drv = pnp_dev->driver;
152 int error; 152 int error;
153 153
154 if (!pnp_drv) 154 if (!pnp_drv)
@@ -162,9 +162,9 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
162 162
163 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) && 163 if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
164 pnp_can_disable(pnp_dev)) { 164 pnp_can_disable(pnp_dev)) {
165 error = pnp_stop_dev(pnp_dev); 165 error = pnp_stop_dev(pnp_dev);
166 if (error) 166 if (error)
167 return error; 167 return error;
168 } 168 }
169 169
170 if (pnp_dev->protocol && pnp_dev->protocol->suspend) 170 if (pnp_dev->protocol && pnp_dev->protocol->suspend)
@@ -174,8 +174,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
174 174
175static int pnp_bus_resume(struct device *dev) 175static int pnp_bus_resume(struct device *dev)
176{ 176{
177 struct pnp_dev * pnp_dev = to_pnp_dev(dev); 177 struct pnp_dev *pnp_dev = to_pnp_dev(dev);
178 struct pnp_driver * pnp_drv = pnp_dev->driver; 178 struct pnp_driver *pnp_drv = pnp_dev->driver;
179 int error; 179 int error;
180 180
181 if (!pnp_drv) 181 if (!pnp_drv)
@@ -197,10 +197,10 @@ static int pnp_bus_resume(struct device *dev)
197} 197}
198 198
199struct bus_type pnp_bus_type = { 199struct bus_type pnp_bus_type = {
200 .name = "pnp", 200 .name = "pnp",
201 .match = pnp_bus_match, 201 .match = pnp_bus_match,
202 .probe = pnp_device_probe, 202 .probe = pnp_device_probe,
203 .remove = pnp_device_remove, 203 .remove = pnp_device_remove,
204 .suspend = pnp_bus_suspend, 204 .suspend = pnp_bus_suspend,
205 .resume = pnp_bus_resume, 205 .resume = pnp_bus_resume,
206}; 206};