LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* Re: [PATCH 8/28] Modules: only add drivers/ direcory if needed
@ 2007-02-14 20:03 Mariusz Kozlowski
  0 siblings, 0 replies; 2+ messages in thread
From: Mariusz Kozlowski @ 2007-02-14 20:03 UTC (permalink / raw)
  To: Greg KH; +Cc: linux-kernel

Hello, 

> @@ -1163,7 +1155,8 @@ static void mod_kobject_remove(struct module *mod)
>  {
>         module_remove_modinfo_attrs(mod);
>         module_param_sysfs_remove(mod);
> -       kobject_unregister(mod->mkobj.drivers_dir);
> +       if (mod->mkobj.drivers_dir)
> +               kobject_unregister(mod->mkobj.drivers_dir);
>  
>         kobject_unregister(&mod->mkobj.kobj);
>  }

This change looks superfluous on top of patch 1/28 where you'll find

 void kobject_unregister(struct kobject * kobj)
 {
+       if (!kobj)
+               return;

I went a bit further and prepared a patch removing all redundant
kobject_unregister argument checks.



Signed-off-by: Mariusz Kozlowski <m.kozlowski@tuxland.pl>

 drivers/base/class.c  |    3 +--
 fs/partitions/check.c |    9 +++------
 kernel/module.c       |    8 ++------
 3 files changed, 6 insertions(+), 14 deletions(-)

diff --git a/drivers/base/class.c b/drivers/base/class.c
index 96def1d..1417e5c 100644
--- a/drivers/base/class.c
+++ b/drivers/base/class.c
@@ -163,8 +163,7 @@ int class_register(struct class * cls)
 void class_unregister(struct class * cls)
 {
 	pr_debug("device class '%s': unregistering\n", cls->name);
-	if (cls->virtual_dir)
-		kobject_unregister(cls->virtual_dir);
+	kobject_unregister(cls->virtual_dir);
 	remove_class_attrs(cls);
 	subsystem_unregister(&cls->subsys);
 }
diff --git a/fs/partitions/check.c b/fs/partitions/check.c
index ac32a2e..22d38ff 100644
--- a/fs/partitions/check.c
+++ b/fs/partitions/check.c
@@ -358,8 +358,7 @@ void delete_partition(struct gendisk *disk, int part)
 	p->ios[0] = p->ios[1] = 0;
 	p->sectors[0] = p->sectors[1] = 0;
 	sysfs_remove_link(&p->kobj, "subsystem");
-	if (p->holder_dir)
-		kobject_unregister(p->holder_dir);
+	kobject_unregister(p->holder_dir);
 	kobject_uevent(&p->kobj, KOBJ_REMOVE);
 	kobject_del(&p->kobj);
 	kobject_put(&p->kobj);
@@ -603,10 +602,8 @@ void del_gendisk(struct gendisk *disk)
 	disk->stamp = 0;

 	kobject_uevent(&disk->kobj, KOBJ_REMOVE);
-	if (disk->holder_dir)
-		kobject_unregister(disk->holder_dir);
-	if (disk->slave_dir)
-		kobject_unregister(disk->slave_dir);
+	kobject_unregister(disk->holder_dir);
+	kobject_unregister(disk->slave_dir);
 	if (disk->driverfs_dev) {
 		char *disk_name = make_block_name(disk);
 		sysfs_remove_link(&disk->kobj, "device");
diff --git a/kernel/module.c b/kernel/module.c
index 8a94e05..53f10e8 100644
--- a/kernel/module.c
+++ b/kernel/module.c
@@ -1174,11 +1174,8 @@ static void mod_kobject_remove(struct module *mod)
 {
 	module_remove_modinfo_attrs(mod);
 	module_param_sysfs_remove(mod);
-	if (mod->mkobj.drivers_dir)
-		kobject_unregister(mod->mkobj.drivers_dir);
-	if (mod->holders_dir)
-		kobject_unregister(mod->holders_dir);
-
+	kobject_unregister(mod->mkobj.drivers_dir);
+	kobject_unregister(mod->holders_dir);
 	kobject_unregister(&mod->mkobj.kobj);
 }

--
1.4.4.4

Regards,

	Mariusz Kozłowski

^ permalink raw reply	[flat|nested] 2+ messages in thread
* [GIT PATCH] Driver core patches for 2.6.20
@ 2007-02-08  0:29 Greg KH
  2007-02-08  0:29 ` [PATCH 1/28] Kobject: make kobject apis more robust in handling NULL pointers Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Greg KH @ 2007-02-08  0:29 UTC (permalink / raw)
  To: Linus Torvalds, Andrew Morton; +Cc: linux-kernel

Here are a bunch of Driver core, sysfs, and driver model patches for
2.6.20-git

They include the conversion of the network drivers to use 'struct
device' instead of 'struct class' (the patch has been in -mm for over 6
months and was acked by David Miller) some module sysfs additions to
make userspace tools simpler, and lots of cleanups and fixes.  See the
full log below for details.

All of these have been in the -mm tree for quite a while.

Please pull from:
	master.kernel.org:/pub/scm/linux/kernel/git/gregkh/driver-2.6.git/

Patches will be sent as a follow-on to this message to lkml for people
to see.

thanks,

greg k-h

 Documentation/HOWTO                       |    1 +
 drivers/base/class.c                      |   21 ++-
 drivers/base/core.c                       |  203 +++++++++++++-------
 drivers/base/dd.c                         |   21 ++-
 drivers/base/firmware_class.c             |    2 +-
 drivers/base/platform.c                   |   11 +-
 drivers/ide/setup-pci.c                   |    7 +-
 drivers/infiniband/ulp/ipoib/ipoib_main.c |   33 ++--
 drivers/infiniband/ulp/ipoib/ipoib_vlan.c |   11 +-
 drivers/input/serio/serio.c               |    6 +-
 drivers/net/arm/at91_ether.c              |    2 +-
 drivers/net/arm/etherh.c                  |    2 +-
 drivers/net/bonding/bond_sysfs.c          |  287 +++++++++++++++++-----------
 drivers/net/iseries_veth.c                |    2 +-
 drivers/net/macb.c                        |   36 ++--
 drivers/net/smc911x.c                     |    2 +-
 drivers/net/smc91x.c                      |    2 +-
 drivers/net/wireless/hostap/hostap_main.c |    2 +-
 drivers/net/wireless/orinoco.c            |    4 +-
 drivers/net/wireless/orinoco_cs.c         |    2 +-
 drivers/net/wireless/spectrum_cs.c        |    2 +-
 drivers/pci/pci-driver.c                  |    4 +-
 drivers/pcmcia/cs.c                       |   34 ++--
 drivers/pcmcia/cs_internal.h              |    4 +-
 drivers/pcmcia/ds.c                       |   14 +-
 drivers/pcmcia/i82092.c                   |    2 +-
 drivers/pcmcia/i82365.c                   |    2 +-
 drivers/pcmcia/pcmcia_ioctl.c             |    1 -
 drivers/pcmcia/pcmcia_resource.c          |    1 -
 drivers/pcmcia/pd6729.c                   |    2 +-
 drivers/pcmcia/rsrc_nonstatic.c           |   56 +++---
 drivers/pcmcia/soc_common.c               |    6 +-
 drivers/pcmcia/socket_sysfs.c             |  104 ++++++-----
 drivers/pcmcia/tcic.c                     |    2 +-
 drivers/pcmcia/yenta_socket.c             |    2 +-
 drivers/spi/pxa2xx_spi.c                  |    2 +-
 drivers/spi/spi.c                         |   32 ++--
 drivers/spi/spi_bitbang.c                 |    6 +-
 drivers/spi/spi_butterfly.c               |    4 +-
 drivers/usb/core/driver.c                 |    4 +-
 drivers/usb/input/hid-lgff.c              |    4 +-
 fs/sysfs/bin.c                            |    6 +-
 fs/sysfs/dir.c                            |  214 ++++++++++++++++++----
 fs/sysfs/file.c                           |   82 ++++++---
 fs/sysfs/group.c                          |    2 +
 fs/sysfs/inode.c                          |   36 ++++-
 fs/sysfs/mount.c                          |   11 +-
 fs/sysfs/symlink.c                        |    1 +
 fs/sysfs/sysfs.h                          |   21 ++
 include/linux/device.h                    |   12 +-
 include/linux/ide.h                       |    4 +-
 include/linux/kobject.h                   |    4 +
 include/linux/module.h                    |    3 +-
 include/linux/netdevice.h                 |    5 +-
 include/linux/pci.h                       |    5 +-
 include/linux/serio.h                     |    5 +
 include/linux/spi/spi.h                   |   10 +-
 include/linux/sysfs.h                     |   24 ++-
 include/linux/usb.h                       |    5 +-
 include/pcmcia/ss.h                       |    2 +-
 kernel/module.c                           |   76 ++++++--
 kernel/params.c                           |   28 ++-
 lib/kobject.c                             |   73 ++++++--
 net/bridge/br_if.c                        |    2 +-
 net/bridge/br_sysfs_br.c                  |  234 +++++++++++++-----------
 net/bridge/br_sysfs_if.c                  |    2 +-
 net/core/dev.c                            |    6 +-
 net/core/net-sysfs.c                      |  175 ++++++++++--------
 net/core/skbuff.c                         |    2 +-
 69 files changed, 1286 insertions(+), 709 deletions(-)

---------------

Cornelia Huck (6):
      driver core: Remove device_is_registered() in device_move().
      driver core: Allow device_move(dev, NULL).
      driver core fixes: make_class_name() retval checks
      driver core fixes: device_register() retval check in platform.c
      driver core: Don't stop probing on ->probe errors.
      driver core: Change function call order in device_bind_driver().

Dave Jones (1):
      Driver Core: Increase the default timeout value of the firmware subsystem

Eric W. Biederman (1):
      sysfs: Shadow directory support

Frank Haverkamp (1):
      SYSFS: Fix missing include of list.h in sysfs.h

Frederik Deweerdt (1):
      sysfs: suppress lockdep warnings

Greg Kroah-Hartman (8):
      Kobject: make kobject apis more robust in handling NULL pointers
      Driver core: convert pcmcia code to use struct device
      Driver core: convert SPI code to use struct device
      Network: convert network devices to use struct device instead of class_device
      Modules: only add drivers/ direcory if needed
      PCI: add the sysfs driver name to all modules
      SERIO: add the sysfs driver name to all modules
      USB: add the sysfs driver name to all modules

Kay Sievers (5):
      MODULES: add the module name for built in kernel drivers
      /sys/modules/*/holders
      Driver core: add uevent vars for devices of a class
      Driver core: add device_type to struct device
      Driver core: allow to delay the uevent at device creation time

Mariusz Kozlowski (2):
      sysfs: kobject_put cleanup
      kobject: kobject_put cleanup

Oliver Neukum (2):
      Driver core: fix race in sysfs between sysfs_remove_file() and read()/write()
      sysfs: error handling in sysfs, fill_read_buffer()

Robert P. J. Day (1):
      HOWTO: Add a reference to Harbison and Steele


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2007-02-14 20:02 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-02-14 20:03 [PATCH 8/28] Modules: only add drivers/ direcory if needed Mariusz Kozlowski
  -- strict thread matches above, loose matches on Subject: below --
2007-02-08  0:29 [GIT PATCH] Driver core patches for 2.6.20 Greg KH
2007-02-08  0:29 ` [PATCH 1/28] Kobject: make kobject apis more robust in handling NULL pointers Greg KH
2007-02-08  0:29   ` [PATCH 2/28] Driver core: convert pcmcia code to use struct device Greg KH
2007-02-08  0:29     ` [PATCH 3/28] Driver core: convert SPI " Greg KH
2007-02-08  0:29       ` [PATCH 4/28] Network: convert network devices to use struct device instead of class_device Greg KH
2007-02-08  0:29         ` [PATCH 5/28] driver core: Remove device_is_registered() in device_move() Greg KH
2007-02-08  0:29           ` [PATCH 6/28] driver core: Allow device_move(dev, NULL) Greg KH
2007-02-08  0:29             ` [PATCH 7/28] MODULES: add the module name for built in kernel drivers Greg KH
2007-02-08  0:29               ` [PATCH 8/28] Modules: only add drivers/ direcory if needed Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).