Skip to contentSkip to conversation

driver core patches for 2.6.31-rc2-git

PATCH New Greg KH 4 participants 14 messages Jul 12, 2009 – Jul 15, 2009

Subsystems (7)
lore
Share & tools
lore

Greg KH

author
#0 lore raw

PATCH 1/1 driver core patches for 2.6.31-rc2-git

Here are some driver core patches for your tree.

All tiny stuff, fixing bugs, and finally removing the BUS_ID_SIZE define that no longer is in use.

All of the non-driver-core touching patches have been sent to the various subsystem maintainers and gotten acks for them with the exception of the sparc change, which for some reason did not get an ack, but was ignored. As the patch is only hard coding the BUS_ID_SIZE value, no functionalty is changed in the code at all.

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

All of these patches have been in the linux-next and mm trees for a while.

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

thanks,

greg k-h

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

 Documentation/driver-model/driver.txt |    4 ++--
 arch/sparc/kernel/vio.c               |    7 ++++++-
 drivers/base/devres.c                 |    3 +++
 drivers/base/firmware_class.c         |    6 ++++--
 drivers/power/wm97xx_battery.c        |    4 ++--
 drivers/video/omap/omapfb_main.c      |   14 +++++++-------
 fs/partitions/check.c                 |    2 +-
 include/linux/device.h                |    2 --
 sound/soc/codecs/wm8988.c             |    4 ++--
 9 files changed, 27 insertions(+), 19 deletions(-)

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

Alexander Beregalov (1):
wm97xx_batery: replace driver_data with dev_get_drvdata()

Benjamin Herrenschmidt (1):
devres: WARN() and return, don't crash on device_del() of uninitialized device

Greg Kroah-Hartman (2):
Sound: remove direct access of driver_data
omap: video: remove direct access of driver_data

Heiko Carstens (1):
partitions: fix broken uevent_suppress conversion

Jiri Slaby (1):
Firmware: firmware_class, fix lock imbalance

Kay Sievers (2):
sparc: remove driver-core BUS_ID_SIZE
Driver Core: remove BUS_ID_SIZE

vibi sreenivasan (1):
driver model: fix show/store prototypes in doc.

#1 lore raw

PATCH 1/9 devres: WARN() and return, don't crash on device_del() of uninitialized device

From: Benjamin Herrenschmidt <[email protected]>

I just debugged an obscure crash caused by a device_del() of a all NULL'd out struct device (in usb-serial) and found that a patch like this one would have saved me time (in addition to improved chances of a bug report from users hitting similar driver bugs).

---
 drivers/base/devres.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)
