Skip to content

Commit

Permalink
Driver core: change sysdev classes to use dynamic kobject names
Browse files Browse the repository at this point in the history
All kobjects require a dynamically allocated name now. We no longer
need to keep track if the name is statically assigned, we can just
unconditionally free() all kobject names on cleanup.

Signed-off-by: Kay Sievers <kay.sievers@vrfy.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
kaysievers authored and gregkh committed Jan 25, 2008
1 parent 528a4bf commit af5ca3f
Show file tree
Hide file tree
Showing 55 changed files with 62 additions and 73 deletions.
4 changes: 2 additions & 2 deletions arch/arm/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static int leds_shutdown(struct sys_device *dev)
}

static struct sysdev_class leds_sysclass = {
set_kset_name("leds"),
.name = "leds",
.shutdown = leds_shutdown,
.suspend = leds_suspend,
.resume = leds_resume,
Expand Down Expand Up @@ -369,7 +369,7 @@ static int timer_resume(struct sys_device *dev)
#endif

static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
.name = "timer",
.suspend = timer_suspend,
.resume = timer_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-integrator/integrator_ap.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ static int irq_resume(struct sys_device *dev)
#endif

static struct sysdev_class irq_class = {
set_kset_name("irq"),
.name = "irq",
.suspend = irq_suspend,
.resume = irq_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/cm-x270.c
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ static int cmx270_resume(struct sys_device *dev)
}

static struct sysdev_class cmx270_pm_sysclass = {
set_kset_name("pm"),
.name = "pm",
.resume = cmx270_resume,
.suspend = cmx270_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/lpd270.c
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ static int lpd270_irq_resume(struct sys_device *dev)
}

static struct sysdev_class lpd270_irq_sysclass = {
set_kset_name("cpld_irq"),
.name = "cpld_irq",
.resume = lpd270_irq_resume,
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/lubbock.c
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ static int lubbock_irq_resume(struct sys_device *dev)
}

static struct sysdev_class lubbock_irq_sysclass = {
set_kset_name("cpld_irq"),
.name = "cpld_irq",
.resume = lubbock_irq_resume,
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-pxa/mainstone.c
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ static int mainstone_irq_resume(struct sys_device *dev)
}

static struct sysdev_class mainstone_irq_sysclass = {
set_kset_name("cpld_irq"),
.name = "cpld_irq",
.resume = mainstone_irq_resume,
};

Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2410/s3c2410.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ void __init s3c2410_init_clocks(int xtal)
}

struct sysdev_class s3c2410_sysclass = {
set_kset_name("s3c2410-core"),
.name = "s3c2410-core",
};

