Commit af46934e authored by Christoph Hellwig's avatar Christoph Hellwig Committed by Linus Torvalds

[PATCH] remove unused last argument to i2c_register_entry

(from lm_sensors CVS)
parent fe9f8bbe
...@@ -311,18 +311,14 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address, ...@@ -311,18 +311,14 @@ static int adm1021_detect(struct i2c_adapter *adapter, int address,
goto error3; goto error3;
/* Register a new directory entry with module sensors */ /* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, err = i2c_register_entry(new_client, type_name,
type_name, (data->type == adm1021) ?
data->type == adm1021_dir_table_template :
adm1021 ? adm1021_max_dir_table_template);
adm1021_dir_table_template : if (err < 0)
adm1021_max_dir_table_template,
THIS_MODULE)) < 0) {
err = i;
goto error4; goto error4;
}
data->sysctl_id = i;
data->sysctl_id = err;
/* Initialize the ADM1021 chip */ /* Initialize the ADM1021 chip */
adm1021_init_client(new_client); adm1021_init_client(new_client);
return 0; return 0;
......
...@@ -191,9 +191,8 @@ static int lm75_detect(struct i2c_adapter *adapter, int address, ...@@ -191,9 +191,8 @@ static int lm75_detect(struct i2c_adapter *adapter, int address,
goto error3; goto error3;
/* Register a new directory entry with module sensors */ /* Register a new directory entry with module sensors */
if ((i = i2c_register_entry(new_client, type_name, i = i2c_register_entry(new_client, type_name, lm75_dir_table_template);
lm75_dir_table_template, if (i < 0) {
THIS_MODULE)) < 0) {
err = i; err = i;
goto error4; goto error4;
} }
......
...@@ -125,17 +125,12 @@ static int i2c_create_name(char **name, const char *prefix, ...@@ -125,17 +125,12 @@ static int i2c_create_name(char **name, const char *prefix,
ctl_template should be a template of the newly created directory. It is ctl_template should be a template of the newly created directory. It is
copied in memory. The extra2 field of each file is set to point to client. copied in memory. The extra2 field of each file is set to point to client.
If any driver wants subdirectories within the newly created directory, If any driver wants subdirectories within the newly created directory,
this function must be updated! this function must be updated! */
controlling_mod is the controlling module. It should usually be
THIS_MODULE when calling. Note that this symbol is not defined in
kernels before 2.3.13; define it to NULL in that case. We will not use it
for anything older than 2.3.27 anyway. */
int i2c_register_entry(struct i2c_client *client, const char *prefix, int i2c_register_entry(struct i2c_client *client, const char *prefix,
ctl_table * ctl_template, ctl_table * ctl_template)
struct module *controlling_mod)
{ {
int i, res, len, id; int i, res, len, id;
ctl_table *new_table; ctl_table *new_table, *client_tbl, *tbl;
char *name; char *name;
struct ctl_table_header *new_header; struct ctl_table_header *new_header;
...@@ -150,26 +145,33 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -150,26 +145,33 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
kfree(name); kfree(name);
return -ENOMEM; return -ENOMEM;
} }
id += 256;
id += 256;
len = 0; len = 0;
while (ctl_template[len].procname) while (ctl_template[len].procname)
len++; len++;
len += 7; if (!(new_table = kmalloc(sizeof(sysctl_table) + sizeof(ctl_table) * (len + 1),
if (!(new_table = kmalloc(sizeof(ctl_table) * len, GFP_KERNEL))) { GFP_KERNEL))) {
kfree(name); kfree(name);
return -ENOMEM; return -ENOMEM;
} }
memcpy(new_table, sysctl_table, 6 * sizeof(ctl_table)); memcpy(new_table, sysctl_table, sizeof(sysctl_table));
new_table[0].child = &new_table[2]; tbl = new_table; /* sys/ */
new_table[2].child = &new_table[4]; tbl = tbl->child = tbl + 2; /* dev/ */
new_table[4].child = &new_table[6]; tbl = tbl->child = tbl + 2; /* sensors/ */
new_table[4].procname = name; client_tbl = tbl->child = tbl + 2; /* XX-chip-YY-ZZ/ */
new_table[4].ctl_name = id;
memcpy(new_table + 6, ctl_template, (len - 6) * sizeof(ctl_table)); client_tbl->procname = name;
for (i = 6; i < len; i++) client_tbl->ctl_name = id;
new_table[i].extra2 = client; client_tbl->child = client_tbl + 2;
/* Next the client sysctls. --km */
tbl = client_tbl->child;
memcpy(tbl, ctl_template, sizeof(ctl_table) * (len+1));
for (i = 0; i < len; i++)
tbl[i].extra2 = client;
if (!(new_header = register_sysctl_table(new_table, 0))) { if (!(new_header = register_sysctl_table(new_table, 0))) {
printk(KERN_ERR "i2c-proc.o: error: sysctl interface not supported by kernel!\n"); printk(KERN_ERR "i2c-proc.o: error: sysctl interface not supported by kernel!\n");
...@@ -178,21 +180,21 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix, ...@@ -178,21 +180,21 @@ int i2c_register_entry(struct i2c_client *client, const char *prefix,
return -EPERM; return -EPERM;
} }
i2c_entries[id - 256] = new_header; i2c_entries[id - 256] = new_header;
i2c_clients[id - 256] = client; i2c_clients[id - 256] = client;
#ifdef DEBUG #ifdef DEBUG
if (!new_header || !new_header->ctl_table || if (!new_header || !new_header->ctl_table ||
!new_header->ctl_table->child || !new_header->ctl_table->child ||
!new_header->ctl_table->child->child || !new_header->ctl_table->child->child ||
!new_header->ctl_table->child->child->de) { !new_header->ctl_table->child->child->de ) {
printk printk
(KERN_ERR "i2c-proc.o: NULL pointer when trying to install fill_inode fix!\n"); (KERN_ERR "i2c-proc.o: NULL pointer when trying to install fill_inode fix!\n");
return id; return id;
} }
#endif /* DEBUG */ #endif /* DEBUG */
new_header->ctl_table->child->child->de->owner = controlling_mod; client_tbl->de->owner = client->driver->owner;
return id; return id;
} }
...@@ -515,7 +517,7 @@ static int i2c_parse_reals(int *nrels, void *buffer, int bufsize, ...@@ -515,7 +517,7 @@ static int i2c_parse_reals(int *nrels, void *buffer, int bufsize,
return 0; return 0;
} }
int i2c_write_reals(int nrels, void *buffer, size_t *bufsize, static int i2c_write_reals(int nrels, void *buffer, size_t *bufsize,
long *results, int magnitude) long *results, int magnitude)
{ {
#define BUFLEN 20 #define BUFLEN 20
......
...@@ -69,8 +69,7 @@ extern int i2c_proc_real(ctl_table * ctl, int write, struct file *filp, ...@@ -69,8 +69,7 @@ extern int i2c_proc_real(ctl_table * ctl, int write, struct file *filp,
these functions must be updated! */ these functions must be updated! */
extern int i2c_register_entry(struct i2c_client *client, extern int i2c_register_entry(struct i2c_client *client,
const char *prefix, const char *prefix,
ctl_table * ctl_template, ctl_table * ctl_template);
struct module *controlling_mod);
extern void i2c_deregister_entry(int id); extern void i2c_deregister_entry(int id);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment