aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-12-19 20:09:39 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-01-24 23:40:40 -0500
commitaf5ca3f4ec5cc4432a42a73b050dd8898ce8fd00 (patch)
tree3e5a3081b2802547f10da72c0026b4929d0e287b
parent528a4bf1d5ffed310d26fc1d82d45c02949f71cf (diff)
Driver core: change sysdev classes to use dynamic kobject names
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>
-rw-r--r--arch/arm/kernel/time.c4
-rw-r--r--arch/arm/mach-integrator/integrator_ap.c2
-rw-r--r--arch/arm/mach-pxa/cm-x270.c2
-rw-r--r--arch/arm/mach-pxa/lpd270.c2
-rw-r--r--arch/arm/mach-pxa/lubbock.c2
-rw-r--r--arch/arm/mach-pxa/mainstone.c2
-rw-r--r--arch/arm/mach-s3c2410/s3c2410.c2
-rw-r--r--arch/arm/mach-s3c2412/s3c2412.c2
-rw-r--r--arch/arm/mach-s3c2440/mach-osiris.c2
-rw-r--r--arch/arm/mach-s3c2443/s3c2443.c2
-rw-r--r--arch/arm/mach-sa1100/irq.c2
-rw-r--r--arch/arm/oprofile/common.c2
-rw-r--r--arch/arm/plat-omap/gpio.c2
-rw-r--r--arch/arm/plat-s3c24xx/dma.c2
-rw-r--r--arch/arm/plat-s3c24xx/s3c244x.c4
-rw-r--r--arch/avr32/kernel/time.c2
-rw-r--r--arch/mips/kernel/i8259.c2
-rw-r--r--arch/powerpc/platforms/cell/spu_base.c2
-rw-r--r--arch/powerpc/platforms/powermac/pic.c2
-rw-r--r--arch/powerpc/sysdev/ipic.c2
-rw-r--r--arch/powerpc/sysdev/mpic.c2
-rw-r--r--arch/powerpc/sysdev/qe_lib/qe_ic.c2
-rw-r--r--arch/ppc/syslib/ipic.c2
-rw-r--r--arch/ppc/syslib/open_pic.c2
-rw-r--r--arch/ppc/syslib/open_pic2.c2
-rw-r--r--arch/s390/kernel/time.c2
-rw-r--r--arch/sh/drivers/dma/dma-sysfs.c2
-rw-r--r--arch/sh/kernel/time.c2
-rw-r--r--arch/x86/kernel/apic_32.c2
-rw-r--r--arch/x86/kernel/apic_64.c2
-rw-r--r--arch/x86/kernel/cpu/mcheck/mce_64.c2
-rw-r--r--arch/x86/kernel/i8237.c2
-rw-r--r--arch/x86/kernel/i8259_32.c2
-rw-r--r--arch/x86/kernel/i8259_64.c2
-rw-r--r--arch/x86/kernel/io_apic_32.c2
-rw-r--r--arch/x86/kernel/io_apic_64.c2
-rw-r--r--arch/x86/kernel/nmi_32.c2
-rw-r--r--arch/x86/kernel/nmi_64.c2
-rw-r--r--arch/x86/oprofile/nmi_int.c2
-rw-r--r--drivers/acpi/pci_link.c2
-rw-r--r--drivers/base/class.c2
-rw-r--r--drivers/base/cpu.c2
-rw-r--r--drivers/base/memory.c2
-rw-r--r--drivers/base/node.c2
-rw-r--r--drivers/base/sys.c1
-rw-r--r--drivers/edac/edac_module.c2
-rw-r--r--drivers/kvm/kvm_main.c2
-rw-r--r--drivers/macintosh/via-pmu.c2
-rw-r--r--drivers/scsi/libsas/sas_scsi_host.c2
-rw-r--r--include/linux/kobject.h13
-rw-r--r--include/linux/sysdev.h1
-rw-r--r--kernel/rtmutex-tester.c2
-rw-r--r--kernel/time/clocksource.c2
-rw-r--r--kernel/time/timekeeping.c2
-rw-r--r--lib/kobject.c14
55 files changed, 62 insertions, 73 deletions
diff --git a/arch/arm/kernel/time.c b/arch/arm/kernel/time.c
index 1533d3ecd7a0..f6f3689a86ee 100644
--- a/arch/arm/kernel/time.c
+++ b/arch/arm/kernel/time.c
@@ -195,7 +195,7 @@ static int leds_shutdown(struct sys_device *dev)
195} 195}
196 196
197static struct sysdev_class leds_sysclass = { 197static struct sysdev_class leds_sysclass = {
198 set_kset_name("leds"), 198 .name = "leds",
199 .shutdown = leds_shutdown, 199 .shutdown = leds_shutdown,
200 .suspend = leds_suspend, 200 .suspend = leds_suspend,
201 .resume = leds_resume, 201 .resume = leds_resume,
@@ -369,7 +369,7 @@ static int timer_resume(struct sys_device *dev)
369#endif 369#endif
370 370
371static struct sysdev_class timer_sysclass = { 371static struct sysdev_class timer_sysclass = {
372 set_kset_name("timer"), 372 .name = "timer",
373 .suspend = timer_suspend, 373 .suspend = timer_suspend,
374 .resume = timer_resume, 374 .resume = timer_resume,
375}; 375};
diff --git a/arch/arm/mach-integrator/integrator_ap.c b/arch/arm/mach-integrator/integrator_ap.c
index 72280754354d..df37e93c6fc9 100644
--- a/arch/arm/mach-integrator/integrator_ap.c
+++ b/arch/arm/mach-integrator/integrator_ap.c
@@ -214,7 +214,7 @@ static int irq_resume(struct sys_device *dev)
214#endif 214#endif
215 215
216static struct sysdev_class irq_class = { 216static struct sysdev_class irq_class = {
217 set_kset_name("irq"), 217 .name = "irq",
218 .suspend = irq_suspend, 218 .suspend = irq_suspend,
219 .resume = irq_resume, 219 .resume = irq_resume,
220}; 220};
diff --git a/arch/arm/mach-pxa/cm-x270.c b/arch/arm/mach-pxa/cm-x270.c
index 177664ccb2e2..a16349272f54 100644
--- a/arch/arm/mach-pxa/cm-x270.c
+++ b/arch/arm/mach-pxa/cm-x270.c
@@ -566,7 +566,7 @@ static int cmx270_resume(struct sys_device *dev)
566} 566}
567 567
568static struct sysdev_class cmx270_pm_sysclass = { 568static struct sysdev_class cmx270_pm_sysclass = {
569 set_kset_name("pm"), 569 .name = "pm",
570 .resume = cmx270_resume, 570 .resume = cmx270_resume,
571 .suspend = cmx270_suspend, 571 .suspend = cmx270_suspend,
572}; 572};
diff --git a/arch/arm/mach-pxa/lpd270.c b/arch/arm/mach-pxa/lpd270.c
index 26116440a7c9..78ebad063cba 100644
--- a/arch/arm/mach-pxa/lpd270.c
+++ b/arch/arm/mach-pxa/lpd270.c
@@ -122,7 +122,7 @@ static int lpd270_irq_resume(struct sys_device *dev)
122} 122}
123 123
124static struct sysdev_class lpd270_irq_sysclass = { 124static struct sysdev_class lpd270_irq_sysclass = {
125 set_kset_name("cpld_irq"), 125 .name = "cpld_irq",
126 .resume = lpd270_irq_resume, 126 .resume = lpd270_irq_resume,
127}; 127};
128 128
diff --git a/arch/arm/mach-pxa/lubbock.c b/arch/arm/mach-pxa/lubbock.c
index 011a1a72b61c..1d3112dc629e 100644
--- a/arch/arm/mach-pxa/lubbock.c
+++ b/arch/arm/mach-pxa/lubbock.c
@@ -126,7 +126,7 @@ static int lubbock_irq_resume(struct sys_device *dev)
126} 126}
127 127
128static struct sysdev_class lubbock_irq_sysclass = { 128static struct sysdev_class lubbock_irq_sysclass = {
129 set_kset_name("cpld_irq"), 129 .name = "cpld_irq",
130 .resume = lubbock_irq_resume, 130 .resume = lubbock_irq_resume,
131}; 131};
132 132
diff --git a/arch/arm/mach-pxa/mainstone.c b/arch/arm/mach-pxa/mainstone.c
index a4bc3483cbb3..41d8c6cea62b 100644
--- a/arch/arm/mach-pxa/mainstone.c
+++ b/arch/arm/mach-pxa/mainstone.c
@@ -120,7 +120,7 @@ static int mainstone_irq_resume(struct sys_device *dev)
120} 120}
121 121
122static struct sysdev_class mainstone_irq_sysclass = { 122static struct sysdev_class mainstone_irq_sysclass = {
123 set_kset_name("cpld_irq"), 123 .name = "cpld_irq",
124 .resume = mainstone_irq_resume, 124 .resume = mainstone_irq_resume,
125}; 125};
126 126
diff --git a/arch/arm/mach-s3c2410/s3c2410.c b/arch/arm/mach-s3c2410/s3c2410.c
index e580303cb0ab..0e7991940f81 100644
--- a/arch/arm/mach-s3c2410/s3c2410.c
+++ b/arch/arm/mach-s3c2410/s3c2410.c
@@ -100,7 +100,7 @@ void __init s3c2410_init_clocks(int xtal)
100} 100}
101 101
102struct sysdev_class s3c2410_sysclass = { 102struct sysdev_class s3c2410_sysclass = {
103 set_kset_name("s3c2410-core"), 103 .name = "s3c2410-core",
104}; 104};
105 105
106static struct sys_device s3c2410_sysdev = { 106static struct sys_device s3c2410_sysdev = {
diff --git a/arch/arm/mach-s3c2412/s3c2412.c b/arch/arm/mach-s3c2412/s3c2412.c
index 4f92a1562d77..265cd3f567a3 100644
--- a/arch/arm/mach-s3c2412/s3c2412.c
+++ b/arch/arm/mach-s3c2412/s3c2412.c
@@ -196,7 +196,7 @@ void __init s3c2412_init_clocks(int xtal)
196*/ 196*/
197 197
198struct sysdev_class s3c2412_sysclass = { 198struct sysdev_class s3c2412_sysclass = {
199 set_kset_name("s3c2412-core"), 199 .name = "s3c2412-core",
200}; 200};
201 201
202static int __init s3c2412_core_init(void) 202static int __init s3c2412_core_init(void)
diff --git a/arch/arm/mach-s3c2440/mach-osiris.c b/arch/arm/mach-s3c2440/mach-osiris.c
index c326983f4a8f..78af7664988b 100644
--- a/arch/arm/mach-s3c2440/mach-osiris.c
+++ b/arch/arm/mach-s3c2440/mach-osiris.c
@@ -312,7 +312,7 @@ static int osiris_pm_resume(struct sys_device *sd)
312#endif 312#endif
313 313
314static struct sysdev_class osiris_pm_sysclass = { 314static struct sysdev_class osiris_pm_sysclass = {
315 set_kset_name("mach-osiris"), 315 .name = "mach-osiris",
316 .suspend = osiris_pm_suspend, 316 .suspend = osiris_pm_suspend,
317 .resume = osiris_pm_resume, 317 .resume = osiris_pm_resume,
318}; 318};
diff --git a/arch/arm/mach-s3c2443/s3c2443.c b/arch/arm/mach-s3c2443/s3c2443.c
index 8d8117158d23..9ce490560af9 100644
--- a/arch/arm/mach-s3c2443/s3c2443.c
+++ b/arch/arm/mach-s3c2443/s3c2443.c
@@ -43,7 +43,7 @@ static struct map_desc s3c2443_iodesc[] __initdata = {
43}; 43};
44 44
45struct sysdev_class s3c2443_sysclass = { 45struct sysdev_class s3c2443_sysclass = {
46 set_kset_name("s3c2443-core"), 46 .name = "s3c2443-core",
47}; 47};
48 48
49static struct sys_device s3c2443_sysdev = { 49static struct sys_device s3c2443_sysdev = {
diff --git a/arch/arm/mach-sa1100/irq.c b/arch/arm/mach-sa1100/irq.c
index edf3347d9c5b..3dc17d7bf38e 100644
--- a/arch/arm/mach-sa1100/irq.c
+++ b/arch/arm/mach-sa1100/irq.c
@@ -283,7 +283,7 @@ static int sa1100irq_resume(struct sys_device *dev)
283} 283}
284 284
285static struct sysdev_class sa1100irq_sysclass = { 285static struct sysdev_class sa1100irq_sysclass = {
286 set_kset_name("sa11x0-irq"), 286 .name = "sa11x0-irq",
287 .suspend = sa1100irq_suspend, 287 .suspend = sa1100irq_suspend,
288 .resume = sa1100irq_resume, 288 .resume = sa1100irq_resume,
289}; 289};
diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c
index a9de727c9327..0a5cf3a6438b 100644
--- a/arch/arm/oprofile/common.c
+++ b/arch/arm/oprofile/common.c
@@ -96,7 +96,7 @@ static int op_arm_resume(struct sys_device *dev)
96} 96}
97 97
98static struct sysdev_class oprofile_sysclass = { 98static struct sysdev_class oprofile_sysclass = {
99 set_kset_name("oprofile"), 99 .name = "oprofile",
100 .resume = op_arm_resume, 100 .resume = op_arm_resume,
101 .suspend = op_arm_suspend, 101 .suspend = op_arm_suspend,
102}; 102};
diff --git a/arch/arm/plat-omap/gpio.c b/arch/arm/plat-omap/gpio.c
index 6097753394ad..b2a87b8ef673 100644
--- a/arch/arm/plat-omap/gpio.c
+++ b/arch/arm/plat-omap/gpio.c
@@ -1455,7 +1455,7 @@ static int omap_gpio_resume(struct sys_device *dev)
1455} 1455}
1456 1456
1457static struct sysdev_class omap_gpio_sysclass = { 1457static struct sysdev_class omap_gpio_sysclass = {
1458 set_kset_name("gpio"), 1458 .name = "gpio",
1459 .suspend = omap_gpio_suspend, 1459 .suspend = omap_gpio_suspend,
1460 .resume = omap_gpio_resume, 1460 .resume = omap_gpio_resume,
1461}; 1461};
diff --git a/arch/arm/plat-s3c24xx/dma.c b/arch/arm/plat-s3c24xx/dma.c
index 29696e46ed65..aae1b9cbaf44 100644
--- a/arch/arm/plat-s3c24xx/dma.c
+++ b/arch/arm/plat-s3c24xx/dma.c
@@ -1265,7 +1265,7 @@ static int s3c2410_dma_resume(struct sys_device *dev)
1265#endif /* CONFIG_PM */ 1265#endif /* CONFIG_PM */
1266 1266
1267struct sysdev_class dma_sysclass = { 1267struct sysdev_class dma_sysclass = {
1268 set_kset_name("s3c24xx-dma"), 1268 .name = "s3c24xx-dma",
1269 .suspend = s3c2410_dma_suspend, 1269 .suspend = s3c2410_dma_suspend,
1270 .resume = s3c2410_dma_resume, 1270 .resume = s3c2410_dma_resume,
1271}; 1271};
diff --git a/arch/arm/plat-s3c24xx/s3c244x.c b/arch/arm/plat-s3c24xx/s3c244x.c
index 3444b13afac5..f197bb3a2366 100644
--- a/arch/arm/plat-s3c24xx/s3c244x.c
+++ b/arch/arm/plat-s3c24xx/s3c244x.c
@@ -151,13 +151,13 @@ static int s3c244x_resume(struct sys_device *dev)
151/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */ 151/* Since the S3C2442 and S3C2440 share items, put both sysclasses here */
152 152
153struct sysdev_class s3c2440_sysclass = { 153struct sysdev_class s3c2440_sysclass = {
154 set_kset_name("s3c2440-core"), 154 .name = "s3c2440-core",
155 .suspend = s3c244x_suspend, 155 .suspend = s3c244x_suspend,
156 .resume = s3c244x_resume 156 .resume = s3c244x_resume
157}; 157};
158 158
159struct sysdev_class s3c2442_sysclass = { 159struct sysdev_class s3c2442_sysclass = {
160 set_kset_name("s3c2442-core"), 160 .name = "s3c2442-core",
161 .suspend = s3c244x_suspend, 161 .suspend = s3c244x_suspend,
162 .resume = s3c244x_resume 162 .resume = s3c244x_resume
163}; 163};
diff --git a/arch/avr32/kernel/time.c b/arch/avr32/kernel/time.c
index 7014a3571ec0..36a46c3ae308 100644
--- a/arch/avr32/kernel/time.c
+++ b/arch/avr32/kernel/time.c
@@ -214,7 +214,7 @@ void __init time_init(void)
214} 214}
215 215
216static struct sysdev_class timer_class = { 216static struct sysdev_class timer_class = {
217 set_kset_name("timer"), 217 .name = "timer",
218}; 218};
219 219
220static struct sys_device timer_device = { 220static struct sys_device timer_device = {
diff --git a/arch/mips/kernel/i8259.c b/arch/mips/kernel/i8259.c
index 471013577108..197d7977de35 100644
--- a/arch/mips/kernel/i8259.c
+++ b/arch/mips/kernel/i8259.c
@@ -238,7 +238,7 @@ static int i8259A_shutdown(struct sys_device *dev)
238} 238}
239 239
240static struct sysdev_class i8259_sysdev_class = { 240static struct sysdev_class i8259_sysdev_class = {
241 set_kset_name("i8259"), 241 .name = "i8259",
242 .resume = i8259A_resume, 242 .resume = i8259A_resume,
243 .shutdown = i8259A_shutdown, 243 .shutdown = i8259A_shutdown,
244}; 244};
diff --git a/arch/powerpc/platforms/cell/spu_base.c b/arch/powerpc/platforms/cell/spu_base.c
index c83c3e3f5178..a08862203643 100644
--- a/arch/powerpc/platforms/cell/spu_base.c
+++ b/arch/powerpc/platforms/cell/spu_base.c
@@ -459,7 +459,7 @@ static int spu_shutdown(struct sys_device *sysdev)
459} 459}
460 460
461static struct sysdev_class spu_sysdev_class = { 461static struct sysdev_class spu_sysdev_class = {
462 set_kset_name("spu"), 462 .name = "spu",
463 .shutdown = spu_shutdown, 463 .shutdown = spu_shutdown,
464}; 464};
465 465
diff --git a/arch/powerpc/platforms/powermac/pic.c b/arch/powerpc/platforms/powermac/pic.c
index 999f5e160897..84c0d4ef76a2 100644
--- a/arch/powerpc/platforms/powermac/pic.c
+++ b/arch/powerpc/platforms/powermac/pic.c
@@ -663,7 +663,7 @@ static int pmacpic_resume(struct sys_device *sysdev)
663#endif /* CONFIG_PM && CONFIG_PPC32 */ 663#endif /* CONFIG_PM && CONFIG_PPC32 */
664 664
665static struct sysdev_class pmacpic_sysclass = { 665static struct sysdev_class pmacpic_sysclass = {
666 set_kset_name("pmac_pic"), 666 .name = "pmac_pic",
667}; 667};
668 668
669static struct sys_device device_pmacpic = { 669static struct sys_device device_pmacpic = {
diff --git a/arch/powerpc/sysdev/ipic.c b/arch/powerpc/sysdev/ipic.c
index 05a56e55804c..e898ff4d2b97 100644
--- a/arch/powerpc/sysdev/ipic.c
+++ b/arch/powerpc/sysdev/ipic.c
@@ -725,7 +725,7 @@ unsigned int ipic_get_irq(void)
725} 725}
726 726
727static struct sysdev_class ipic_sysclass = { 727static struct sysdev_class ipic_sysclass = {
728 set_kset_name("ipic"), 728 .name = "ipic",
729}; 729};
730 730
731static struct sys_device device_ipic = { 731static struct sys_device device_ipic = {
diff --git a/arch/powerpc/sysdev/mpic.c b/arch/powerpc/sysdev/mpic.c
index e47938899a92..212a94f5d34b 100644
--- a/arch/powerpc/sysdev/mpic.c
+++ b/arch/powerpc/sysdev/mpic.c
@@ -1584,7 +1584,7 @@ static struct sysdev_class mpic_sysclass = {
1584 .resume = mpic_resume, 1584 .resume = mpic_resume,
1585 .suspend = mpic_suspend, 1585 .suspend = mpic_suspend,
1586#endif 1586#endif
1587 set_kset_name("mpic"), 1587 .name = "mpic",
1588}; 1588};
1589 1589
1590static int mpic_init_sys(void) 1590static int mpic_init_sys(void)
diff --git a/arch/powerpc/sysdev/qe_lib/qe_ic.c b/arch/powerpc/sysdev/qe_lib/qe_ic.c
index e1c0fd6dbc1a..f59444d3be75 100644
--- a/arch/powerpc/sysdev/qe_lib/qe_ic.c
+++ b/arch/powerpc/sysdev/qe_lib/qe_ic.c
@@ -483,7 +483,7 @@ int qe_ic_set_high_priority(unsigned int virq, unsigned int priority, int high)
483} 483}
484 484
485static struct sysdev_class qe_ic_sysclass = { 485static struct sysdev_class qe_ic_sysclass = {
486 set_kset_name("qe_ic"), 486 .name = "qe_ic",
487}; 487};
488 488
489static struct sys_device device_qe_ic = { 489static struct sys_device device_qe_ic = {
diff --git a/arch/ppc/syslib/ipic.c b/arch/ppc/syslib/ipic.c
index 9192777d0f78..4f163e20939e 100644
--- a/arch/ppc/syslib/ipic.c
+++ b/arch/ppc/syslib/ipic.c
@@ -614,7 +614,7 @@ int ipic_get_irq(void)
614} 614}
615 615
616static struct sysdev_class ipic_sysclass = { 616static struct sysdev_class ipic_sysclass = {
617 set_kset_name("ipic"), 617 .name = "ipic",
618}; 618};
619 619
620static struct sys_device device_ipic = { 620static struct sys_device device_ipic = {
diff --git a/arch/ppc/syslib/open_pic.c b/arch/ppc/syslib/open_pic.c
index 18ec94733293..da36522d327a 100644
--- a/arch/ppc/syslib/open_pic.c
+++ b/arch/ppc/syslib/open_pic.c
@@ -1043,7 +1043,7 @@ int openpic_resume(struct sys_device *sysdev)
1043#endif /* CONFIG_PM */ 1043#endif /* CONFIG_PM */
1044 1044
1045static struct sysdev_class openpic_sysclass = { 1045static struct sysdev_class openpic_sysclass = {
1046 set_kset_name("openpic"), 1046 .name = "openpic",
1047}; 1047};
1048 1048
1049static struct sys_device device_openpic = { 1049static struct sys_device device_openpic = {
diff --git a/arch/ppc/syslib/open_pic2.c b/arch/ppc/syslib/open_pic2.c
index d585207f9f77..449075a04798 100644
--- a/arch/ppc/syslib/open_pic2.c
+++ b/arch/ppc/syslib/open_pic2.c
@@ -666,7 +666,7 @@ int openpic2_resume(struct sys_device *sysdev)
666 666
667/* HACK ALERT */ 667/* HACK ALERT */
668static struct sysdev_class openpic2_sysclass = { 668static struct sysdev_class openpic2_sysclass = {
669 set_kset_name("openpic2"), 669 .name = "openpic2",
670}; 670};
671 671
672static struct sys_device device_openpic2 = { 672static struct sys_device device_openpic2 = {
diff --git a/arch/s390/kernel/time.c b/arch/s390/kernel/time.c
index 22b800ce2126..3bbac1293be4 100644
--- a/arch/s390/kernel/time.c
+++ b/arch/s390/kernel/time.c
@@ -1145,7 +1145,7 @@ static void etr_work_fn(struct work_struct *work)
1145 * Sysfs interface functions 1145 * Sysfs interface functions
1146 */ 1146 */
1147static struct sysdev_class etr_sysclass = { 1147static struct sysdev_class etr_sysclass = {
1148 set_kset_name("etr") 1148 .name = "etr",
1149}; 1149};
1150 1150
1151static struct sys_device etr_port0_dev = { 1151static struct sys_device etr_port0_dev = {
diff --git a/arch/sh/drivers/dma/dma-sysfs.c b/arch/sh/drivers/dma/dma-sysfs.c
index eebcd4768bbf..51b57c0d1a3c 100644
--- a/arch/sh/drivers/dma/dma-sysfs.c
+++ b/arch/sh/drivers/dma/dma-sysfs.c
@@ -19,7 +19,7 @@
19#include <asm/dma.h> 19#include <asm/dma.h>
20 20
21static struct sysdev_class dma_sysclass = { 21static struct sysdev_class dma_sysclass = {
22 set_kset_name("dma"), 22 .name = "dma",
23}; 23};
24EXPORT_SYMBOL(dma_sysclass); 24EXPORT_SYMBOL(dma_sysclass);
25 25
diff --git a/arch/sh/kernel/time.c b/arch/sh/kernel/time.c
index a3a67d151e52..2bc04bfee738 100644
--- a/arch/sh/kernel/time.c
+++ b/arch/sh/kernel/time.c
@@ -174,7 +174,7 @@ int timer_resume(struct sys_device *dev)
174#endif 174#endif
175 175
176static struct sysdev_class timer_sysclass = { 176static struct sysdev_class timer_sysclass = {
177 set_kset_name("timer"), 177 .name = "timer",
178 .suspend = timer_suspend, 178 .suspend = timer_suspend,
179 .resume = timer_resume, 179 .resume = timer_resume,
180}; 180};
diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index edb5108e5d0e..a56c782653be 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1530,7 +1530,7 @@ static int lapic_resume(struct sys_device *dev)
1530 */ 1530 */
1531 1531
1532static struct sysdev_class lapic_sysclass = { 1532static struct sysdev_class lapic_sysclass = {
1533 set_kset_name("lapic"), 1533 .name = "lapic",
1534 .resume = lapic_resume, 1534 .resume = lapic_resume,
1535 .suspend = lapic_suspend, 1535 .suspend = lapic_suspend,
1536}; 1536};
diff --git a/arch/x86/kernel/apic_64.c b/arch/x86/kernel/apic_64.c
index f28ccb588fba..fa6cdee6d303 100644
--- a/arch/x86/kernel/apic_64.c
+++ b/arch/x86/kernel/apic_64.c
@@ -639,7 +639,7 @@ static int lapic_resume(struct sys_device *dev)
639} 639}
640 640
641static struct sysdev_class lapic_sysclass = { 641static struct sysdev_class lapic_sysclass = {
642 set_kset_name("lapic"), 642 .name = "lapic",
643 .resume = lapic_resume, 643 .resume = lapic_resume,
644 .suspend = lapic_suspend, 644 .suspend = lapic_suspend,
645}; 645};
diff --git a/arch/x86/kernel/cpu/mcheck/mce_64.c b/arch/x86/kernel/cpu/mcheck/mce_64.c
index 4b21d29fb5aa..242e8668dbeb 100644
--- a/arch/x86/kernel/cpu/mcheck/mce_64.c
+++ b/arch/x86/kernel/cpu/mcheck/mce_64.c
@@ -745,7 +745,7 @@ static void mce_restart(void)
745 745
746static struct sysdev_class mce_sysclass = { 746static struct sysdev_class mce_sysclass = {
747 .resume = mce_resume, 747 .resume = mce_resume,
748 set_kset_name("machinecheck"), 748 .name = "machinecheck",
749}; 749};
750 750
751DEFINE_PER_CPU(struct sys_device, device_mce); 751DEFINE_PER_CPU(struct sys_device, device_mce);
diff --git a/arch/x86/kernel/i8237.c b/arch/x86/kernel/i8237.c
index 29313832df0c..dbd6c1d1b638 100644
--- a/arch/x86/kernel/i8237.c
+++ b/arch/x86/kernel/i8237.c
@@ -51,7 +51,7 @@ static int i8237A_suspend(struct sys_device *dev, pm_message_t state)
51} 51}
52 52
53static struct sysdev_class i8237_sysdev_class = { 53static struct sysdev_class i8237_sysdev_class = {
54 set_kset_name("i8237"), 54 .name = "i8237",
55 .suspend = i8237A_suspend, 55 .suspend = i8237A_suspend,
56 .resume = i8237A_resume, 56 .resume = i8237A_resume,
57}; 57};
diff --git a/arch/x86/kernel/i8259_32.c b/arch/x86/kernel/i8259_32.c
index f634fc715c99..5f3496d01984 100644
--- a/arch/x86/kernel/i8259_32.c
+++ b/arch/x86/kernel/i8259_32.c
@@ -258,7 +258,7 @@ static int i8259A_shutdown(struct sys_device *dev)
258} 258}
259 259
260static struct sysdev_class i8259_sysdev_class = { 260static struct sysdev_class i8259_sysdev_class = {
261 set_kset_name("i8259"), 261 .name = "i8259",
262 .suspend = i8259A_suspend, 262 .suspend = i8259A_suspend,
263 .resume = i8259A_resume, 263 .resume = i8259A_resume,
264 .shutdown = i8259A_shutdown, 264 .shutdown = i8259A_shutdown,
diff --git a/arch/x86/kernel/i8259_64.c b/arch/x86/kernel/i8259_64.c
index 3f27ea0b9816..ba6d57286f56 100644
--- a/arch/x86/kernel/i8259_64.c
+++ b/arch/x86/kernel/i8259_64.c
@@ -370,7 +370,7 @@ static int i8259A_shutdown(struct sys_device *dev)
370} 370}
371 371
372static struct sysdev_class i8259_sysdev_class = { 372static struct sysdev_class i8259_sysdev_class = {
373 set_kset_name("i8259"), 373 .name = "i8259",
374 .suspend = i8259A_suspend, 374 .suspend = i8259A_suspend,
375 .resume = i8259A_resume, 375 .resume = i8259A_resume,
376 .shutdown = i8259A_shutdown, 376 .shutdown = i8259A_shutdown,
diff --git a/arch/x86/kernel/io_apic_32.c b/arch/x86/kernel/io_apic_32.c
index a6b1490e00c4..ab77f1905469 100644
--- a/arch/x86/kernel/io_apic_32.c
+++ b/arch/x86/kernel/io_apic_32.c
@@ -2401,7 +2401,7 @@ static int ioapic_resume(struct sys_device *dev)
2401} 2401}
2402 2402
2403static struct sysdev_class ioapic_sysdev_class = { 2403static struct sysdev_class ioapic_sysdev_class = {
2404 set_kset_name("ioapic"), 2404 .name = "ioapic",
2405 .suspend = ioapic_suspend, 2405 .suspend = ioapic_suspend,
2406 .resume = ioapic_resume, 2406 .resume = ioapic_resume,
2407}; 2407};
diff --git a/arch/x86/kernel/io_apic_64.c b/arch/x86/kernel/io_apic_64.c
index cbac1670c7c3..23a3ac06a23e 100644
--- a/arch/x86/kernel/io_apic_64.c
+++ b/arch/x86/kernel/io_apic_64.c
@@ -1850,7 +1850,7 @@ static int ioapic_resume(struct sys_device *dev)
1850} 1850}
1851 1851
1852static struct sysdev_class ioapic_sysdev_class = { 1852static struct sysdev_class ioapic_sysdev_class = {
1853 set_kset_name("ioapic"), 1853 .name = "ioapic",
1854 .suspend = ioapic_suspend, 1854 .suspend = ioapic_suspend,
1855 .resume = ioapic_resume, 1855 .resume = ioapic_resume,
1856}; 1856};
diff --git a/arch/x86/kernel/nmi_32.c b/arch/x86/kernel/nmi_32.c
index 852db2906921..4f4bfd3a88b6 100644
--- a/arch/x86/kernel/nmi_32.c
+++ b/arch/x86/kernel/nmi_32.c
@@ -176,7 +176,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
176 176
177 177
178static struct sysdev_class nmi_sysclass = { 178static struct sysdev_class nmi_sysclass = {
179 set_kset_name("lapic_nmi"), 179 .name = "lapic_nmi",
180 .resume = lapic_nmi_resume, 180 .resume = lapic_nmi_resume,
181 .suspend = lapic_nmi_suspend, 181 .suspend = lapic_nmi_suspend,
182}; 182};
diff --git a/arch/x86/kernel/nmi_64.c b/arch/x86/kernel/nmi_64.c
index 4253c4e8849c..c3d1476b6a11 100644
--- a/arch/x86/kernel/nmi_64.c
+++ b/arch/x86/kernel/nmi_64.c
@@ -211,7 +211,7 @@ static int lapic_nmi_resume(struct sys_device *dev)
211} 211}
212 212
213static struct sysdev_class nmi_sysclass = { 213static struct sysdev_class nmi_sysclass = {
214 set_kset_name("lapic_nmi"), 214 .name = "lapic_nmi",
215 .resume = lapic_nmi_resume, 215 .resume = lapic_nmi_resume,
216 .suspend = lapic_nmi_suspend, 216 .suspend = lapic_nmi_suspend,
217}; 217};
diff --git a/arch/x86/oprofile/nmi_int.c b/arch/x86/oprofile/nmi_int.c
index 944bbcdd2b8d..c8ab79ef4276 100644
--- a/arch/x86/oprofile/nmi_int.c
+++ b/arch/x86/oprofile/nmi_int.c
@@ -51,7 +51,7 @@ static int nmi_resume(struct sys_device *dev)
51 51
52 52
53static struct sysdev_class oprofile_sysclass = { 53static struct sysdev_class oprofile_sysclass = {
54 set_kset_name("oprofile"), 54 .name = "oprofile",
55 .resume = nmi_resume, 55 .resume = nmi_resume,
56 .suspend = nmi_suspend, 56 .suspend = nmi_suspend,
57}; 57};
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c
index c9f526e55392..5400ea173f6f 100644
--- a/drivers/acpi/pci_link.c
+++ b/drivers/acpi/pci_link.c
@@ -911,7 +911,7 @@ __setup("acpi_irq_balance", acpi_irq_balance_set);
911 911
912/* FIXME: we will remove this interface after all drivers call pci_disable_device */ 912/* FIXME: we will remove this interface after all drivers call pci_disable_device */
913static struct sysdev_class irqrouter_sysdev_class = { 913static struct sysdev_class irqrouter_sysdev_class = {
914 set_kset_name("irqrouter"), 914 .name = "irqrouter",
915 .resume = irqrouter_resume, 915 .resume = irqrouter_resume,
916}; 916};
917 917
diff --git a/drivers/base/class.c b/drivers/base/class.c
index 61fd26cc9f0e..b962a76875d2 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -466,7 +466,6 @@ static struct kset_uevent_ops class_uevent_ops = {
466 * entirely soon. 466 * entirely soon.
467 */ 467 */
468static struct kset class_obj_subsys = { 468static struct kset class_obj_subsys = {
469 .kobj = { .k_name = "class_obj", },
470 .uevent_ops = &class_uevent_ops, 469 .uevent_ops = &class_uevent_ops,
471}; 470};
472 471
@@ -872,6 +871,7 @@ int __init classes_init(void)
872 /* ick, this is ugly, the things we go through to keep from showing up 871 /* ick, this is ugly, the things we go through to keep from showing up
873 * in sysfs... */ 872 * in sysfs... */
874 kset_init(&class_obj_subsys); 873 kset_init(&class_obj_subsys);
874 kobject_set_name(&class_obj_subsys.kobj, "class_obj");
875 if (!class_obj_subsys.kobj.parent) 875 if (!class_obj_subsys.kobj.parent)
876 class_obj_subsys.kobj.parent = &class_obj_subsys.kobj; 876 class_obj_subsys.kobj.parent = &class_obj_subsys.kobj;
877 return 0; 877 return 0;
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c
index 40545071e3c9..c5885f5ce0ac 100644
--- a/drivers/base/cpu.c
+++ b/drivers/base/cpu.c
@@ -14,7 +14,7 @@
14#include "base.h" 14#include "base.h"
15 15
16struct sysdev_class cpu_sysdev_class = { 16struct sysdev_class cpu_sysdev_class = {
17 set_kset_name("cpu"), 17 .name = "cpu",
18}; 18};
19EXPORT_SYMBOL(cpu_sysdev_class); 19EXPORT_SYMBOL(cpu_sysdev_class);
20 20
diff --git a/drivers/base/memory.c b/drivers/base/memory.c
index 7868707c7eda..7ae413fdd5fc 100644
--- a/drivers/base/memory.c
+++ b/drivers/base/memory.c
@@ -26,7 +26,7 @@
26#define MEMORY_CLASS_NAME "memory" 26#define MEMORY_CLASS_NAME "memory"
27 27
28static struct sysdev_class memory_sysdev_class = { 28static struct sysdev_class memory_sysdev_class = {
29 set_kset_name(MEMORY_CLASS_NAME), 29 .name = MEMORY_CLASS_NAME,
30}; 30};
31 31
32static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj) 32static const char *memory_uevent_name(struct kset *kset, struct kobject *kobj)
diff --git a/drivers/base/node.c b/drivers/base/node.c
index 88eeed72b5d6..e59861f18ce5 100644
--- a/drivers/base/node.c
+++ b/drivers/base/node.c
@@ -15,7 +15,7 @@
15#include <linux/device.h> 15#include <linux/device.h>
16 16
17static struct sysdev_class node_class = { 17static struct sysdev_class node_class = {
18 set_kset_name("node"), 18 .name = "node",
19}; 19};
20 20
21 21
diff --git a/drivers/base/sys.c b/drivers/base/sys.c
index e666441dd76b..2f79c55acdcc 100644
--- a/drivers/base/sys.c
+++ b/drivers/base/sys.c
@@ -136,6 +136,7 @@ int sysdev_class_register(struct sysdev_class * cls)
136 cls->kset.kobj.parent = &system_kset->kobj; 136 cls->kset.kobj.parent = &system_kset->kobj;
137 cls->kset.kobj.ktype = &ktype_sysdev_class; 137 cls->kset.kobj.ktype = &ktype_sysdev_class;
138 cls->kset.kobj.kset = system_kset; 138 cls->kset.kobj.kset = system_kset;
139 kobject_set_name(&cls->kset.kobj, cls->name);
139 return kset_register(&cls->kset); 140 return kset_register(&cls->kset);
140} 141}
141 142
diff --git a/drivers/edac/edac_module.c b/drivers/edac/edac_module.c
index e0c4a4086055..7e1374afd967 100644
--- a/drivers/edac/edac_module.c
+++ b/drivers/edac/edac_module.c
@@ -31,7 +31,7 @@ struct workqueue_struct *edac_workqueue;
31 * need to export to other files in this modules 31 * need to export to other files in this modules
32 */ 32 */
33static struct sysdev_class edac_class = { 33static struct sysdev_class edac_class = {
34 set_kset_name("edac"), 34 .name = "edac",
35}; 35};
36static int edac_class_valid; 36static int edac_class_valid;
37 37
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c
index 47c10b8f89b3..c0f372f1d761 100644
--- a/drivers/kvm/kvm_main.c
+++ b/drivers/kvm/kvm_main.c
@@ -3451,7 +3451,7 @@ static int kvm_resume(struct sys_device *dev)
3451} 3451}
3452 3452
3453static struct sysdev_class kvm_sysdev_class = { 3453static struct sysdev_class kvm_sysdev_class = {
3454 set_kset_name("kvm"), 3454 .name = "kvm",
3455 .suspend = kvm_suspend, 3455 .suspend = kvm_suspend,
3456 .resume = kvm_resume, 3456 .resume = kvm_resume,
3457}; 3457};
diff --git a/drivers/macintosh/via-pmu.c b/drivers/macintosh/via-pmu.c
index 6123c70153d3..ac420b17e16f 100644
--- a/drivers/macintosh/via-pmu.c
+++ b/drivers/macintosh/via-pmu.c
@@ -2796,7 +2796,7 @@ static int pmu_sys_resume(struct sys_device *sysdev)
2796#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */ 2796#endif /* CONFIG_PM_SLEEP && CONFIG_PPC32 */
2797 2797
2798static struct sysdev_class pmu_sysclass = { 2798static struct sysdev_class pmu_sysclass = {
2799 set_kset_name("pmu"), 2799 .name = "pmu",
2800}; 2800};
2801 2801
2802static struct sys_device device_pmu = { 2802static struct sys_device device_pmu = {
diff --git a/drivers/scsi/libsas/sas_scsi_host.c b/drivers/scsi/libsas/sas_scsi_host.c
index 7663841eb4cf..a3fdc57e2673 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -464,7 +464,7 @@ int sas_eh_bus_reset_handler(struct scsi_cmnd *cmd)
464 res = sas_phy_reset(phy, 1); 464 res = sas_phy_reset(phy, 1);
465 if (res) 465 if (res)
466 SAS_DPRINTK("Bus reset of %s failed 0x%x\n", 466 SAS_DPRINTK("Bus reset of %s failed 0x%x\n",
467 phy->dev.kobj.k_name, 467 kobject_name(&phy->dev.kobj),
468 res); 468 res);
469 if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE) 469 if (res == TMF_RESP_FUNC_SUCC || res == TMF_RESP_FUNC_COMPLETE)
470 return SUCCESS; 470 return SUCCESS;
diff --git a/include/linux/kobject.h b/include/linux/kobject.h
index 504ac0eb4412..4adbe1d83081 100644
--- a/include/linux/kobject.h
+++ b/include/linux/kobject.h
@@ -61,7 +61,7 @@ enum kobject_action {
61}; 61};
62 62
63struct kobject { 63struct kobject {
64 const char * k_name; 64 const char *name;
65 struct kref kref; 65 struct kref kref;
66 struct list_head entry; 66 struct list_head entry;
67 struct kobject * parent; 67 struct kobject * parent;
@@ -69,7 +69,6 @@ struct kobject {
69 struct kobj_type * ktype; 69 struct kobj_type * ktype;
70 struct sysfs_dirent * sd; 70 struct sysfs_dirent * sd;
71 unsigned int state_initialized:1; 71 unsigned int state_initialized:1;
72 unsigned int state_name_set:1;
73 unsigned int state_in_sysfs:1; 72 unsigned int state_in_sysfs:1;
74 unsigned int state_add_uevent_sent:1; 73 unsigned int state_add_uevent_sent:1;
75 unsigned int state_remove_uevent_sent:1; 74 unsigned int state_remove_uevent_sent:1;
@@ -80,7 +79,7 @@ extern int kobject_set_name(struct kobject *, const char *, ...)
80 79
81static inline const char * kobject_name(const struct kobject * kobj) 80static inline const char * kobject_name(const struct kobject * kobj)
82{ 81{
83 return kobj->k_name; 82 return kobj->name;
84} 83}
85 84
86extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype); 85extern void kobject_init(struct kobject *kobj, struct kobj_type *ktype);
@@ -189,14 +188,6 @@ static inline struct kobj_type *get_ktype(struct kobject *kobj)
189 188
190extern struct kobject * kset_find_obj(struct kset *, const char *); 189extern struct kobject * kset_find_obj(struct kset *, const char *);
191 190
192
193/*
194 * Use this when initializing an embedded kset with no other
195 * fields to initialize.
196 */
197#define set_kset_name(str) .kset = { .kobj = { .k_name = str } }
198
199
200/* The global /sys/kernel/ kobject for people to chain off of */ 191/* The global /sys/kernel/ kobject for people to chain off of */
201extern struct kobject *kernel_kobj; 192extern struct kobject *kernel_kobj;
202/* The global /sys/hypervisor/ kobject for people to chain off of */ 193/* The global /sys/hypervisor/ kobject for people to chain off of */
diff --git a/include/linux/sysdev.h b/include/linux/sysdev.h
index e285746588d6..f752e73bf977 100644
--- a/include/linux/sysdev.h
+++ b/include/linux/sysdev.h
@@ -29,6 +29,7 @@
29struct sys_device; 29struct sys_device;
30 30
31struct sysdev_class { 31struct sysdev_class {
32 const char *name;
32 struct list_head drivers; 33 struct list_head drivers;
33 34
34 /* Default operations for these types of devices */ 35 /* Default operations for these types of devices */
diff --git a/kernel/rtmutex-tester.c b/kernel/rtmutex-tester.c
index e3055ba69159..092e4c620af9 100644
--- a/kernel/rtmutex-tester.c
+++ b/kernel/rtmutex-tester.c
@@ -394,7 +394,7 @@ static SYSDEV_ATTR(status, 0600, sysfs_test_status, NULL);
394static SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command); 394static SYSDEV_ATTR(command, 0600, NULL, sysfs_test_command);
395 395
396static struct sysdev_class rttest_sysclass = { 396static struct sysdev_class rttest_sysclass = {
397 set_kset_name("rttest"), 397 .name = "rttest",
398}; 398};
399 399
400static int init_test_thread(int id) 400static int init_test_thread(int id)
diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c
index c8a9d13874df..8d6125ad2cf0 100644
--- a/kernel/time/clocksource.c
+++ b/kernel/time/clocksource.c
@@ -441,7 +441,7 @@ static SYSDEV_ATTR(available_clocksource, 0600,
441 sysfs_show_available_clocksources, NULL); 441 sysfs_show_available_clocksources, NULL);
442 442
443static struct sysdev_class clocksource_sysclass = { 443static struct sysdev_class clocksource_sysclass = {
444 set_kset_name("clocksource"), 444 .name = "clocksource",
445}; 445};
446 446
447static struct sys_device device_clocksource = { 447static struct sys_device device_clocksource = {
diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
index e5e466b27598..ab46ae8c062b 100644
--- a/kernel/time/timekeeping.c
+++ b/kernel/time/timekeeping.c
@@ -335,9 +335,9 @@ static int timekeeping_suspend(struct sys_device *dev, pm_message_t state)
335 335
336/* sysfs resume/suspend bits for timekeeping */ 336/* sysfs resume/suspend bits for timekeeping */
337static struct sysdev_class timekeeping_sysclass = { 337static struct sysdev_class timekeeping_sysclass = {
338 .name = "timekeeping",
338 .resume = timekeeping_resume, 339 .resume = timekeeping_resume,
339 .suspend = timekeeping_suspend, 340 .suspend = timekeeping_suspend,
340 set_kset_name("timekeeping"),
341}; 341};
342 342
343static struct sys_device device_timer = { 343static struct sys_device device_timer = {
diff --git a/lib/kobject.c b/lib/kobject.c
index a0773734545c..8dc32454661d 100644
--- a/lib/kobject.c
+++ b/lib/kobject.c
@@ -165,7 +165,7 @@ static int kobject_add_internal(struct kobject *kobj)
165 if (!kobj) 165 if (!kobj)
166 return -ENOENT; 166 return -ENOENT;
167 167
168 if (!kobj->k_name || !kobj->k_name[0]) { 168 if (!kobj->name || !kobj->name[0]) {
169 pr_debug("kobject: (%p): attempted to be registered with empty " 169 pr_debug("kobject: (%p): attempted to be registered with empty "
170 "name!\n", kobj); 170 "name!\n", kobj);
171 WARN_ON(1); 171 WARN_ON(1);
@@ -228,13 +228,11 @@ static int kobject_set_name_vargs(struct kobject *kobj, const char *fmt,
228 if (!name) 228 if (!name)
229 return -ENOMEM; 229 return -ENOMEM;
230 230
231
232 /* Free the old name, if necessary. */ 231 /* Free the old name, if necessary. */
233 kfree(kobj->k_name); 232 kfree(kobj->name);
234 233
235 /* Now, set the new name */ 234 /* Now, set the new name */
236 kobj->k_name = name; 235 kobj->name = name;
237 kobj->state_name_set = 1;
238 236
239 return 0; 237 return 0;
240} 238}
@@ -295,7 +293,6 @@ void kobject_init(struct kobject *kobj, struct kobj_type *ktype)
295 kref_init(&kobj->kref); 293 kref_init(&kobj->kref);
296 INIT_LIST_HEAD(&kobj->entry); 294 INIT_LIST_HEAD(&kobj->entry);
297 kobj->ktype = ktype; 295 kobj->ktype = ktype;
298 kobj->state_name_set = 0;
299 kobj->state_in_sysfs = 0; 296 kobj->state_in_sysfs = 0;
300 kobj->state_add_uevent_sent = 0; 297 kobj->state_add_uevent_sent = 0;
301 kobj->state_remove_uevent_sent = 0; 298 kobj->state_remove_uevent_sent = 0;
@@ -551,8 +548,7 @@ struct kobject * kobject_get(struct kobject * kobj)
551static void kobject_cleanup(struct kobject *kobj) 548static void kobject_cleanup(struct kobject *kobj)
552{ 549{
553 struct kobj_type *t = get_ktype(kobj); 550 struct kobj_type *t = get_ktype(kobj);
554 const char *name = kobj->k_name; 551 const char *name = kobj->name;
555 int name_set = kobj->state_name_set;
556 552
557 pr_debug("kobject: '%s' (%p): %s\n", 553 pr_debug("kobject: '%s' (%p): %s\n",
558 kobject_name(kobj), kobj, __FUNCTION__); 554 kobject_name(kobj), kobj, __FUNCTION__);
@@ -583,7 +579,7 @@ static void kobject_cleanup(struct kobject *kobj)
583 } 579 }
584 580
585 /* free name if we allocated it */ 581 /* free name if we allocated it */
586 if (name_set && name) { 582 if (name) {
587 pr_debug("kobject: '%s': free name\n", name); 583 pr_debug("kobject: '%s': free name\n", name);
588 kfree(name); 584 kfree(name);
589 } 585 }