Skip to content

Commit

Permalink
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-cor…
Browse files Browse the repository at this point in the history
…e-2.6

* git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-2.6:
  wm97xx_batery: replace driver_data with dev_get_drvdata()
  omap: video: remove direct access of driver_data
  Sound: remove direct access of driver_data
  driver model: fix show/store prototypes in doc.
  Firmware: firmware_class, fix lock imbalance
  Driver Core: remove BUS_ID_SIZE
  sparc: remove driver-core BUS_ID_SIZE
  partitions: fix broken uevent_suppress conversion
  devres: WARN() and return, don't crash on device_del() of uninitialized device
  • Loading branch information
torvalds committed Jul 13, 2009
2 parents 51feb98 + 38c7dc3 commit a4dc323
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 19 deletions.
4 changes: 2 additions & 2 deletions Documentation/driver-model/driver.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
7 changes: 6 additions & 1 deletion arch/sparc/kernel/vio.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
3 changes: 3 additions & 0 deletions drivers/base/devres.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 4 additions & 2 deletions drivers/base/firmware_class.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down
4 changes: 2 additions & 2 deletions drivers/power/wm97xx_battery.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 7 additions & 7 deletions drivers/video/omap/omapfb_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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);
}
Expand All @@ -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) {
Expand All @@ -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) {
Expand All @@ -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) {
Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion fs/partitions/check.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 0 additions & 2 deletions include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 2 additions & 2 deletions sound/soc/codecs/wm8988.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down

0 comments on commit a4dc323

Please sign in to comment.