lkml.org 
[lkml]   [2004]   [Aug]   [17]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectPATCH: Make the SCAN_HWIF/UNREGISTER_HWIF stuff private
Until we can kill these off here is a simple change that removes the
pci_dev check and just stops users unloading interfaces not created by
SCAN_HWIF. That cleans up all the unloading of hotplug device corner
cases and stops users breaking things by killing live non generic devices.

Not sure what your current code looks like but a variant of the theory should
apply to any version of the code independantly.

--- include/linux/ide.h~ 2004-08-17 17:07:53.907433024 +0100
+++ include/linux/ide.h 2004-08-17 17:07:53.907433024 +0100
@@ -982,6 +982,7 @@
unsigned present : 1; /* this interface exists logically (ie users) */
unsigned configured : 1; /* this hwif exists and is set up (may not be "present") */
unsigned hold : 1; /* this interface is always present */
+ unsigned user_dev : 1; /* user ioctl created device */
unsigned serialized : 1; /* serialized all channel operation */
unsigned sharing_irq: 1; /* 1 = sharing irq with another hwif */
unsigned reset : 1; /* reset after probe */
--- drivers/ide/ide.c~ 2004-08-17 17:07:15.589258272 +0100
+++ drivers/ide/ide.c 2004-08-17 17:07:15.589258272 +0100
@@ -1796,6 +1796,7 @@
case HDIO_SCAN_HWIF:
{
hw_regs_t hw;
+ ide_hwif_t *hwif;
int args[3];
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
if (copy_from_user(args, p, 3 * sizeof(int)))
@@ -1804,15 +1805,16 @@
ide_init_hwif_ports(&hw, (unsigned long) args[0],
(unsigned long) args[1], NULL);
hw.irq = args[2];
- if (ide_register_hw(&hw, NULL) == -1)
+ if (ide_register_hw(&hw, &hwif) == -1)
return -EIO;
+ hwif->user_dev = 1;
return 0;
}
case HDIO_UNREGISTER_HWIF:
if (!capable(CAP_SYS_RAWIO)) return -EACCES;
if(arg > MAX_HWIFS || arg < 0)
return -EINVAL;
- if(ide_hwifs[arg].pci_dev)
+ if(!ide_hwifs[arg].user_dev)
return -EINVAL;
return ide_unregister_hwif(&ide_hwifs[arg]);
case HDIO_SET_NICE:
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
\
 
 \ /
  Last update: 2005-03-22 14:05    [W:0.038 / U:0.456 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site