hc
2024-05-10 37f49e37ab4cb5d0bc4c60eb5c6d4dd57db767bb
kernel/drivers/ide/ide-proc.c
....@@ -1,3 +1,4 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Copyright (C) 1997-1998 Mark Lord
34 * Copyright (C) 2003 Red Hat
....@@ -205,7 +206,7 @@
205206 ide_devset_rw(current_speed, xfer_rate);
206207 ide_devset_rw_field(init_speed, init_speed);
207208 ide_devset_rw_flag(nice1, IDE_DFLAG_NICE1);
208
-ide_devset_rw_field(number, dn);
209
+ide_devset_ro_field(number, dn);
209210
210211 static const struct ide_proc_devset ide_generic_settings[] = {
211212 IDE_PROC_DEVSET(current_speed, 0, 70),
....@@ -380,13 +381,12 @@
380381 return -EINVAL;
381382 }
382383
383
-static const struct file_operations ide_settings_proc_fops = {
384
- .owner = THIS_MODULE,
385
- .open = ide_settings_proc_open,
386
- .read = seq_read,
387
- .llseek = seq_lseek,
388
- .release = single_release,
389
- .write = ide_settings_proc_write,
384
+static const struct proc_ops ide_settings_proc_ops = {
385
+ .proc_open = ide_settings_proc_open,
386
+ .proc_read = seq_read,
387
+ .proc_lseek = seq_lseek,
388
+ .proc_release = single_release,
389
+ .proc_write = ide_settings_proc_write,
390390 };
391391
392392 int ide_capacity_proc_show(struct seq_file *m, void *v)
....@@ -545,7 +545,7 @@
545545 if (drive->proc) {
546546 ide_add_proc_entries(drive->proc, generic_drive_entries, drive);
547547 proc_create_data("settings", S_IFREG|S_IRUSR|S_IWUSR,
548
- drive->proc, &ide_settings_proc_fops,
548
+ drive->proc, &ide_settings_proc_ops,
549549 drive);
550550 }
551551 sprintf(name, "ide%d/%s", (drive->name[2]-'a')/2, drive->name);
....@@ -614,18 +614,7 @@
614614 return 0;
615615 }
616616
617
-static int ide_drivers_open(struct inode *inode, struct file *file)
618
-{
619
- return single_open(file, &ide_drivers_show, NULL);
620
-}
621
-
622
-static const struct file_operations ide_drivers_operations = {
623
- .owner = THIS_MODULE,
624
- .open = ide_drivers_open,
625
- .read = seq_read,
626
- .llseek = seq_lseek,
627
- .release = single_release,
628
-};
617
+DEFINE_PROC_SHOW_ATTRIBUTE(ide_drivers);
629618
630619 void proc_ide_create(void)
631620 {
....@@ -634,7 +623,7 @@
634623 if (!proc_ide_root)
635624 return;
636625
637
- proc_create("drivers", 0, proc_ide_root, &ide_drivers_operations);
626
+ proc_create("drivers", 0, proc_ide_root, &ide_drivers_proc_ops);
638627 }
639628
640629 void proc_ide_destroy(void)