Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

sh: intc - convert sysdev_class to a regular subsystem

After all sysdev classes are ported to regular driver core entities, the
sysdev implementation will be entirely removed from the kernel.

Cc: Paul Mundt <lethal@linux-sh.org>
Cc: Magnus Damm <magnus.damm@gmail.com>
Cc: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

authored by

Kay Sievers and committed by
Greg Kroah-Hartman
f4e73bfc 86ba41d0

+26 -25
+15 -14
drivers/sh/intc/core.c
··· 25 25 #include <linux/stat.h> 26 26 #include <linux/interrupt.h> 27 27 #include <linux/sh_intc.h> 28 - #include <linux/sysdev.h> 28 + #include <linux/device.h> 29 29 #include <linux/syscore_ops.h> 30 30 #include <linux/list.h> 31 31 #include <linux/spinlock.h> ··· 434 434 .resume = intc_resume, 435 435 }; 436 436 437 - struct sysdev_class intc_sysdev_class = { 437 + struct bus_type intc_subsys = { 438 438 .name = "intc", 439 + .dev_name = "intc", 439 440 }; 440 441 441 442 static ssize_t 442 - show_intc_name(struct sys_device *dev, struct sysdev_attribute *attr, char *buf) 443 + show_intc_name(struct device *dev, struct device_attribute *attr, char *buf) 443 444 { 444 445 struct intc_desc_int *d; 445 446 446 - d = container_of(dev, struct intc_desc_int, sysdev); 447 + d = container_of(dev, struct intc_desc_int, dev); 447 448 448 449 return sprintf(buf, "%s\n", d->chip.name); 449 450 } 450 451 451 - static SYSDEV_ATTR(name, S_IRUGO, show_intc_name, NULL); 452 + static DEVICE_ATTR(name, S_IRUGO, show_intc_name, NULL); 452 453 453 - static int __init register_intc_sysdevs(void) 454 + static int __init register_intc_devs(void) 454 455 { 455 456 struct intc_desc_int *d; 456 457 int error; 457 458 458 459 register_syscore_ops(&intc_syscore_ops); 459 460 460 - error = sysdev_class_register(&intc_sysdev_class); 461 + error = subsys_system_register(&intc_subsys, NULL); 461 462 if (!error) { 462 463 list_for_each_entry(d, &intc_list, list) { 463 - d->sysdev.id = d->index; 464 - d->sysdev.cls = &intc_sysdev_class; 465 - error = sysdev_register(&d->sysdev); 464 + d->dev.id = d->index; 465 + d->dev.bus = &intc_subsys; 466 + error = device_register(&d->dev); 466 467 if (error == 0) 467 - error = sysdev_create_file(&d->sysdev, 468 - &attr_name); 468 + error = device_create_file(&d->dev, 469 + &dev_attr_name); 469 470 if (error) 470 471 break; 471 472 } 472 473 } 473 474 474 475 if (error) 475 - pr_err("sysdev registration error\n"); 476 + pr_err("device registration error\n"); 476 477 477 478 return error; 478 479 } 479 - device_initcall(register_intc_sysdevs); 480 + device_initcall(register_intc_devs);
+3 -3
drivers/sh/intc/internals.h
··· 4 4 #include <linux/kernel.h> 5 5 #include <linux/types.h> 6 6 #include <linux/radix-tree.h> 7 - #include <linux/sysdev.h> 7 + #include <linux/device.h> 8 8 9 9 #define _INTC_MK(fn, mode, addr_e, addr_d, width, shift) \ 10 10 ((shift) | ((width) << 5) | ((fn) << 9) | ((mode) << 13) | \ ··· 51 51 52 52 struct intc_desc_int { 53 53 struct list_head list; 54 - struct sys_device sysdev; 54 + struct device dev; 55 55 struct radix_tree_root tree; 56 56 raw_spinlock_t lock; 57 57 unsigned int index; ··· 157 157 extern struct list_head intc_list; 158 158 extern raw_spinlock_t intc_big_lock; 159 159 extern unsigned int nr_intc_controllers; 160 - extern struct sysdev_class intc_sysdev_class; 160 + extern struct bus_type intc_subsys; 161 161 162 162 unsigned int intc_get_dfl_prio_level(void); 163 163 unsigned int intc_get_prio_level(unsigned int irq);
+8 -8
drivers/sh/intc/userimask.c
··· 10 10 #define pr_fmt(fmt) "intc: " fmt 11 11 12 12 #include <linux/errno.h> 13 - #include <linux/sysdev.h> 13 + #include <linux/device.h> 14 14 #include <linux/init.h> 15 15 #include <linux/io.h> 16 16 #include <linux/stat.h> ··· 20 20 static void __iomem *uimask; 21 21 22 22 static ssize_t 23 - show_intc_userimask(struct sysdev_class *cls, 24 - struct sysdev_class_attribute *attr, char *buf) 23 + show_intc_userimask(struct device *dev, 24 + struct device_attribute *attr, char *buf) 25 25 { 26 26 return sprintf(buf, "%d\n", (__raw_readl(uimask) >> 4) & 0xf); 27 27 } 28 28 29 29 static ssize_t 30 - store_intc_userimask(struct sysdev_class *cls, 31 - struct sysdev_class_attribute *attr, 30 + store_intc_userimask(struct device *dev, 31 + struct device_attribute *attr, 32 32 const char *buf, size_t count) 33 33 { 34 34 unsigned long level; ··· 55 55 return count; 56 56 } 57 57 58 - static SYSDEV_CLASS_ATTR(userimask, S_IRUSR | S_IWUSR, 59 - show_intc_userimask, store_intc_userimask); 58 + static DEVICE_ATTR(userimask, S_IRUSR | S_IWUSR, 59 + show_intc_userimask, store_intc_userimask); 60 60 61 61 62 62 static int __init userimask_sysdev_init(void) ··· 64 64 if (unlikely(!uimask)) 65 65 return -ENXIO; 66 66 67 - return sysdev_class_create_file(&intc_sysdev_class, &attr_userimask); 67 + return device_create_file(intc_subsys.dev_root, &dev_attr_userimask); 68 68 } 69 69 late_initcall(userimask_sysdev_init); 70 70