[PATCH] proc: remove useless (and buggy) ->nlink settings

Bug: pnx8550 code creates directory but resets ->nlink to 1.

create_proc_entry() et al will correctly set ->nlink for you.

Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>
Cc: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Jeff Dike <jdike@addtoit.com>
Cc: Corey Minyard <minyard@acm.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Cc: Kyle McMartin <kyle@mcmartin.ca>
Cc: Martin Schwidefsky <schwidefsky@de.ibm.com>
Cc: Greg KH <greg@kroah.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Thomas Gleixner <tglx@linutronix.de>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
This commit is contained in:
Alexey Dobriyan 2007-02-10 01:45:54 -08:00 коммит произвёл Linus Torvalds
Родитель 891dcd2f7a
Коммит b653d081c1
15 изменённых файлов: 1 добавлений и 25 удалений

Просмотреть файл

@ -79,10 +79,7 @@ static int pnx8550_proc_init( void )
// Create /proc/pnx8550 // Create /proc/pnx8550
pnx8550_dir = create_proc_entry("pnx8550", S_IFDIR|S_IRUGO, NULL); pnx8550_dir = create_proc_entry("pnx8550", S_IFDIR|S_IRUGO, NULL);
if (pnx8550_dir){ if (!pnx8550_dir) {
pnx8550_dir->nlink = 1;
}
else {
printk(KERN_ERR "Can't create pnx8550 proc dir\n"); printk(KERN_ERR "Can't create pnx8550 proc dir\n");
return -1; return -1;
} }
@ -90,7 +87,6 @@ static int pnx8550_proc_init( void )
// Create /proc/pnx8550/timers // Create /proc/pnx8550/timers
pnx8550_timers = create_proc_entry("timers", S_IFREG|S_IRUGO, pnx8550_dir ); pnx8550_timers = create_proc_entry("timers", S_IFREG|S_IRUGO, pnx8550_dir );
if (pnx8550_timers){ if (pnx8550_timers){
pnx8550_timers->nlink = 1;
pnx8550_timers->read_proc = pnx8550_timers_read; pnx8550_timers->read_proc = pnx8550_timers_read;
} }
else { else {
@ -100,7 +96,6 @@ static int pnx8550_proc_init( void )
// Create /proc/pnx8550/registers // Create /proc/pnx8550/registers
pnx8550_registers = create_proc_entry("registers", S_IFREG|S_IRUGO, pnx8550_dir ); pnx8550_registers = create_proc_entry("registers", S_IFREG|S_IRUGO, pnx8550_dir );
if (pnx8550_registers){ if (pnx8550_registers){
pnx8550_registers->nlink = 1;
pnx8550_registers->read_proc = pnx8550_registers_read; pnx8550_registers->read_proc = pnx8550_registers_read;
} }
else { else {

Просмотреть файл

@ -71,7 +71,6 @@ static int __init proc_ppc64_init(void)
pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL); pde = create_proc_entry("ppc64/systemcfg", S_IFREG|S_IRUGO, NULL);
if (!pde) if (!pde)
return 1; return 1;
pde->nlink = 1;
pde->data = vdso_data; pde->data = vdso_data;
pde->size = PAGE_SIZE; pde->size = PAGE_SIZE;
pde->proc_fops = &page_map_fops; pde->proc_fops = &page_map_fops;

Просмотреть файл

@ -708,7 +708,6 @@ static struct proc_dir_entry *create_flash_pde(const char *filename,
ent = create_proc_entry(filename, S_IRUSR | S_IWUSR, NULL); ent = create_proc_entry(filename, S_IRUSR | S_IWUSR, NULL);
if (ent != NULL) { if (ent != NULL) {
ent->nlink = 1;
ent->proc_fops = fops; ent->proc_fops = fops;
ent->owner = THIS_MODULE; ent->owner = THIS_MODULE;
} }

Просмотреть файл

@ -1253,7 +1253,6 @@ static int __init mf_proc_init(void)
ent = create_proc_entry("cmdline", S_IFREG|S_IRUSR|S_IWUSR, mf); ent = create_proc_entry("cmdline", S_IFREG|S_IRUSR|S_IWUSR, mf);
if (!ent) if (!ent)
return 1; return 1;
ent->nlink = 1;
ent->data = (void *)(long)i; ent->data = (void *)(long)i;
ent->read_proc = proc_mf_dump_cmdline; ent->read_proc = proc_mf_dump_cmdline;
ent->write_proc = proc_mf_change_cmdline; ent->write_proc = proc_mf_change_cmdline;
@ -1264,7 +1263,6 @@ static int __init mf_proc_init(void)
ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf); ent = create_proc_entry("vmlinux", S_IFREG|S_IWUSR, mf);
if (!ent) if (!ent)
return 1; return 1;
ent->nlink = 1;
ent->data = (void *)(long)i; ent->data = (void *)(long)i;
ent->proc_fops = &proc_vmlinux_operations; ent->proc_fops = &proc_vmlinux_operations;
} }
@ -1272,7 +1270,6 @@ static int __init mf_proc_init(void)
ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); ent = create_proc_entry("side", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
if (!ent) if (!ent)
return 1; return 1;
ent->nlink = 1;
ent->data = (void *)0; ent->data = (void *)0;
ent->read_proc = proc_mf_dump_side; ent->read_proc = proc_mf_dump_side;
ent->write_proc = proc_mf_change_side; ent->write_proc = proc_mf_change_side;
@ -1280,7 +1277,6 @@ static int __init mf_proc_init(void)
ent = create_proc_entry("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root); ent = create_proc_entry("src", S_IFREG|S_IRUSR|S_IWUSR, mf_proc_root);
if (!ent) if (!ent)
return 1; return 1;
ent->nlink = 1;
ent->data = (void *)0; ent->data = (void *)0;
ent->read_proc = proc_mf_dump_src; ent->read_proc = proc_mf_dump_src;
ent->write_proc = proc_mf_change_src; ent->write_proc = proc_mf_change_src;

Просмотреть файл

@ -513,7 +513,6 @@ static int proc_ppc64_create_ofdt(void)
ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL); ent = create_proc_entry("ppc64/ofdt", S_IWUSR, NULL);
if (ent) { if (ent) {
ent->nlink = 1;
ent->data = NULL; ent->data = NULL;
ent->size = 0; ent->size = 0;
ent->proc_fops = &ofdt_fops; ent->proc_fops = &ofdt_fops;

Просмотреть файл

@ -235,7 +235,6 @@ static void make_ide_entries(char *dev_name)
ent = create_proc_entry("media", S_IFREG|S_IRUGO, dir); ent = create_proc_entry("media", S_IFREG|S_IRUGO, dir);
if(!ent) return; if(!ent) return;
ent->nlink = 1;
ent->data = NULL; ent->data = NULL;
ent->read_proc = proc_ide_read_media; ent->read_proc = proc_ide_read_media;
ent->write_proc = NULL; ent->write_proc = NULL;

Просмотреть файл

@ -1887,7 +1887,6 @@ int ipmi_smi_add_proc_entry(ipmi_smi_t smi, char *name,
kfree(entry); kfree(entry);
rv = -ENOMEM; rv = -ENOMEM;
} else { } else {
file->nlink = 1;
file->data = data; file->data = data;
file->read_proc = read_proc; file->read_proc = read_proc;
file->write_proc = write_proc; file->write_proc = write_proc;

Просмотреть файл

@ -413,7 +413,6 @@ void ide_add_proc_entries(struct proc_dir_entry *dir, ide_proc_entry_t *p, void
while (p->name != NULL) { while (p->name != NULL) {
ent = create_proc_entry(p->name, p->mode, dir); ent = create_proc_entry(p->name, p->mode, dir);
if (!ent) return; if (!ent) return;
ent->nlink = 1;
ent->data = data; ent->data = data;
ent->read_proc = p->read_proc; ent->read_proc = p->read_proc;
ent->write_proc = p->write_proc; ent->write_proc = p->write_proc;

Просмотреть файл

@ -516,7 +516,6 @@ static int __init via_pmu_dev_init(void)
proc_get_irqstats, NULL); proc_get_irqstats, NULL);
proc_pmu_options = create_proc_entry("options", 0600, proc_pmu_root); proc_pmu_options = create_proc_entry("options", 0600, proc_pmu_root);
if (proc_pmu_options) { if (proc_pmu_options) {
proc_pmu_options->nlink = 1;
proc_pmu_options->read_proc = proc_read_options; proc_pmu_options->read_proc = proc_read_options;
proc_pmu_options->write_proc = proc_write_options; proc_pmu_options->write_proc = proc_write_options;
} }

Просмотреть файл

@ -72,11 +72,9 @@ static int hdpu_nexus_probe(struct platform_device *pdev)
printk("Could not map slot id\n"); printk("Could not map slot id\n");
hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root); hdpu_slot_id = create_proc_entry("sky_slot_id", 0666, &proc_root);
hdpu_slot_id->read_proc = hdpu_slot_id_read; hdpu_slot_id->read_proc = hdpu_slot_id_read;
hdpu_slot_id->nlink = 1;
hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root); hdpu_chassis_id = create_proc_entry("sky_chassis_id", 0666, &proc_root);
hdpu_chassis_id->read_proc = hdpu_chassis_id_read; hdpu_chassis_id->read_proc = hdpu_chassis_id_read;
hdpu_chassis_id->nlink = 1;
return 0; return 0;
} }

Просмотреть файл

@ -252,7 +252,6 @@ static int __init led_create_procfs(void)
proc_pdc_root->owner = THIS_MODULE; proc_pdc_root->owner = THIS_MODULE;
ent = create_proc_entry("led", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root); ent = create_proc_entry("led", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root);
if (!ent) return -1; if (!ent) return -1;
ent->nlink = 1;
ent->data = (void *)LED_NOLCD; /* LED */ ent->data = (void *)LED_NOLCD; /* LED */
ent->read_proc = led_proc_read; ent->read_proc = led_proc_read;
ent->write_proc = led_proc_write; ent->write_proc = led_proc_write;
@ -262,7 +261,6 @@ static int __init led_create_procfs(void)
{ {
ent = create_proc_entry("lcd", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root); ent = create_proc_entry("lcd", S_IFREG|S_IRUGO|S_IWUSR, proc_pdc_root);
if (!ent) return -1; if (!ent) return -1;
ent->nlink = 1;
ent->data = (void *)LED_HASLCD; /* LCD */ ent->data = (void *)LED_HASLCD; /* LCD */
ent->read_proc = led_proc_read; ent->read_proc = led_proc_read;
ent->write_proc = led_proc_write; ent->write_proc = led_proc_write;

Просмотреть файл

@ -1063,7 +1063,6 @@ int __init zcrypt_api_init(void)
rc = -ENOMEM; rc = -ENOMEM;
goto out_misc; goto out_misc;
} }
zcrypt_entry->nlink = 1;
zcrypt_entry->data = NULL; zcrypt_entry->data = NULL;
zcrypt_entry->read_proc = zcrypt_status_read; zcrypt_entry->read_proc = zcrypt_status_read;
zcrypt_entry->write_proc = zcrypt_status_write; zcrypt_entry->write_proc = zcrypt_status_write;

Просмотреть файл

@ -1419,7 +1419,6 @@ int __devinit rndis_init (void)
return -EIO; return -EIO;
} }
rndis_connect_state [i]->nlink = 1;
rndis_connect_state [i]->write_proc = rndis_proc_write; rndis_connect_state [i]->write_proc = rndis_proc_write;
rndis_connect_state [i]->read_proc = rndis_proc_read; rndis_connect_state [i]->read_proc = rndis_proc_read;
rndis_connect_state [i]->data = (void *) rndis_connect_state [i]->data = (void *)

