Skip to content

Commit fcb5207

Browse files
committed
ide: remove driver_data direct access of struct device
In the near future, the driver core is going to not allow direct access to the driver_data pointer in struct device. Instead, the functions dev_get_drvdata() and dev_set_drvdata() should be used. These functions have been around since the beginning, so are backwards compatible with all older kernel versions. Cc: linux-ide@vger.kernel.org Acked-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
1 parent d961450 commit fcb5207

3 files changed

Lines changed: 7 additions & 5 deletions

File tree

‎drivers/ide/ide-pm.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@
33

44
int generic_ide_suspend(struct device *dev, pm_message_t mesg)
55
{
6-
ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
6+
ide_drive_t *drive = dev_get_drvdata(dev);
7+
ide_drive_t *pair = ide_get_pair_dev(drive);
78
ide_hwif_t *hwif = drive->hwif;
89
struct request *rq;
910
struct request_pm_state rqpm;
@@ -34,7 +35,8 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg)
3435

3536
int generic_ide_resume(struct device *dev)
3637
{
37-
ide_drive_t *drive = dev->driver_data, *pair = ide_get_pair_dev(drive);
38+
ide_drive_t *drive = dev_get_drvdata(dev);
39+
ide_drive_t *pair = ide_get_pair_dev(drive);
3840
ide_hwif_t *hwif = drive->hwif;
3941
struct request *rq;
4042
struct request_pm_state rqpm;

‎drivers/ide/ide-probe.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ static int ide_register_port(ide_hwif_t *hwif)
535535

536536
/* register with global device tree */
537537
dev_set_name(&hwif->gendev, hwif->name);
538-
hwif->gendev.driver_data = hwif;
538+
dev_set_drvdata(&hwif->gendev, hwif);
539539
if (hwif->gendev.parent == NULL)
540540
hwif->gendev.parent = hwif->dev;
541541
hwif->gendev.release = hwif_release_dev;
@@ -987,9 +987,9 @@ static void hwif_register_devices(ide_hwif_t *hwif)
987987
int ret;
988988

989989
dev_set_name(dev, "%u.%u", hwif->index, i);
990+
dev_set_drvdata(dev, drive);
990991
dev->parent = &hwif->gendev;
991992
dev->bus = &ide_bus_type;
992-
dev->driver_data = drive;
993993
dev->release = drive_release_dev;
994994

995995
ret = device_register(dev);

‎drivers/ide/ide_platform.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ static int __devinit plat_ide_probe(struct platform_device *pdev)
112112

113113
static int __devexit plat_ide_remove(struct platform_device *pdev)
114114
{
115-
struct ide_host *host = pdev->dev.driver_data;
115+
struct ide_host *host = dev_get_drvdata(&pdev->dev);
116116

117117
ide_host_remove(host);
118118

0 commit comments

Comments
 (0)