mirror of
https://github.com/lm-sensors/lm-sensors.git
synced 2026-12-04 21:58:18 +00:00
Some code cleanups
* Removed several superfluous (struct i2c_client *) casts (they were left from the time we had separate structs for smbus and isa) * Removed the internal lists of registered clients They have not been used for quite some time now, took memory space, and limited the maximum number of clients that could be registered. Also removed two small Makefile errors - I am happy I caught them before the next release! git-svn-id: http://lm-sensors.org/svn/lm-sensors/trunk@582 7894878c-1315-0410-8ee3-d5d059ff63e0
This commit is contained in:
1 parent
fc20445e02
commit
68a31e3480
18 files changed
+70
-479
No files matched your search
+2
-29
@@ -118,13 +118,7 @@ static u8 tempdata[MAXBLOCK_SIZE];
|
||||
/* Used by init/cleanup */
|
||||
static int __initdata icspll_initialized = 0;
|
||||
|
||||
/* I choose here for semi-static allocation. Complete dynamic
|
||||
allocation could also be used; the code needed for this would probably
|
||||
take more memory than the datastructure takes now. */
|
||||
#define MAX_ICSPLL_NR 2
|
||||
static struct i2c_client *icspll_list[MAX_ICSPLL_NR];
|
||||
|
||||
|
||||
static int icspll_id = 0;
|
||||
int icspll_attach_adapter(struct i2c_adapter *adapter)
|
||||
{
|
||||
int address,err,i;
|
||||
@@ -166,22 +160,10 @@ int icspll_attach_adapter(struct i2c_adapter *adapter)
|
||||
continue;
|
||||
}
|
||||
|
||||
/* Find a place in our global list */
|
||||
for (i = 0; i < MAX_ICSPLL_NR; i++)
|
||||
if (! icspll_list[i])
|
||||
break;
|
||||
if (i == MAX_ICSPLL_NR) {
|
||||
err = -ENOMEM;
|
||||
printk("icspll.o: No empty slots left, recompile and heighten "
|
||||
"MAX_ICSPLL_NR!\n");
|
||||
goto ERROR1;
|
||||
}
|
||||
icspll_list[i] = new_client;
|
||||
|
||||
/* Fill the new client structure with data */
|
||||
data = (struct icspll_data *) (new_client + 1);
|
||||
new_client->data = data;
|
||||
new_client->id = i;
|
||||
new_client->id = icspll_id++;
|
||||
new_client->addr = address;
|
||||
new_client->adapter = adapter;
|
||||
new_client->driver = &icspll_driver;
|
||||
@@ -211,7 +193,6 @@ int icspll_attach_adapter(struct i2c_adapter *adapter)
|
||||
ERROR3:
|
||||
i2c_detach_client(new_client);
|
||||
ERROR2:
|
||||
icspll_list[i] = NULL;
|
||||
ERROR1:
|
||||
kfree(new_client);
|
||||
}
|
||||
@@ -221,13 +202,6 @@ ERROR1:
|
||||
int icspll_detach_client(struct i2c_client *client)
|
||||
{
|
||||
int err,i;
|
||||
for (i = 0; i < MAX_ICSPLL_NR; i++)
|
||||
if (client == icspll_list[i])
|
||||
break;
|
||||
if ((i == MAX_ICSPLL_NR)) {
|
||||
printk("icspll.o: Client to detach not found.\n");
|
||||
return -ENOENT;
|
||||
}
|
||||
|
||||
sensors_deregister_entry(((struct icspll_data *)(client->data))->sysctl_id);
|
||||
|
||||
@@ -236,7 +210,6 @@ int icspll_detach_client(struct i2c_client *client)
|
||||
return err;
|
||||
}
|
||||
|
||||
icspll_list[i] = NULL;
|
||||
kfree(client);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user