Просмотреть файл

@ -136,7 +136,6 @@ void register_irq_proc(unsigned int irq)
entry = create_proc_entry("smp_affinity", 0600, irq_desc[irq].dir); entry = create_proc_entry("smp_affinity", 0600, irq_desc[irq].dir);
if (entry) { if (entry) {
entry->nlink = 1;
entry->data = (void *)(long)irq; entry->data = (void *)(long)irq;
entry->read_proc = irq_affinity_read_proc; entry->read_proc = irq_affinity_read_proc;
entry->write_proc = irq_affinity_write_proc; entry->write_proc = irq_affinity_write_proc;

Просмотреть файл

@ -449,7 +449,6 @@ void create_prof_cpu_mask(struct proc_dir_entry *root_irq_dir)
/* create /proc/irq/prof_cpu_mask */ /* create /proc/irq/prof_cpu_mask */
if (!(entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir))) if (!(entry = create_proc_entry("prof_cpu_mask", 0600, root_irq_dir)))
return; return;
entry->nlink = 1;
entry->data = (void *)&prof_cpu_mask; entry->data = (void *)&prof_cpu_mask;
entry->read_proc = prof_cpu_mask_read_proc; entry->read_proc = prof_cpu_mask_read_proc;
entry->write_proc = prof_cpu_mask_write_proc; entry->write_proc = prof_cpu_mask_write_proc;