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:
Frodo Looijaard committed 1999-09-27 13:20:45 +00:00
1 parent fc20445e02
commit 68a31e3480
18 files changed
+70 -479

No files matched your search

+4 -32
View File
@@ -148,11 +148,7 @@ static ctl_table eeprom_dir_table_template[] = {
/* Used by init/cleanup */
static int __initdata eeprom_initialized = 0;
/* I choose here for semi-static LM78 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_EEPROM_NR 8
static struct i2c_client *eeprom_list[MAX_EEPROM_NR];
static int eeprom_id = 0;
int eeprom_attach_adapter(struct i2c_adapter *adapter)
{
@@ -190,7 +186,7 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
goto ERROR0;
}
data = (struct eeprom_data *) (((struct i2c_client *) new_client) + 1);
data = (struct eeprom_data *) (new_client + 1);
new_client->addr = address;
new_client->data = data;
new_client->adapter = adapter;
@@ -224,18 +220,7 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
/* Fill in the remaining client fields and put it into the global list */
strcpy(new_client->name,client_name);
/* Find a place in our global list */
for (i = 0; i < MAX_EEPROM_NR; i++)
if (! eeprom_list[i])
break;
if (i == MAX_EEPROM_NR) {
err = -ENOMEM;
printk("eeprom.o: No empty slots left, recompile and heighten "
"MAX_EEPROM_NR!\n");
goto ERROR2;
}
eeprom_list[i] = new_client;
new_client->id = i;
new_client->id = eeprom_id++;
data->valid = 0;
init_MUTEX(&data->update_lock);
@@ -259,10 +244,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind)
ERROR4:
i2c_detach_client(new_client);
ERROR3:
for (i = 0; i < MAX_EEPROM_NR; i++)
if (new_client == eeprom_list[i])
eeprom_list[i] = NULL;
ERROR2:
ERROR1:
kfree(new_client);
ERROR0:
@@ -271,7 +252,7 @@ ERROR0:
int eeprom_detach_client(struct i2c_client *client)
{
int err,i;
int err;
sensors_deregister_entry(((struct eeprom_data *)(client->data))->sysctl_id);
@@ -280,15 +261,6 @@ int eeprom_detach_client(struct i2c_client *client)
return err;
}
for (i = 0; i < MAX_EEPROM_NR; i++)
if (client == eeprom_list[i])
break;
if ((i == MAX_EEPROM_NR)) {
printk("eeprom.o: Client to detach not found.\n");
return -ENOENT;
}
eeprom_list[i] = NULL;
kfree(client);
return 0;