Skip to content

Commit

Permalink
[PATCH] hwmon: Inline w83792d register access functions
Browse files Browse the repository at this point in the history
Inline w83792d_{read,write}_value for better performance.

Signed-off-by: Jean Delvare <khali@linux-fr.org>
Acked-by: Yuan Mu <Ymu@winbond.com.tw>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
  • Loading branch information
Jean Delvare authored and gregkh committed Feb 6, 2006
1 parent 806ba64 commit 0d0ab7f
Showing 1 changed file with 14 additions and 17 deletions.
31 changes: 14 additions & 17 deletions drivers/hwmon/w83792d.c
Original file line number Diff line number Diff line change
Expand Up @@ -303,10 +303,6 @@ struct w83792d_data {
static int w83792d_attach_adapter(struct i2c_adapter *adapter);
static int w83792d_detect(struct i2c_adapter *adapter, int address, int kind);
static int w83792d_detach_client(struct i2c_client *client);

static int w83792d_read_value(struct i2c_client *client, u8 register);
static int w83792d_write_value(struct i2c_client *client, u8 register,
u8 value);
static struct w83792d_data *w83792d_update_device(struct device *dev);

#ifdef DEBUG
Expand All @@ -329,6 +325,20 @@ static inline long in_count_from_reg(int nr, struct w83792d_data *data)
return ((data->in[nr] << 2) | ((data->low_bits >> (2 * nr)) & 0x03));
}

/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
but the driver only accesses registers in bank 0, so we don't have
to switch banks and lock access between switches. */
static inline int w83792d_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}

static inline int
w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}

/* following are the sysfs callback functions */
static ssize_t show_in(struct device *dev, struct device_attribute *attr,
char *buf)
Expand Down Expand Up @@ -1386,19 +1396,6 @@ w83792d_detach_client(struct i2c_client *client)
return 0;
}

/* The SMBus locks itself. The Winbond W83792D chip has a bank register,
but the driver only accesses registers in bank 0, so we don't have
to switch banks and lock access between switches. */
static int w83792d_read_value(struct i2c_client *client, u8 reg)
{
return i2c_smbus_read_byte_data(client, reg);
}

static int w83792d_write_value(struct i2c_client *client, u8 reg, u8 value)
{
return i2c_smbus_write_byte_data(client, reg, value);
}

static void
w83792d_init_client(struct i2c_client *client)
{
Expand Down

0 comments on commit 0d0ab7f

Please sign in to comment.