static struct sys_device s3c2410_sysdev = {
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2412/s3c2412.c
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,7 @@ void __init s3c2412_init_clocks(int xtal)
*/

struct sysdev_class s3c2412_sysclass = {
set_kset_name("s3c2412-core"),
.name = "s3c2412-core",
};

static int __init s3c2412_core_init(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2440/mach-osiris.c
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ static int osiris_pm_resume(struct sys_device *sd)
#endif

static struct sysdev_class osiris_pm_sysclass = {
set_kset_name("mach-osiris"),
.name = "mach-osiris",
.suspend = osiris_pm_suspend,
.resume = osiris_pm_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-s3c2443/s3c2443.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static struct map_desc s3c2443_iodesc[] __initdata = {
};

struct sysdev_class s3c2443_sysclass = {
set_kset_name("s3c2443-core"),
.name = "s3c2443-core",
};

static struct sys_device s3c2443_sysdev = {
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/mach-sa1100/irq.c
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ static int sa1100irq_resume(struct sys_device *dev)
}

static struct sysdev_class sa1100irq_sysclass = {
set_kset_name("sa11x0-irq"),
.name = "sa11x0-irq",
.suspend = sa1100irq_suspend,
.resume = sa1100irq_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/oprofile/common.c
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ static int op_arm_resume(struct sys_device *dev)
}

static struct sysdev_class oprofile_sysclass = {
set_kset_name("oprofile"),
.name = "oprofile",
.resume = op_arm_resume,
.suspend = op_arm_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-omap/gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -1455,7 +1455,7 @@ static int omap_gpio_resume(struct sys_device *dev)
}

static struct sysdev_class omap_gpio_sysclass = {
set_kset_name("gpio"),
.name = "gpio",
.suspend = omap_gpio_suspend,
.resume = omap_gpio_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/arm/plat-s3c24xx/dma.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ static int s3c2410_dma_resume(struct sys_device *dev)
#endif /* CONFIG_PM */

struct sysdev_class dma_sysclass = {
set_kset_name("s3c24xx-dma"),
.name = "s3c24xx-dma",
.suspend = s3c2410_dma_suspend,
.resume = s3c2410_dma_resume,
};
Expand Down
4 changes: 2 additions & 2 deletions arch/arm/plat-s3c24xx/s3c244x.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,13 +151,13 @@ static int s3c244x_resume(struct sys_device *dev)
/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */

struct sysdev_class s3c2440_sysclass = {
set_kset_name("s3c2440-core"),
.name = "s3c2440-core",
.suspend = s3c244x_suspend,
.resume = s3c244x_resume
};

struct sysdev_class s3c2442_sysclass = {
set_kset_name("s3c2442-core"),
.name = "s3c2442-core",
.suspend = s3c244x_suspend,
.resume = s3c244x_resume
};
Expand Down
2 changes: 1 addition & 1 deletion arch/avr32/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ void __init time_init(void)
}

static struct sysdev_class timer_class = {
set_kset_name("timer"),
.name = "timer",
};

static struct sys_device timer_device = {
Expand Down
2 changes: 1 addition & 1 deletion arch/mips/kernel/i8259.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ static int i8259A_shutdown(struct sys_device *dev)
}

static struct sysdev_class i8259_sysdev_class = {
set_kset_name("i8259"),
.name = "i8259",
.resume = i8259A_resume,
.shutdown = i8259A_shutdown,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/cell/spu_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,7 @@ static int spu_shutdown(struct sys_device *sysdev)
}

static struct sysdev_class spu_sysdev_class = {
set_kset_name("spu"),
.name = "spu",
.shutdown = spu_shutdown,
};

Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/platforms/powermac/pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -663,7 +663,7 @@ static int pmacpic_resume(struct sys_device *sysdev)
#endif /* CONFIG_PM && CONFIG_PPC32 */

static struct sysdev_class pmacpic_sysclass = {
set_kset_name("pmac_pic"),
.name = "pmac_pic",
};

static struct sys_device device_pmacpic = {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/ipic.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,7 +725,7 @@ unsigned int ipic_get_irq(void)
}

static struct sysdev_class ipic_sysclass = {
set_kset_name("ipic"),
.name = "ipic",
};

static struct sys_device device_ipic = {
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/mpic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1584,7 +1584,7 @@ static struct sysdev_class mpic_sysclass = {
.resume = mpic_resume,
.suspend = mpic_suspend,
#endif
set_kset_name("mpic"),
.name = "mpic",
};

static int mpic_init_sys(void)
Expand Down
2 changes: 1 addition & 1 deletion arch/powerpc/sysdev/qe_lib/qe_ic.c
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high)
}

static struct sysdev_class qe_ic_sysclass = {
set_kset_name("qe_ic"),
.name = "qe_ic",
};

static struct sys_device device_qe_ic = {
Expand Down
2 changes: 1 addition & 1 deletion arch/ppc/syslib/ipic.c
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ int ipic_get_irq(void)
}

static struct sysdev_class ipic_sysclass = {
set_kset_name("ipic"),
.name = "ipic",
};

static struct sys_device device_ipic = {
Expand Down
2 changes: 1 addition & 1 deletion arch/ppc/syslib/open_pic.c
Original file line number Diff line number Diff line change
Expand Up @@ -1043,7 +1043,7 @@ int openpic_resume(struct sys_device *sysdev)
#endif /* CONFIG_PM */

static struct sysdev_class openpic_sysclass = {
set_kset_name("openpic"),
.name = "openpic",
};

static struct sys_device device_openpic = {
Expand Down
2 changes: 1 addition & 1 deletion arch/ppc/syslib/open_pic2.c
Original file line number Diff line number Diff line change
Expand Up @@ -666,7 +666,7 @@ int openpic2_resume(struct sys_device *sysdev)

/* HACK ALERT */
static struct sysdev_class openpic2_sysclass = {
set_kset_name("openpic2"),
.name = "openpic2",
};

static struct sys_device device_openpic2 = {
Expand Down
2 changes: 1 addition & 1 deletion arch/s390/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -1145,7 +1145,7 @@ static void etr_work_fn(struct work_struct *work)
* Sysfs interface functions
*/
static struct sysdev_class etr_sysclass = {
set_kset_name("etr")
.name = "etr",
};

static struct sys_device etr_port0_dev = {
Expand Down
2 changes: 1 addition & 1 deletion arch/sh/drivers/dma/dma-sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#include <asm/dma.h>

static struct sysdev_class dma_sysclass = {
set_kset_name("dma"),
.name = "dma",
};
EXPORT_SYMBOL(dma_sysclass);

Expand Down
2 changes: 1 addition & 1 deletion arch/sh/kernel/time.c
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ int timer_resume(struct sys_device *dev)
#endif

static struct sysdev_class timer_sysclass = {
set_kset_name("timer"),
.name = "timer",
.suspend = timer_suspend,
.resume = timer_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -1530,7 +1530,7 @@ static int lapic_resume(struct sys_device *dev)
*/

static struct sysdev_class lapic_sysclass = {
set_kset_name("lapic"),
.name = "lapic",
.resume = lapic_resume,
.suspend = lapic_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,7 @@ static int lapic_resume(struct sys_device *dev)
}

static struct sysdev_class lapic_sysclass = {
set_kset_name("lapic"),
.name = "lapic",
.resume = lapic_resume,
.suspend = lapic_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/cpu/mcheck/mce_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -745,7 +745,7 @@ static void mce_restart(void)

static struct sysdev_class mce_sysclass = {
.resume = mce_resume,
set_kset_name("machinecheck"),
.name = "machinecheck",
};

DEFINE_PER_CPU(struct sys_device, device_mce);
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/i8237.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int i8237A_suspend(struct sys_device *dev, pm_message_t state)
}

static struct sysdev_class i8237_sysdev_class = {
set_kset_name("i8237"),
.name = "i8237",
.suspend = i8237A_suspend,
.resume = i8237A_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/i8259_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ static int i8259A_shutdown(struct sys_device *dev)
}

static struct sysdev_class i8259_sysdev_class = {
set_kset_name("i8259"),
.name = "i8259",
.suspend = i8259A_suspend,
.resume = i8259A_resume,
.shutdown = i8259A_shutdown,
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/i8259_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -370,7 +370,7 @@ static int i8259A_shutdown(struct sys_device *dev)
}

static struct sysdev_class i8259_sysdev_class = {
set_kset_name("i8259"),
.name = "i8259",
.suspend = i8259A_suspend,
.resume = i8259A_resume,
.shutdown = i8259A_shutdown,
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/io_apic_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -2401,7 +2401,7 @@ static int ioapic_resume(struct sys_device *dev)
}

static struct sysdev_class ioapic_sysdev_class = {
set_kset_name("ioapic"),
.name = "ioapic",
.suspend = ioapic_suspend,
.resume = ioapic_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/io_apic_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -1850,7 +1850,7 @@ static int ioapic_resume(struct sys_device *dev)
}

static struct sysdev_class ioapic_sysdev_class = {
set_kset_name("ioapic"),
.name = "ioapic",
.suspend = ioapic_suspend,
.resume = ioapic_resume,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/nmi_32.c
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ static int lapic_nmi_resume(struct sys_device *dev)


static struct sysdev_class nmi_sysclass = {
set_kset_name("lapic_nmi"),
.name = "lapic_nmi",
.resume = lapic_nmi_resume,
.suspend = lapic_nmi_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/kernel/nmi_64.c
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
}

static struct sysdev_class nmi_sysclass = {
set_kset_name("lapic_nmi"),
.name = "lapic_nmi",
.resume = lapic_nmi_resume,
.suspend = lapic_nmi_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion arch/x86/oprofile/nmi_int.c
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ static int nmi_resume(struct sys_device *dev)


static struct sysdev_class oprofile_sysclass = {
set_kset_name("oprofile"),
.name = "oprofile",
.resume = nmi_resume,
.suspend = nmi_suspend,
};
Expand Down
2 changes: 1 addition & 1 deletion drivers/acpi/pci_link.c
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ __setup("acpi_irq_balance", acpi_irq_balance_set);

/* FIXME: we will remove this interface after all drivers call pci_disable_device */
static struct sysdev_class irqrouter_sysdev_class = {
set_kset_name("irqrouter"),
.name = "irqrouter",
.resume = irqrouter_resume,
};

Expand Down
2 changes: 1 addition & 1 deletion drivers/base/class.c
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,6 @@ static struct kset_uevent_ops class_uevent_ops = {
* entirely soon.
*/
static struct kset class_obj_subsys = {
.kobj = { .k_name = "class_obj", },
.uevent_ops = &class_uevent_ops,
};

Expand Down Expand Up @@ -872,6 +871,7 @@ int __init classes_init(void)
/* ick, this is ugly, the things we go through to keep from showing up
* in sysfs... */
kset_init(&class_obj_subsys);
kobject_set_name(&class_obj_subsys.kobj, "class_obj");
if (!class_obj_subsys.kobj.parent)
class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
return 0;
Expand Down
Loading

0 comments on commit af5ca3f

Please sign in to comment.