drivers/base/devres.c +3 -0
index e8beb8e..05dd307 100644
@@ -428,6 +428,9 @@ int devres_release_all(struct device *dev)
 {
 	unsigned long flags;
 
+	/* Looks like an uninitialized device structure */
+	if (WARN_ON(dev->devres_head.next == NULL))
+		return -ENODEV;
 	spin_lock_irqsave(&dev->devres_lock, flags);
 	return release_nodes(dev, dev->devres_head.next, &dev->devres_head,
 			     flags);
Signature · 1 line
1.6.3.2
Acked-by on v1 1/9
#2 lore raw

Re: [PATCH 1/9] devres: WARN() and return, don't crash on device_del() of uninitialized device

Quoted 7 lines · Greg Kroah-Hartman

From: Benjamin Herrenschmidt <[email protected]>

I just debugged an obscure crash caused by a device_del() of a all NULL'd out struct device (in usb-serial) and found that a patch like this one would have saved me time (in addition to improved chances of a bug report from users hitting similar driver bugs).

Quoted 6 lines
Signature · 1 line
tejun
#3 lore raw

PATCH 2/9 partitions: fix broken uevent_suppress conversion

In reply to Greg KH

From: Heiko Carstens <[email protected]>

git commit f67f129e "Driver core: implement uevent suppress in kobject" contains this chunk for fs/partitions/check.c:

/* suppress uevent if the disk supresses it */
- if (!ddev->uevent_suppress)
+ if (!dev_get_uevent_suppress(pdev))
kobject_uevent(&pdev->kobj, KOBJ_ADD);

However that should have been

- if (!ddev->uevent_suppress)
+ if (!dev_get_uevent_suppress(ddev))

---
 fs/partitions/check.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
fs/partitions/check.c +1 -1
index 1a9c787..ea4e6cb 100644
@@ -436,7 +436,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
 	rcu_assign_pointer(ptbl->part[partno], p);
 
 	/* suppress uevent if the disk supresses it */
-	if (!dev_get_uevent_suppress(pdev))
+	if (!dev_get_uevent_suppress(ddev))
 		kobject_uevent(&pdev->kobj, KOBJ_ADD);
 
 	return p;
Signature · 1 line
1.6.3.2
#4 lore raw

PATCH 3/9 sparc: remove driver-core BUS_ID_SIZE

In reply to Greg KH

From: Kay Sievers <[email protected]>

The name size limit is gone from the driver-core, the BUS_ID_SIZE value will be removed.

---
 arch/sparc/kernel/vio.c |    7 ++++++-
 1 files changed, 6 insertions(+), 1 deletions(-)
arch/sparc/kernel/vio.c +6 -1
index 753d128..c28c714 100644
@@ -224,7 +224,12 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
 	if (!strcmp(type, "domain-services-port"))
 		bus_id_name = "ds";
 
-	if (strlen(bus_id_name) >= BUS_ID_SIZE - 4) {
+	/*
+	 * 20 char is the old driver-core name size limit, which is no more.
+	 * This check can probably be removed after review and possible
+	 * adaption of the vio users name length handling.
+	 */
+	if (strlen(bus_id_name) >= 20 - 4) {
 		printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n",
 		       bus_id_name);
 		return NULL;
Signature · 1 line
1.6.3.2
maintainer Acked-by on v1 3/9
#5 lore raw

Re: [PATCH 3/9] sparc: remove driver-core BUS_ID_SIZE

From: Greg Kroah-Hartman <[email protected]>
Date: Sun, 12 Jul 2009 15:46:00 -0700

Quoted 8 lines

From: Kay Sievers <[email protected]>

The name size limit is gone from the driver-core, the BUS_ID_SIZE value will be removed.

#6 lore raw

PATCH 4/9 Driver Core: remove BUS_ID_SIZE

In reply to Greg KH

From: Kay Sievers <[email protected]>

The name size limit is gone from the driver-core, this is the removal of the last left-over.

---
 include/linux/device.h |    2 --
 1 files changed, 0 insertions(+), 2 deletions(-)
include/linux/device.h +0 -2
index ed4e39f..aebb810 100644
@@ -25,8 +25,6 @@
 #include <asm/atomic.h>
 #include <asm/device.h>
 
-#define BUS_ID_SIZE		20
-
 struct device;
 struct device_private;
 struct device_driver;
Signature · 1 line
1.6.3.2
#7 lore raw

PATCH 5/9 Firmware: firmware_class, fix lock imbalance

In reply to Greg KH

From: Jiri Slaby <[email protected]>

Add omitted unlock in firmware_data_read.

---
 drivers/base/firmware_class.c |    6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
drivers/base/firmware_class.c +4 -2
index fc46653..f285f44 100644
@@ -217,8 +217,10 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
 		ret_count = -ENODEV;
 		goto out;
 	}
-	if (offset > fw->size)
-		return 0;
+	if (offset > fw->size) {
+		ret_count = 0;
+		goto out;
+	}
 	if (count > fw->size - offset)
 		count = fw->size - offset;
 
Signature · 1 line
1.6.3.2
#8 lore raw

PATCH 6/9 driver model: fix show/store prototypes in doc.

In reply to Greg KH

From: vibi sreenivasan <[email protected]>

FIX prototypes for show & store method in struct driver_attribute

---
 Documentation/driver-model/driver.txt |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
Documentation/driver-model/driver.txt +2 -2
index 8213216..60120fb 100644
@@ -207,8 +207,8 @@ Attributes
 ~~~~~~~~~~
 struct driver_attribute {
         struct attribute        attr;
-        ssize_t (*show)(struct device_driver *, char * buf, size_t count, loff_t off);
-        ssize_t (*store)(struct device_driver *, const char * buf, size_t count, loff_t off);
+        ssize_t (*show)(struct device_driver *driver, char *buf);
+        ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
 };
 
 Device drivers can export attributes via their sysfs directories. 
Signature · 1 line
1.6.3.2
#9 lore raw

PATCH 7/9 Sound: remove direct access of driver_data

In reply to Greg KH

This is the last in-kernel direct usage of driver_data, replace it with the proper dev_get/set_drvdata() calls.

---
 sound/soc/codecs/wm8988.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8988.c +2 -2
index c05f718..8c0fdf8 100644
@@ -1037,14 +1037,14 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
 	codec->control_data = spi;
 	codec->dev = &spi->dev;
 
-	spi->dev.driver_data = wm8988;
+	dev_set_drvdata(&spi->dev, wm8988);
 
 	return wm8988_register(wm8988);
 }
 
 static int __devexit wm8988_spi_remove(struct spi_device *spi)
 {
-	struct wm8988_priv *wm8988 = spi->dev.driver_data;
+	struct wm8988_priv *wm8988 = dev_get_drvdata(&spi->dev);
 
 	wm8988_unregister(wm8988);
 
Signature · 1 line
1.6.3.2
#10 lore raw

Re: [PATCH 7/9] Sound: remove direct access of driver_data

Quoted 2 lines · Greg Kroah-Hartman

This is the last in-kernel direct usage of driver_data, replace it with the proper dev_get/set_drvdata() calls.

Any objections to me applying this to ASoC, and if so do you want it in 2.6.31?

Quoted 39 lines
---
 sound/soc/codecs/wm8988.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
sound/soc/codecs/wm8988.c +2 -2
index c05f718..8c0fdf8 100644
@@ -1037,14 +1037,14 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
 	codec->control_data = spi;
 	codec->dev = &spi->dev;
 
-	spi->dev.driver_data = wm8988;
+	dev_set_drvdata(&spi->dev, wm8988);
 
 	return wm8988_register(wm8988);
 }
 
 static int __devexit wm8988_spi_remove(struct spi_device *spi)
 {
-	struct wm8988_priv *wm8988 = spi->dev.driver_data;
+	struct wm8988_priv *wm8988 = dev_get_drvdata(&spi->dev);
 
 	wm8988_unregister(wm8988);
 
Signature · 7 lines
1.6.3.2

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/
Signature · 1 line
"You grabbed my hand and we fell into it, like a daydream - or a fever."
author
#11 lore raw

Re: [PATCH 7/9] Sound: remove direct access of driver_data

Quoted 6 lines · Mark Brown
Quoted 2 lines · Greg Kroah-Hartman

This is the last in-kernel direct usage of driver_data, replace it with the proper dev_get/set_drvdata() calls.

Any objections to me applying this to ASoC, and if so do you want it in 2.6.31?

It's in Linus's tree now, so no need for you to do it :)

