Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 79cb3803 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz
Browse files

ide: allow device drivers to specify per-device type /proc settings



Turn ide_driver_t's 'proc' field into ->proc_entries method
(and also 'settings' field into ->proc_devsets method).  Then
update all device drivers accordingly.

There should be no functional changes caused by this patch.

Acked-by: default avatarBorislav Petkov <petkovbb@gmail.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 9a6eb74d
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -1908,6 +1908,16 @@ static const struct ide_proc_devset idecd_settings[] = {
	IDE_PROC_DEVSET(dsc_overlap, 0, 1),
	{ 0 },
};

static ide_proc_entry_t *ide_cd_proc_entries(ide_drive_t *drive)
{
	return idecd_proc;
}

static const struct ide_proc_devset *ide_cd_proc_devsets(ide_drive_t *drive)
{
	return idecd_settings;
}
#endif

static const struct cd_list_entry ide_cd_quirks_list[] = {
@@ -2069,8 +2079,8 @@ static ide_driver_t ide_cdrom_driver = {
	.end_request		= ide_end_request,
	.error			= __ide_error,
#ifdef CONFIG_IDE_PROC_FS
	.proc			= idecd_proc,
	.settings		= idecd_settings,
	.proc_entries		= ide_cd_proc_entries,
	.proc_devsets		= ide_cd_proc_devsets,
#endif
};

+14 −2
Original line number Diff line number Diff line
@@ -77,6 +77,18 @@ static void ide_disk_release(struct kref *kref)
	kfree(idkp);
}

#ifdef CONFIG_IDE_PROC_FS
static ide_proc_entry_t *ide_floppy_proc_entries(ide_drive_t *drive)
{
	return ide_floppy_proc;
}

static const struct ide_proc_devset *ide_floppy_proc_devsets(ide_drive_t *drive)
{
	return ide_floppy_settings;
}
#endif

static ide_driver_t ide_gd_driver = {
	.gen_driver = {
		.owner		= THIS_MODULE,
@@ -90,8 +102,8 @@ static ide_driver_t ide_gd_driver = {
	.end_request		= ide_floppy_end_request,
	.error			= __ide_error,
#ifdef CONFIG_IDE_PROC_FS
	.proc			= ide_floppy_proc,
	.settings		= ide_floppy_settings,
	.proc_entries		= ide_floppy_proc_entries,
	.proc_devsets		= ide_floppy_proc_devsets,
#endif
};

+14 −2
Original line number Diff line number Diff line
@@ -119,6 +119,18 @@ static void ide_gd_shutdown(ide_drive_t *drive)
	drive->gendev.bus->suspend(&drive->gendev, PMSG_SUSPEND);
}

#ifdef CONFIG_IDE_PROC_FS
static ide_proc_entry_t *ide_disk_proc_entries(ide_drive_t *drive)
{
	return ide_disk_proc;
}

static const struct ide_proc_devset *ide_disk_proc_devsets(ide_drive_t *drive)
{
	return ide_disk_settings;
}
#endif

static ide_driver_t ide_gd_driver = {
	.gen_driver = {
		.owner		= THIS_MODULE,
@@ -134,8 +146,8 @@ static ide_driver_t ide_gd_driver = {
	.end_request		= ide_end_request,
	.error			= __ide_error,
#ifdef CONFIG_IDE_PROC_FS
	.proc			= ide_disk_proc,
	.settings		= ide_disk_settings,
	.proc_entries		= ide_disk_proc_entries,
	.proc_devsets		= ide_disk_proc_devsets,
#endif
};

+3 −3
Original line number Diff line number Diff line
@@ -567,10 +567,10 @@ static void ide_remove_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t
void ide_proc_register_driver(ide_drive_t *drive, ide_driver_t *driver)
{
	mutex_lock(&ide_setting_mtx);
	drive->settings = driver->settings;
	drive->settings = driver->proc_devsets(drive);
	mutex_unlock(&ide_setting_mtx);

	ide_add_proc_entries(drive->proc, driver->proc, drive);
	ide_add_proc_entries(drive->proc, driver->proc_entries(drive), drive);
}

EXPORT_SYMBOL(ide_proc_register_driver);
@@ -591,7 +591,7 @@ void ide_proc_unregister_driver(ide_drive_t *drive, ide_driver_t *driver)
{
	unsigned long flags;

	ide_remove_proc_entries(drive->proc, driver->proc);
	ide_remove_proc_entries(drive->proc, driver->proc_entries(drive));

	mutex_lock(&ide_setting_mtx);
	spin_lock_irqsave(&ide_lock, flags);
+12 −2
Original line number Diff line number Diff line
@@ -2298,6 +2298,16 @@ static ide_proc_entry_t idetape_proc[] = {
	{ "name",	S_IFREG|S_IRUGO,	proc_idetape_read_name,	NULL },
	{ NULL, 0, NULL, NULL }
};

static ide_proc_entry_t *ide_tape_proc_entries(ide_drive_t *drive)
{
	return idetape_proc;
}

static const struct ide_proc_devset *ide_tape_proc_devsets(ide_drive_t *drive)
{
	return idetape_settings;
}
#endif

static int ide_tape_probe(ide_drive_t *);
@@ -2315,8 +2325,8 @@ static ide_driver_t idetape_driver = {
	.end_request		= idetape_end_request,
	.error			= __ide_error,
#ifdef CONFIG_IDE_PROC_FS
	.proc			= idetape_proc,
	.settings		= idetape_settings,
	.proc_entries		= ide_tape_proc_entries,
	.proc_devsets		= ide_tape_proc_devsets,
#endif
};

Loading