Skip to content

Commit a4dc323

Browse files
committed
Merge git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core-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
2 parents 51feb98 + 38c7dc3 commit a4dc323

9 files changed

Lines changed: 27 additions & 19 deletions

File tree

‎Documentation/driver-model/driver.txt‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,8 +207,8 @@ Attributes
207207
~~~~~~~~~~
208208
struct driver_attribute {
209209
struct attribute attr;
210-
ssize_t (*show)(struct device_driver *, char * buf, size_t count, loff_t off);
211-
ssize_t (*store)(struct device_driver *, const char * buf, size_t count, loff_t off);
210+
ssize_t (*show)(struct device_driver *driver, char *buf);
211+
ssize_t (*store)(struct device_driver *, const char * buf, size_t count);
212212
};
213213

214214
Device drivers can export attributes via their sysfs directories.

‎arch/sparc/kernel/vio.c‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,12 @@ static struct vio_dev *vio_create_one(struct mdesc_handle *hp, u64 mp,
224224
if (!strcmp(type, "domain-services-port"))
225225
bus_id_name = "ds";
226226

227-
if (strlen(bus_id_name) >= BUS_ID_SIZE - 4) {
227+
/*
228+
* 20 char is the old driver-core name size limit, which is no more.
229+
* This check can probably be removed after review and possible
230+
* adaption of the vio users name length handling.
231+
*/
232+
if (strlen(bus_id_name) >= 20 - 4) {
228233
printk(KERN_ERR "VIO: bus_id_name [%s] is too long.\n",
229234
bus_id_name);
230235
return NULL;

‎drivers/base/devres.c‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,9 @@ int devres_release_all(struct device *dev)
428428
{
429429
unsigned long flags;
430430

431+
/* Looks like an uninitialized device structure */
432+
if (WARN_ON(dev->devres_head.next == NULL))
433+
return -ENODEV;
431434
spin_lock_irqsave(&dev->devres_lock, flags);
432435
return release_nodes(dev, dev->devres_head.next, &dev->devres_head,
433436
flags);

‎drivers/base/firmware_class.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -217,8 +217,10 @@ firmware_data_read(struct kobject *kobj, struct bin_attribute *bin_attr,
217217
ret_count = -ENODEV;
218218
goto out;
219219
}
220-
if (offset > fw->size)
221-
return 0;
220+
if (offset > fw->size) {
221+
ret_count = 0;
222+
goto out;
223+
}
222224
if (count > fw->size - offset)
223225
count = fw->size - offset;
224226

‎drivers/power/wm97xx_battery.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,14 @@ static enum power_supply_property *prop;
3333

3434
static unsigned long wm97xx_read_bat(struct power_supply *bat_ps)
3535
{
36-
return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
36+
return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
3737
pdata->batt_aux) * pdata->batt_mult /
3838
pdata->batt_div;
3939
}
4040

4141
static unsigned long wm97xx_read_temp(struct power_supply *bat_ps)
4242
{
43-
return wm97xx_read_aux_adc(bat_ps->dev->parent->driver_data,
43+
return wm97xx_read_aux_adc(dev_get_drvdata(bat_ps->dev->parent),
4444
pdata->temp_aux) * pdata->temp_mult /
4545
pdata->temp_div;
4646
}

‎drivers/video/omap/omapfb_main.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1254,7 +1254,7 @@ static struct fb_ops omapfb_ops = {
12541254
static ssize_t omapfb_show_caps_num(struct device *dev,
12551255
struct device_attribute *attr, char *buf)
12561256
{
1257-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1257+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
12581258
int plane;
12591259
size_t size;
12601260
struct omapfb_caps caps;
@@ -1274,7 +1274,7 @@ static ssize_t omapfb_show_caps_num(struct device *dev,
12741274
static ssize_t omapfb_show_caps_text(struct device *dev,
12751275
struct device_attribute *attr, char *buf)
12761276
{
1277-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1277+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
12781278
int i;
12791279
struct omapfb_caps caps;
12801280
int plane;
@@ -1321,7 +1321,7 @@ static DEVICE_ATTR(caps_text, 0444, omapfb_show_caps_text, NULL);
13211321
static ssize_t omapfb_show_panel_name(struct device *dev,
13221322
struct device_attribute *attr, char *buf)
13231323
{
1324-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1324+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
13251325

13261326
return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->panel->name);
13271327
}
@@ -1330,7 +1330,7 @@ static ssize_t omapfb_show_bklight_level(struct device *dev,
13301330
struct device_attribute *attr,
13311331
char *buf)
13321332
{
1333-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1333+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
13341334
int r;
13351335

13361336
if (fbdev->panel->get_bklight_level) {
@@ -1345,7 +1345,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev,
13451345
struct device_attribute *attr,
13461346
const char *buf, size_t size)
13471347
{
1348-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1348+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
13491349
int r;
13501350

13511351
if (fbdev->panel->set_bklight_level) {
@@ -1364,7 +1364,7 @@ static ssize_t omapfb_store_bklight_level(struct device *dev,
13641364
static ssize_t omapfb_show_bklight_max(struct device *dev,
13651365
struct device_attribute *attr, char *buf)
13661366
{
1367-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1367+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
13681368
int r;
13691369

13701370
if (fbdev->panel->get_bklight_level) {
@@ -1397,7 +1397,7 @@ static struct attribute_group panel_attr_grp = {
13971397
static ssize_t omapfb_show_ctrl_name(struct device *dev,
13981398
struct device_attribute *attr, char *buf)
13991399
{
1400-
struct omapfb_device *fbdev = (struct omapfb_device *)dev->driver_data;
1400+
struct omapfb_device *fbdev = dev_get_drvdata(dev);
14011401

14021402
return snprintf(buf, PAGE_SIZE, "%s\n", fbdev->ctrl->name);
14031403
}

‎fs/partitions/check.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -436,7 +436,7 @@ struct hd_struct *add_partition(struct gendisk *disk, int partno,
436436
rcu_assign_pointer(ptbl->part[partno], p);
437437

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

442442
return p;

‎include/linux/device.h‎

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
#include <asm/atomic.h>
2626
#include <asm/device.h>
2727

28-
#define BUS_ID_SIZE 20
29-
3028
struct device;
3129
struct device_private;
3230
struct device_driver;

‎sound/soc/codecs/wm8988.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1037,14 +1037,14 @@ static int __devinit wm8988_spi_probe(struct spi_device *spi)
10371037
codec->control_data = spi;
10381038
codec->dev = &spi->dev;
10391039

1040-
spi->dev.driver_data = wm8988;
1040+
dev_set_drvdata(&spi->dev, wm8988);
10411041

10421042
return wm8988_register(wm8988);
10431043
}
10441044

10451045
static int __devexit wm8988_spi_remove(struct spi_device *spi)
10461046
{
1047-
struct wm8988_priv *wm8988 = spi->dev.driver_data;
1047+
struct wm8988_priv *wm8988 = dev_get_drvdata(&spi->dev);
10481048

10491049
wm8988_unregister(wm8988);
10501050

0 commit comments

Comments
 (0)