thanks,

greg k-h

#12 lore raw

PATCH 8/9 omap: video: remove direct access of driver_data

In reply to Greg KH

dev_set/get_drvdata() should be used instead, as driver_data is going away.

Cc Imre Deak <[email protected]>
Cc Russell King <[email protected]>
Cc Andrew Morton <[email protected]>
Cc Tony Lindgren <[email protected]>
Cc Felipe Contreras <[email protected]>
---
 drivers/video/omap/omapfb_main.c |   14 +++++++-------
 1 files changed, 7 insertions(+), 7 deletions(-)
drivers/video/omap/omapfb_main.c +7 -7
index 4ea99bf..8862233 100644
@@ -1254,7 +1254,7 @@ static struct fb_ops omapfb_ops = {
 static ssize_t omapfb_show_caps_num(struct device *dev,
 				    struct device_attribute *attr, char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 	int plane;
 	size_t size;
 	struct omapfb_caps caps;
@@ -1274,7 +1274,7 @@ static ssize_t omapfb_show_caps_num(struct device *dev,
 static ssize_t omapfb_show_caps_text(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 	int i;
 	struct omapfb_caps caps;
 	int plane;
@@ -1321,7 +1321,7 @@ static DEVICE_ATTR(caps_text, 0444, omapfb_show_caps_text, NULL);
 static ssize_t omapfb_show_panel_name(struct device *dev,
 				      struct device_attribute *attr, char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
 }
@@ -1330,7 +1330,7 @@ static ssize_t omapfb_show_bklight_level(struct device *dev,
 					 struct device_attribute *attr,
 					 char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 	int r;
 
 	if (fbdev->panel->get_bklight_level) {
@@ -1345,7 +1345,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev,
 					  struct device_attribute *attr,
 					  const char *buf, size_t size)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 	int r;
 
 	if (fbdev->panel->set_bklight_level) {
@@ -1364,7 +1364,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev,
 static ssize_t omapfb_show_bklight_max(struct device *dev,
 				       struct device_attribute *attr, char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 	int r;
 
 	if (fbdev->panel->get_bklight_level) {
@@ -1397,7 +1397,7 @@ static struct attribute_group panel_attr_grp = {
 static ssize_t omapfb_show_ctrl_name(struct device *dev,
 				     struct device_attribute *attr, char *buf)
 {
-	struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
+	struct omapfb_device *fbdev = dev_get_drvdata(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name);
 }
Signature · 1 line
1.6.3.2
#13 lore raw

PATCH 9/9 wm97xx_batery: replace driver_data with dev_get_drvdata()

In reply to Greg KH

From: Alexander Beregalov <[email protected]>

direct access of driver_data is going away.

---
 drivers/power/wm97xx_battery.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)
drivers/power/wm97xx_battery.c +2 -2
index 8bde921..b787335 100644
@@ -33,14 +33,14 @@ static enum power_supply_property *prop;
 
 static unsigned long wm97xx_read_bat(struct power_supply *bat_ps)
 {
-	return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
+	return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
 					pdata->batt_aux) * pdata->batt_mult /
 					pdata->batt_div;
 }
 
 static unsigned long wm97xx_read_temp(struct power_supply *bat_ps)
 {
-	return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
+	return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
 					pdata->temp_aux) * pdata->temp_mult /
 					pdata->temp_div;
 }
Signature · 1 line
1.6.3.2