47 #include <linux/module.h>
48 #include <linux/types.h>
49 #include <linux/string.h>
50 #include <linux/kernel.h>
53 #include <linux/errno.h>
56 #include <linux/pci.h>
60 #include <linux/device.h>
79 host_dev = drive->
hwif->host->dev[0];
80 module = host_dev ? host_dev->
driver->owner :
NULL;
82 if (module && !try_module_get(module)) {
100 #ifdef CONFIG_MODULE_UNLOAD
101 struct device *host_dev = drive->
hwif->host->dev[0];
126 static int generic_ide_probe(
struct device *dev)
134 static int generic_ide_remove(
struct device *dev)
145 static void generic_ide_shutdown(
struct device *dev)
156 .match = ide_bus_match,
157 .uevent = ide_uevent,
158 .probe = generic_ide_probe,
159 .remove = generic_ide_remove,
160 .shutdown = generic_ide_shutdown,
180 static int ide_set_dev_param_mask(
const char *
s,
const struct kernel_param *kp)
183 unsigned int *dev_param_mask = (
unsigned int *)kp->
arg;
186 if (
sscanf(s,
"%d.%d:%d", &a, &b, &j) != 3 &&
187 sscanf(s,
"%d.%d", &a, &b) != 2)
196 *dev_param_mask |= (1 <<
i);
198 *dev_param_mask &= ~(1 <<
i);
204 .set = ide_set_dev_param_mask
207 #define param_check_ide_dev_mask(name, p) param_check_uint(name, p)
209 static unsigned int ide_nodma;
214 static unsigned int ide_noflush;
219 static unsigned int ide_nohpa;
224 static unsigned int ide_noprobe;
229 static unsigned int ide_nowerr;
234 static unsigned int ide_cdroms;
245 static unsigned int ide_disks;
250 int a,
b,
c = 0,
h = 0, s = 0,
i, j = 1;
254 if (
sscanf(str,
"%d.%d:%d,%d,%d", &a, &b, &c, &
h, &s) != 5 &&
255 sscanf(str,
"%d.%d:%d", &a, &b, &j) != 3)
263 if (c >
INT_MAX ||
h > 255 || s > 255)
267 ide_disks |= (1 <<
i);
269 ide_disks &= ~(1 <<
i);
271 ide_disks_chs[
i].cyl =
c;
272 ide_disks_chs[
i].head =
h;
273 ide_disks_chs[
i].sect =
s;
285 if (ide_nodma & (1 << i)) {
289 if (ide_noflush & (1 << i)) {
294 if (ide_nohpa & (1 << i)) {
299 if (ide_noprobe & (1 << i)) {
303 if (ide_nowerr & (1 << i)) {
308 if (ide_cdroms & (1 << i)) {
315 if (ide_disks & (1 << i)) {
330 static unsigned int ide_ignore_cable;
332 static int ide_set_ignore_cable(
const char *s,
struct kernel_param *kp)
338 if (
sscanf(s,
"%d:%d", &i, &j) != 2 &&
sscanf(s,
"%d", &i) != 1)
345 ide_ignore_cable |= (1 <<
i);
347 ide_ignore_cable &= ~(1 <<
i);
360 if (ide_ignore_cable & (1 << hwif->
index)) {
367 ide_dev_apply_params(drive, i);
373 static int __init ide_init(
void)
386 if (IS_ERR(ide_port_class)) {
387 ret = PTR_ERR(ide_port_class);
403 static void __exit ide_exit(
void)