X-Git-Url: http://git.rot13.org/?a=blobdiff_plain;f=drivers%2Fhwmon%2Flm77.c;h=df9e02aaa70a98703290d079e5b61f1a7b8acbf2;hb=ff607748590fba14aecedb0d50edc4ada98d4302;hp=866eab96a6f6f6594374037bda6eeb08c5a39c1a;hpb=4706df3d3c42af802597d82c8b1542c3d52eab23;p=powerpc.git diff --git a/drivers/hwmon/lm77.c b/drivers/hwmon/lm77.c index 866eab96a6..df9e02aaa7 100644 --- a/drivers/hwmon/lm77.c +++ b/drivers/hwmon/lm77.c @@ -74,9 +74,9 @@ static struct lm77_data *lm77_update_device(struct device *dev); /* This is the driver that will be inserted */ static struct i2c_driver lm77_driver = { - .owner = THIS_MODULE, - .name = "lm77", - .flags = I2C_DF_NOTIFY, + .driver = { + .name = "lm77", + }, .attach_adapter = lm77_attach_adapter, .detach_client = lm77_detach_client, }; @@ -87,15 +87,15 @@ static struct i2c_driver lm77_driver = { /* In the temperature registers, the low 3 bits are not part of the temperature values; they are the status bits. */ -static inline u16 LM77_TEMP_TO_REG(int temp) +static inline s16 LM77_TEMP_TO_REG(int temp) { int ntemp = SENSORS_LIMIT(temp, LM77_TEMP_MIN, LM77_TEMP_MAX); - return (u16)((ntemp / 500) * 8); + return (ntemp / 500) * 8; } -static inline int LM77_TEMP_FROM_REG(u16 reg) +static inline int LM77_TEMP_FROM_REG(s16 reg) { - return ((int)reg / 8) * 500; + return (reg / 8) * 500; } /* sysfs stuff */ @@ -226,11 +226,10 @@ static int lm77_detect(struct i2c_adapter *adapter, int address, int kind) /* OK. For now, we presume we have a valid client. We now create the client structure, even though we cannot fill it completely yet. But it allows us to access lm77_{read,write}_value. */ - if (!(data = kmalloc(sizeof(struct lm77_data), GFP_KERNEL))) { + if (!(data = kzalloc(sizeof(struct lm77_data), GFP_KERNEL))) { err = -ENOMEM; goto exit; } - memset(data, 0, sizeof(struct lm77_data)); new_client = &data->client; i2c_set_clientdata(new_client, data);