Commit e6f09950 authored by Bartlomiej Zolnierkiewicz's avatar Bartlomiej Zolnierkiewicz Committed by Linus Torvalds

[PATCH] ide: ide-pnp update

- do not unregister ide-pnp driver while detaching random
  IDE device from random IDE device driver if IDE is modular
  (somebody added this in 2.3.51)
- clear 'hw_regs_t hw' allocated from stack
- mark idepnp_init() with __init
- use ide_std_init_ports() instead of ide_setup_ports()
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@elka.pw.edu.pl>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 39dff54f
...@@ -16,25 +16,9 @@ ...@@ -16,25 +16,9 @@
* Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <linux/ide.h>
#include <linux/init.h> #include <linux/init.h>
#include <linux/pnp.h> #include <linux/pnp.h>
#include <linux/ide.h>
#define GENERIC_HD_DATA 0
#define GENERIC_HD_ERROR 1
#define GENERIC_HD_NSECTOR 2
#define GENERIC_HD_SECTOR 3
#define GENERIC_HD_LCYL 4
#define GENERIC_HD_HCYL 5
#define GENERIC_HD_SELECT 6
#define GENERIC_HD_STATUS 7
static int generic_ide_offsets[IDE_NR_PORTS] = {
GENERIC_HD_DATA, GENERIC_HD_ERROR, GENERIC_HD_NSECTOR,
GENERIC_HD_SECTOR, GENERIC_HD_LCYL, GENERIC_HD_HCYL,
GENERIC_HD_SELECT, GENERIC_HD_STATUS, -1, -1
};
/* Add your devices here :)) */ /* Add your devices here :)) */
struct pnp_device_id idepnp_devices[] = { struct pnp_device_id idepnp_devices[] = {
...@@ -52,12 +36,11 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id ...@@ -52,12 +36,11 @@ static int idepnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id
if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0))) if (!(pnp_port_valid(dev, 0) && pnp_port_valid(dev, 1) && pnp_irq_valid(dev, 0)))
return -1; return -1;
ide_setup_ports(&hw, (unsigned long) pnp_port_start(dev, 0), memset(&hw, 0, sizeof(hw));
generic_ide_offsets, ide_std_init_ports(&hw, pnp_port_start(dev, 0),
(unsigned long) pnp_port_start(dev, 1), pnp_port_start(dev, 1));
0, NULL, hw.irq = pnp_irq(dev, 0);
// generic_pnp_ide_iops, hw.dma = NO_DMA;
pnp_irq(dev, 0));
index = ide_register_hw(&hw, &hwif); index = ide_register_hw(&hw, &hwif);
...@@ -86,11 +69,7 @@ static struct pnp_driver idepnp_driver = { ...@@ -86,11 +69,7 @@ static struct pnp_driver idepnp_driver = {
.remove = idepnp_remove, .remove = idepnp_remove,
}; };
void __init pnpide_init(void)
void pnpide_init(int enable)
{ {
if(enable)
pnp_register_driver(&idepnp_driver); pnp_register_driver(&idepnp_driver);
else
pnp_unregister_driver(&idepnp_driver);
} }
...@@ -2003,6 +2003,7 @@ int __init ide_setup (char *s) ...@@ -2003,6 +2003,7 @@ int __init ide_setup (char *s)
return 1; return 1;
} }
extern void pnpide_init(void);
extern void h8300_ide_init(void); extern void h8300_ide_init(void);
/* /*
...@@ -2069,12 +2070,9 @@ static void __init probe_for_hwifs (void) ...@@ -2069,12 +2070,9 @@ static void __init probe_for_hwifs (void)
buddha_init(); buddha_init();
} }
#endif /* CONFIG_BLK_DEV_BUDDHA */ #endif /* CONFIG_BLK_DEV_BUDDHA */
#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) #ifdef CONFIG_BLK_DEV_IDEPNP
{ pnpide_init();
extern void pnpide_init(int enable); #endif
pnpide_init(1);
}
#endif /* CONFIG_BLK_DEV_IDEPNP */
#ifdef CONFIG_H8300 #ifdef CONFIG_H8300
h8300_ide_init(); h8300_ide_init();
#endif #endif
...@@ -2212,9 +2210,6 @@ int ide_unregister_subdriver (ide_drive_t *drive) ...@@ -2212,9 +2210,6 @@ int ide_unregister_subdriver (ide_drive_t *drive)
up(&ide_setting_sem); up(&ide_setting_sem);
return 1; return 1;
} }
#if defined(CONFIG_BLK_DEV_IDEPNP) && defined(CONFIG_PNP) && defined(MODULE)
pnpide_init(0);
#endif /* CONFIG_BLK_DEV_IDEPNP */
#ifdef CONFIG_PROC_FS #ifdef CONFIG_PROC_FS
ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc); ide_remove_proc_entries(drive->proc, DRIVER(drive)->proc);
ide_remove_proc_entries(drive->proc, generic_subdriver_entries); ide_remove_proc_entries(drive->proc, generic_subdriver_entries);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment