aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char
diff options
context:
space:
mode:
authorAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
committerAndrea Bastoni <bastoni@cs.unc.edu>2010-05-30 19:16:45 -0400
commitada47b5fe13d89735805b566185f4885f5a3f750 (patch)
tree644b88f8a71896307d71438e9b3af49126ffb22b /drivers/sbus/char
parent43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff)
parent3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff)
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/sbus/char')
-rw-r--r--drivers/sbus/char/bbc_envctrl.c65
-rw-r--r--drivers/sbus/char/display7seg.c1
-rw-r--r--drivers/sbus/char/envctrl.c5
-rw-r--r--drivers/sbus/char/flash.c1
-rw-r--r--drivers/sbus/char/jsflash.c1
-rw-r--r--drivers/sbus/char/openprom.c10
6 files changed, 48 insertions, 35 deletions
diff --git a/drivers/sbus/char/bbc_envctrl.c b/drivers/sbus/char/bbc_envctrl.c
index 7c815d3327f7..b4951eb0358e 100644
--- a/drivers/sbus/char/bbc_envctrl.c
+++ b/drivers/sbus/char/bbc_envctrl.c
@@ -8,6 +8,7 @@
8#include <linux/kmod.h> 8#include <linux/kmod.h>
9#include <linux/reboot.h> 9#include <linux/reboot.h>
10#include <linux/of.h> 10#include <linux/of.h>
11#include <linux/slab.h>
11#include <linux/of_device.h> 12#include <linux/of_device.h>
12#include <asm/oplib.h> 13#include <asm/oplib.h>
13 14
@@ -522,6 +523,40 @@ static void attach_one_fan(struct bbc_i2c_bus *bp, struct of_device *op,
522 set_fan_speeds(fp); 523 set_fan_speeds(fp);
523} 524}
524 525
526static void destroy_one_temp(struct bbc_cpu_temperature *tp)
527{
528 bbc_i2c_detach(tp->client);
529 kfree(tp);
530}
531
532static void destroy_all_temps(struct bbc_i2c_bus *bp)
533{
534 struct bbc_cpu_temperature *tp, *tpos;
535
536 list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) {
537 list_del(&tp->bp_list);
538 list_del(&tp->glob_list);
539 destroy_one_temp(tp);
540 }
541}
542
543static void destroy_one_fan(struct bbc_fan_control *fp)
544{
545 bbc_i2c_detach(fp->client);
546 kfree(fp);
547}
548
549static void destroy_all_fans(struct bbc_i2c_bus *bp)
550{
551 struct bbc_fan_control *fp, *fpos;
552
553 list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
554 list_del(&fp->bp_list);
555 list_del(&fp->glob_list);
556 destroy_one_fan(fp);
557 }
558}
559
525int bbc_envctrl_init(struct bbc_i2c_bus *bp) 560int bbc_envctrl_init(struct bbc_i2c_bus *bp)
526{ 561{
527 struct of_device *op; 562 struct of_device *op;
@@ -541,6 +576,8 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
541 int err = PTR_ERR(kenvctrld_task); 576 int err = PTR_ERR(kenvctrld_task);
542 577
543 kenvctrld_task = NULL; 578 kenvctrld_task = NULL;
579 destroy_all_temps(bp);
580 destroy_all_fans(bp);
544 return err; 581 return err;
545 } 582 }
546 } 583 }
@@ -548,35 +585,11 @@ int bbc_envctrl_init(struct bbc_i2c_bus *bp)
548 return 0; 585 return 0;
549} 586}
550 587
551static void destroy_one_temp(struct bbc_cpu_temperature *tp)
552{
553 bbc_i2c_detach(tp->client);
554 kfree(tp);
555}
556
557static void destroy_one_fan(struct bbc_fan_control *fp)
558{
559 bbc_i2c_detach(fp->client);
560 kfree(fp);
561}
562
563void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp) 588void bbc_envctrl_cleanup(struct bbc_i2c_bus *bp)
564{ 589{
565 struct bbc_cpu_temperature *tp, *tpos;
566 struct bbc_fan_control *fp, *fpos;
567
568 if (kenvctrld_task) 590 if (kenvctrld_task)
569 kthread_stop(kenvctrld_task); 591 kthread_stop(kenvctrld_task);
570 592
571 list_for_each_entry_safe(tp, tpos, &bp->temps, bp_list) { 593 destroy_all_temps(bp);
572 list_del(&tp->bp_list); 594 destroy_all_fans(bp);
573 list_del(&tp->glob_list);
574 destroy_one_temp(tp);
575 }
576
577 list_for_each_entry_safe(fp, fpos, &bp->fans, bp_list) {
578 list_del(&fp->bp_list);
579 list_del(&fp->glob_list);
580 destroy_one_fan(fp);
581 }
582} 595}
diff --git a/drivers/sbus/char/display7seg.c b/drivers/sbus/char/display7seg.c
index 4431578d8c45..3e59189f4137 100644
--- a/drivers/sbus/char/display7seg.c
+++ b/drivers/sbus/char/display7seg.c
@@ -12,6 +12,7 @@
12#include <linux/init.h> 12#include <linux/init.h>
13#include <linux/miscdevice.h> 13#include <linux/miscdevice.h>
14#include <linux/ioport.h> /* request_region */ 14#include <linux/ioport.h> /* request_region */
15#include <linux/slab.h>
15#include <linux/smp_lock.h> 16#include <linux/smp_lock.h>
16#include <linux/of.h> 17#include <linux/of.h>
17#include <linux/of_device.h> 18#include <linux/of_device.h>
diff --git a/drivers/sbus/char/envctrl.c b/drivers/sbus/char/envctrl.c
index 58e583b61e60..c6e2eff19409 100644
--- a/drivers/sbus/char/envctrl.c
+++ b/drivers/sbus/char/envctrl.c
@@ -26,6 +26,7 @@
26#include <linux/miscdevice.h> 26#include <linux/miscdevice.h>
27#include <linux/kmod.h> 27#include <linux/kmod.h>
28#include <linux/reboot.h> 28#include <linux/reboot.h>
29#include <linux/slab.h>
29#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
30#include <linux/of.h> 31#include <linux/of.h>
31#include <linux/of_device.h> 32#include <linux/of_device.h>
@@ -92,11 +93,11 @@
92#define ENVCTRL_CPUTEMP_MON 1 /* cpu temperature monitor */ 93#define ENVCTRL_CPUTEMP_MON 1 /* cpu temperature monitor */
93#define ENVCTRL_CPUVOLTAGE_MON 2 /* voltage monitor */ 94#define ENVCTRL_CPUVOLTAGE_MON 2 /* voltage monitor */
94#define ENVCTRL_FANSTAT_MON 3 /* fan status monitor */ 95#define ENVCTRL_FANSTAT_MON 3 /* fan status monitor */
95#define ENVCTRL_ETHERTEMP_MON 4 /* ethernet temperarture */ 96#define ENVCTRL_ETHERTEMP_MON 4 /* ethernet temperature */
96 /* monitor */ 97 /* monitor */
97#define ENVCTRL_VOLTAGESTAT_MON 5 /* voltage status monitor */ 98#define ENVCTRL_VOLTAGESTAT_MON 5 /* voltage status monitor */
98#define ENVCTRL_MTHRBDTEMP_MON 6 /* motherboard temperature */ 99#define ENVCTRL_MTHRBDTEMP_MON 6 /* motherboard temperature */
99#define ENVCTRL_SCSITEMP_MON 7 /* scsi temperarture */ 100#define ENVCTRL_SCSITEMP_MON 7 /* scsi temperature */
100#define ENVCTRL_GLOBALADDR_MON 8 /* global address */ 101#define ENVCTRL_GLOBALADDR_MON 8 /* global address */
101 102
102/* Child device type. 103/* Child device type.
diff --git a/drivers/sbus/char/flash.c b/drivers/sbus/char/flash.c
index 41083472ff4f..19f255b97c86 100644
--- a/drivers/sbus/char/flash.c
+++ b/drivers/sbus/char/flash.c
@@ -7,7 +7,6 @@
7#include <linux/types.h> 7#include <linux/types.h>
8#include <linux/errno.h> 8#include <linux/errno.h>
9#include <linux/miscdevice.h> 9#include <linux/miscdevice.h>
10#include <linux/slab.h>
11#include <linux/fcntl.h> 10#include <linux/fcntl.h>
12#include <linux/poll.h> 11#include <linux/poll.h>
13#include <linux/init.h> 12#include <linux/init.h>
diff --git a/drivers/sbus/char/jsflash.c b/drivers/sbus/char/jsflash.c
index 869a30b49edc..4942050dc5b6 100644
--- a/drivers/sbus/char/jsflash.c
+++ b/drivers/sbus/char/jsflash.c
@@ -31,7 +31,6 @@
31#include <linux/types.h> 31#include <linux/types.h>
32#include <linux/errno.h> 32#include <linux/errno.h>
33#include <linux/miscdevice.h> 33#include <linux/miscdevice.h>
34#include <linux/slab.h>
35#include <linux/fcntl.h> 34#include <linux/fcntl.h>
36#include <linux/poll.h> 35#include <linux/poll.h>
37#include <linux/init.h> 36#include <linux/init.h>
diff --git a/drivers/sbus/char/openprom.c b/drivers/sbus/char/openprom.c
index 75ac19b1192f..fc2f676e984d 100644
--- a/drivers/sbus/char/openprom.c
+++ b/drivers/sbus/char/openprom.c
@@ -233,7 +233,7 @@ static int opromnext(void __user *argp, unsigned int cmd, struct device_node *dp
233 233
234 ph = 0; 234 ph = 0;
235 if (dp) 235 if (dp)
236 ph = dp->node; 236 ph = dp->phandle;
237 237
238 data->current_node = dp; 238 data->current_node = dp;
239 *((int *) op->oprom_array) = ph; 239 *((int *) op->oprom_array) = ph;
@@ -256,7 +256,7 @@ static int oprompci2node(void __user *argp, struct device_node *dp, struct openp
256 256
257 dp = pci_device_to_OF_node(pdev); 257 dp = pci_device_to_OF_node(pdev);
258 data->current_node = dp; 258 data->current_node = dp;
259 *((int *)op->oprom_array) = dp->node; 259 *((int *)op->oprom_array) = dp->phandle;
260 op->oprom_size = sizeof(int); 260 op->oprom_size = sizeof(int);
261 err = copyout(argp, op, bufsize + sizeof(int)); 261 err = copyout(argp, op, bufsize + sizeof(int));
262 262
@@ -273,7 +273,7 @@ static int oprompath2node(void __user *argp, struct device_node *dp, struct open
273 273
274 dp = of_find_node_by_path(op->oprom_array); 274 dp = of_find_node_by_path(op->oprom_array);
275 if (dp) 275 if (dp)
276 ph = dp->node; 276 ph = dp->phandle;
277 data->current_node = dp; 277 data->current_node = dp;
278 *((int *)op->oprom_array) = ph; 278 *((int *)op->oprom_array) = ph;
279 op->oprom_size = sizeof(int); 279 op->oprom_size = sizeof(int);
@@ -540,7 +540,7 @@ static int opiocgetnext(unsigned int cmd, void __user *argp)
540 } 540 }
541 } 541 }
542 if (dp) 542 if (dp)
543 nd = dp->node; 543 nd = dp->phandle;
544 if (copy_to_user(argp, &nd, sizeof(phandle))) 544 if (copy_to_user(argp, &nd, sizeof(phandle)))
545 return -EFAULT; 545 return -EFAULT;
546 546
@@ -570,7 +570,7 @@ static int openprom_bsd_ioctl(struct inode * inode, struct file * file,
570 case OPIOCGETOPTNODE: 570 case OPIOCGETOPTNODE:
571 BUILD_BUG_ON(sizeof(phandle) != sizeof(int)); 571 BUILD_BUG_ON(sizeof(phandle) != sizeof(int));
572 572
573 if (copy_to_user(argp, &options_node->node, sizeof(phandle))) 573 if (copy_to_user(argp, &options_node->phandle, sizeof(phandle)))
574 return -EFAULT; 574 return -EFAULT;
575 575
576 return 0; 576 return 0;