Skip to content

Commit d6e5bcf

Browse files
committed
[PATCH] devfs: Remove the mode field from usb_class_driver as it's no longer needed
Also fixes all drivers that set this field, and removes some other devfs specfic USB logic. Signed-off-by: Greg Kroah-Hartman <[email protected]> drivers/usb/class/usblp.c | 3 +-- drivers/usb/core/file.c | 19 ++++--------------- drivers/usb/image/mdc800.c | 3 +-- drivers/usb/input/aiptek.c | 2 +- drivers/usb/input/hiddev.c | 3 +-- drivers/usb/media/dabusb.c | 3 +-- drivers/usb/misc/auerswald.c | 3 +-- drivers/usb/misc/idmouse.c | 5 ++--- drivers/usb/misc/legousbtower.c | 5 ++--- drivers/usb/misc/rio500.c | 3 +-- drivers/usb/misc/sisusbvga/sisusb.c | 5 ----- drivers/usb/misc/usblcd.c | 9 ++++----- drivers/usb/usb-skeleton.c | 3 +-- include/linux/usb.h | 7 ++----- 14 files changed, 22 insertions(+), 51 deletions(-)
1 parent 094f164 commit d6e5bcf

File tree

14 files changed

+22
-51
lines changed

14 files changed

+22
-51
lines changed

drivers/usb/class/usblp.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -844,9 +844,8 @@ static struct file_operations usblp_fops = {
844844
};
845845

846846
static struct usb_class_driver usblp_class = {
847-
.name = "usb/lp%d",
847+
.name = "lp%d",
848848
.fops = &usblp_fops,
849-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
850849
.minor_base = USBLP_MINOR_BASE,
851850
};
852851

drivers/usb/core/file.c

Lines changed: 4 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
#include <linux/config.h>
1919
#include <linux/module.h>
20-
#include <linux/devfs_fs_kernel.h>
2120
#include <linux/spinlock.h>
2221
#include <linux/errno.h>
2322

@@ -88,16 +87,13 @@ int usb_major_init(void)
8887
goto out;
8988
}
9089

91-
devfs_mk_dir("usb");
92-
9390
out:
9491
return error;
9592
}
9693

9794
void usb_major_cleanup(void)
9895
{
9996
class_destroy(usb_class);
100-
devfs_remove("usb");
10197
unregister_chrdev(USB_MAJOR, "usb");
10298
}
10399

@@ -112,8 +108,7 @@ void usb_major_cleanup(void)
112108
* enabled, the minor number will be based on the next available free minor,
113109
* starting at the class_driver->minor_base.
114110
*
115-
* This function also creates the devfs file for the usb device, if devfs
116-
* is enabled, and creates a usb class device in the sysfs tree.
111+
* This function also creates a usb class device in the sysfs tree.
117112
*
118113
* usb_deregister_dev() must be called when the driver is done with
119114
* the minor numbers given out by this function.
@@ -162,11 +157,8 @@ int usb_register_dev(struct usb_interface *intf,
162157

163158
intf->minor = minor;
164159

165-
/* handle the devfs registration */
166-
snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base);
167-
devfs_mk_cdev(MKDEV(USB_MAJOR, minor), class_driver->mode, name);
168-
169160
/* create a usb class device for this usb interface */
161+
snprintf(name, BUS_ID_SIZE, class_driver->name, minor - minor_base);
170162
temp = strrchr(name, '/');
171163
if (temp && (temp[1] != 0x00))
172164
++temp;
@@ -179,7 +171,6 @@ int usb_register_dev(struct usb_interface *intf,
179171
spin_lock (&minor_lock);
180172
usb_minors[intf->minor] = NULL;
181173
spin_unlock (&minor_lock);
182-
devfs_remove (name);
183174
retval = PTR_ERR(intf->class_dev);
184175
}
185176
exit:
@@ -197,9 +188,8 @@ EXPORT_SYMBOL(usb_register_dev);
197188
* call to usb_register_dev() (usually when the device is disconnected
198189
* from the system.)
199190
*
200-
* This function also cleans up the devfs file for the usb device, if devfs
201-
* is enabled, and removes the usb class device from the sysfs tree.
202-
*
191+
* This function also removes the usb class device from the sysfs tree.
192+
*
203193
* This should be called by all drivers that use the USB major number.
204194
*/
205195
void usb_deregister_dev(struct usb_interface *intf,
@@ -222,7 +212,6 @@ void usb_deregister_dev(struct usb_interface *intf,
222212
spin_unlock (&minor_lock);
223213

224214
snprintf(name, BUS_ID_SIZE, class_driver->name, intf->minor - minor_base);
225-
devfs_remove (name);
226215
class_device_destroy(usb_class, MKDEV(USB_MAJOR, intf->minor));
227216
intf->class_dev = NULL;
228217
intf->minor = -1;

drivers/usb/image/mdc800.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -425,9 +425,8 @@ static void mdc800_usb_download_notify (struct urb *urb, struct pt_regs *res)
425425
static struct usb_driver mdc800_usb_driver;
426426
static struct file_operations mdc800_device_ops;
427427
static struct usb_class_driver mdc800_class = {
428-
.name = "usb/mdc800%d",
428+
.name = "mdc800%d",
429429
.fops = &mdc800_device_ops,
430-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
431430
.minor_base = MDC800_DEVICE_MINOR_BASE,
432431
};
433432

drivers/usb/input/aiptek.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2154,7 +2154,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id)
21542154
* input_handles associated with this input device.
21552155
* What identifies an evdev input_handler is that it begins
21562156
* with 'event', continues with a digit, and that in turn
2157-
* is mapped to /{devfs}/input/eventN.
2157+
* is mapped to input/eventN.
21582158
*/
21592159
list_for_each_safe(node, next, &inputdev->h_list) {
21602160
inputhandle = to_handle(node);

drivers/usb/input/hiddev.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -732,9 +732,8 @@ static struct file_operations hiddev_fops = {
732732
};
733733

734734
static struct usb_class_driver hiddev_class = {
735-
.name = "usb/hid/hiddev%d",
735+
.name = "hiddev%d",
736736
.fops = &hiddev_fops,
737-
.mode = S_IFCHR | S_IRUGO | S_IWUSR,
738737
.minor_base = HIDDEV_MINOR_BASE,
739738
};
740739

drivers/usb/media/dabusb.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -707,9 +707,8 @@ static struct file_operations dabusb_fops =
707707
};
708708

709709
static struct usb_class_driver dabusb_class = {
710-
.name = "usb/dabusb%d",
710+
.name = "dabusb%d",
711711
.fops = &dabusb_fops,
712-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
713712
.minor_base = DABUSB_MINOR,
714713
};
715714

drivers/usb/misc/auerswald.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1873,9 +1873,8 @@ static struct file_operations auerswald_fops =
18731873
};
18741874

18751875
static struct usb_class_driver auerswald_class = {
1876-
.name = "usb/auer%d",
1876+
.name = "auer%d",
18771877
.fops = &auerswald_fops,
1878-
.mode = S_IFCHR | S_IRUGO | S_IWUGO,
18791878
.minor_base = AUER_MINOR_BASE,
18801879
};
18811880

drivers/usb/misc/idmouse.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -105,11 +105,10 @@ static struct file_operations idmouse_fops = {
105105
.release = idmouse_release,
106106
};
107107

108-
/* class driver information for devfs */
108+
/* class driver information */
109109
static struct usb_class_driver idmouse_class = {
110-
.name = "usb/idmouse%d",
110+
.name = "idmouse%d",
111111
.fops = &idmouse_fops,
112-
.mode = S_IFCHR | S_IRUSR | S_IRGRP | S_IROTH, /* filemode (char, 444) */
113112
.minor_base = USB_IDMOUSE_MINOR_BASE,
114113
};
115114

drivers/usb/misc/legousbtower.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,12 +271,11 @@ static struct file_operations tower_fops = {
271271

272272
/*
273273
* usb class driver info in order to get a minor number from the usb core,
274-
* and to have the device registered with devfs and the driver core
274+
* and to have the device registered with the driver core
275275
*/
276276
static struct usb_class_driver tower_class = {
277-
.name = "usb/legousbtower%d",
277+
.name = "legousbtower%d",
278278
.fops = &tower_fops,
279-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
280279
.minor_base = LEGO_USB_TOWER_MINOR_BASE,
281280
};
282281

drivers/usb/misc/rio500.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -443,9 +443,8 @@ file_operations usb_rio_fops = {
443443
};
444444

445445
static struct usb_class_driver usb_rio_class = {
446-
.name = "usb/rio500%d",
446+
.name = "rio500%d",
447447
.fops = &usb_rio_fops,
448-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
449448
.minor_base = RIO_MINOR,
450449
};
451450

drivers/usb/misc/sisusbvga/sisusb.c

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3239,12 +3239,7 @@ static struct file_operations usb_sisusb_fops = {
32393239
};
32403240

32413241
static struct usb_class_driver usb_sisusb_class = {
3242-
#if LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,13)
3243-
.name = "usb/sisusbvga%d",
3244-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP,
3245-
#else
32463242
.name = "sisusbvga%d",
3247-
#endif
32483243
.fops = &usb_sisusb_fops,
32493244
.minor_base = SISUSB_MINOR
32503245
};

drivers/usb/misc/usblcd.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -251,13 +251,12 @@ static struct file_operations lcd_fops = {
251251
};
252252

253253
/*
254-
* * usb class driver info in order to get a minor number from the usb core,
255-
* * and to have the device registered with devfs and the driver core
256-
* */
254+
* usb class driver info in order to get a minor number from the usb core,
255+
* and to have the device registered with the driver core
256+
*/
257257
static struct usb_class_driver lcd_class = {
258-
.name = "usb/lcd%d",
258+
.name = "lcd%d",
259259
.fops = &lcd_fops,
260-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
261260
.minor_base = USBLCD_MINOR,
262261
};
263262

drivers/usb/usb-skeleton.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,9 +223,8 @@ static struct file_operations skel_fops = {
223223
* and to have the device registered with devfs and the driver core
224224
*/
225225
static struct usb_class_driver skel_class = {
226-
.name = "usb/skel%d",
226+
.name = "skel%d",
227227
.fops = &skel_fops,
228-
.mode = S_IFCHR | S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH,
229228
.minor_base = USB_SKEL_MINOR_BASE,
230229
};
231230

include/linux/usb.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -576,10 +576,8 @@ extern struct bus_type usb_bus_type;
576576

577577
/**
578578
* struct usb_class_driver - identifies a USB driver that wants to use the USB major number
579-
* @name: devfs name for this driver. Will also be used by the driver
580-
* class code to create a usb class device.
579+
* @name: the usb class device name for this driver. Will show up in sysfs.
581580
* @fops: pointer to the struct file_operations of this driver.
582-
* @mode: the mode for the devfs file to be created for this driver.
583581
* @minor_base: the start of the minor range for this driver.
584582
*
585583
* This structure is used for the usb_register_dev() and
@@ -589,8 +587,7 @@ extern struct bus_type usb_bus_type;
589587
struct usb_class_driver {
590588
char *name;
591589
struct file_operations *fops;
592-
mode_t mode;
593-
int minor_base;
590+
int minor_base;
594591
};
595592

596593
/*

0 commit comments

Comments
 (0)