Commit 3e76b749 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
Pull hwmon updates from Jean Delvare:
 "This includes a number of driver conversions to
  devm_hwmon_device_register_with_groups, a few cleanups, and
  support for the ITE IT8623E"

* 'hwmon-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  hwmon: (it87) Add support for IT8623E
  hwmon: (it87) Fix IT8603E define name
  hwmon: (lm90) Convert to use hwmon_device_register_with_groups
  hwmon: (lm90) Create all sysfs groups in one call
  hwmon: (lm90) Always use the dev variable in the probe function
  hwmon: (lm90) Create most optional attributes with sysfs_create_group
  hwmon: Avoid initializing the same field twice
  hwmon: (pc87360) Avoid initializing the same field twice
  hwmon: (lm80) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (adm1021) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (lm63) Avoid initializing the same field twice
  hwmon: (lm63) Convert to use devm_hwmon_device_register_with_groups
  hwmon: (lm63) Create all sysfs groups in one call
  hwmon: (lm63) Introduce 'dev' variable to point to client->dev
  hwmon: (lm63) Add additional sysfs group for temp2_type attribute
  hwmon: (f71805f) Fix author's address
parents 19bc2eec 574e9bd8
Loading
Loading
Loading
Loading
+5 −5
Original line number Original line Diff line number Diff line
@@ -2,7 +2,7 @@ Kernel driver it87
==================
==================


Supported chips:
Supported chips:
  * IT8603E
  * IT8603E/IT8623E
    Prefix: 'it8603'
    Prefix: 'it8603'
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Addresses scanned: from Super I/O config space (8 I/O ports)
    Datasheet: Not publicly available
    Datasheet: Not publicly available
@@ -94,9 +94,9 @@ motherboard models.
Description
Description
-----------
-----------


This driver implements support for the IT8603E, IT8705F, IT8712F, IT8716F,
This driver implements support for the IT8603E, IT8623E, IT8705F, IT8712F,
IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8771E, IT8772E,
IT8716F, IT8718F, IT8720F, IT8721F, IT8726F, IT8728F, IT8758E, IT8771E,
IT8782F, IT8783E/F, and SiS950 chips.
IT8772E, IT8782F, IT8783E/F, and SiS950 chips.


These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
These chips are 'Super I/O chips', supporting floppy disks, infrared ports,
joysticks and other miscellaneous stuff. For hardware monitoring, they
joysticks and other miscellaneous stuff. For hardware monitoring, they
@@ -133,7 +133,7 @@ to userspace applications.
The IT8728F, IT8771E, and IT8772E are considered compatible with the IT8721F,
The IT8728F, IT8771E, and IT8772E are considered compatible with the IT8721F,
until a datasheet becomes available (hopefully.)
until a datasheet becomes available (hopefully.)


The IT8603E is a custom design, hardware monitoring part is similar to
The IT8603E/IT8623E is a custom design, hardware monitoring part is similar to
IT8728F. It only supports 16-bit fan mode, the full speed mode of the
IT8728F. It only supports 16-bit fan mode, the full speed mode of the
fan is not supported (value 0 of pwmX_enable).
fan is not supported (value 0 of pwmX_enable).


+22 −48
Original line number Original line Diff line number Diff line
@@ -79,9 +79,11 @@ enum chips {


/* Each client has this additional data */
/* Each client has this additional data */
struct adm1021_data {
struct adm1021_data {
	struct device *hwmon_dev;
	struct i2c_client *client;
	enum chips type;
	enum chips type;


	const struct attribute_group *groups[3];

	struct mutex update_lock;
	struct mutex update_lock;
	char valid;		/* !=0 if following fields are valid */
	char valid;		/* !=0 if following fields are valid */
	char low_power;		/* !=0 if device in low power mode */
	char low_power;		/* !=0 if device in low power mode */
@@ -101,7 +103,6 @@ static int adm1021_probe(struct i2c_client *client,
static int adm1021_detect(struct i2c_client *client,
static int adm1021_detect(struct i2c_client *client,
			  struct i2c_board_info *info);
			  struct i2c_board_info *info);
static void adm1021_init_client(struct i2c_client *client);
static void adm1021_init_client(struct i2c_client *client);
static int adm1021_remove(struct i2c_client *client);
static struct adm1021_data *adm1021_update_device(struct device *dev);
static struct adm1021_data *adm1021_update_device(struct device *dev);


/* (amalysh) read only mode, otherwise any limit's writing confuse BIOS */
/* (amalysh) read only mode, otherwise any limit's writing confuse BIOS */
@@ -128,7 +129,6 @@ static struct i2c_driver adm1021_driver = {
		.name	= "adm1021",
		.name	= "adm1021",
	},
	},
	.probe		= adm1021_probe,
	.probe		= adm1021_probe,
	.remove		= adm1021_remove,
	.id_table	= adm1021_id,
	.id_table	= adm1021_id,
	.detect		= adm1021_detect,
	.detect		= adm1021_detect,
	.address_list	= normal_i2c,
	.address_list	= normal_i2c,
@@ -182,8 +182,8 @@ static ssize_t set_temp_max(struct device *dev,
			    const char *buf, size_t count)
			    const char *buf, size_t count)
{
{
	int index = to_sensor_dev_attr(devattr)->index;
	int index = to_sensor_dev_attr(devattr)->index;
	struct i2c_client *client = to_i2c_client(dev);
	struct adm1021_data *data = dev_get_drvdata(dev);
	struct adm1021_data *data = i2c_get_clientdata(client);
	struct i2c_client *client = data->client;
	long temp;
	long temp;
	int err;
	int err;


@@ -207,8 +207,8 @@ static ssize_t set_temp_min(struct device *dev,
			    const char *buf, size_t count)
			    const char *buf, size_t count)
{
{
	int index = to_sensor_dev_attr(devattr)->index;
	int index = to_sensor_dev_attr(devattr)->index;
	struct i2c_client *client = to_i2c_client(dev);
	struct adm1021_data *data = dev_get_drvdata(dev);
	struct adm1021_data *data = i2c_get_clientdata(client);
	struct i2c_client *client = data->client;
	long temp;
	long temp;
	int err;
	int err;


@@ -238,8 +238,8 @@ static ssize_t set_low_power(struct device *dev,
			     struct device_attribute *devattr,
			     struct device_attribute *devattr,
			     const char *buf, size_t count)
			     const char *buf, size_t count)
{
{
	struct i2c_client *client = to_i2c_client(dev);
	struct adm1021_data *data = dev_get_drvdata(dev);
	struct adm1021_data *data = i2c_get_clientdata(client);
	struct i2c_client *client = data->client;
	char low_power;
	char low_power;
	unsigned long val;
	unsigned long val;
	int err;
	int err;
@@ -412,15 +412,15 @@ static int adm1021_detect(struct i2c_client *client,
static int adm1021_probe(struct i2c_client *client,
static int adm1021_probe(struct i2c_client *client,
			 const struct i2c_device_id *id)
			 const struct i2c_device_id *id)
{
{
	struct device *dev = &client->dev;
	struct adm1021_data *data;
	struct adm1021_data *data;
	int err;
	struct device *hwmon_dev;


	data = devm_kzalloc(&client->dev, sizeof(struct adm1021_data),
	data = devm_kzalloc(dev, sizeof(struct adm1021_data), GFP_KERNEL);
			    GFP_KERNEL);
	if (!data)
	if (!data)
		return -ENOMEM;
		return -ENOMEM;


	i2c_set_clientdata(client, data);
	data->client = client;
	data->type = id->driver_data;
	data->type = id->driver_data;
	mutex_init(&data->update_lock);
	mutex_init(&data->update_lock);


@@ -428,29 +428,14 @@ static int adm1021_probe(struct i2c_client *client,
	if (data->type != lm84 && !read_only)
	if (data->type != lm84 && !read_only)
		adm1021_init_client(client);
		adm1021_init_client(client);


	/* Register sysfs hooks */
	data->groups[0] = &adm1021_group;
	err = sysfs_create_group(&client->dev.kobj, &adm1021_group);
	if (data->type != lm84)
	if (err)
		data->groups[1] = &adm1021_min_group;
		return err;

	if (data->type != lm84) {
		err = sysfs_create_group(&client->dev.kobj, &adm1021_min_group);
		if (err)
			goto error;
	}

	data->hwmon_dev = hwmon_device_register(&client->dev);
	if (IS_ERR(data->hwmon_dev)) {
		err = PTR_ERR(data->hwmon_dev);
		goto error;
	}


	return 0;
	hwmon_dev = devm_hwmon_device_register_with_groups(dev, client->name,
							   data, data->groups);


error:
	return PTR_ERR_OR_ZERO(hwmon_dev);
	sysfs_remove_group(&client->dev.kobj, &adm1021_min_group);
	sysfs_remove_group(&client->dev.kobj, &adm1021_group);
	return err;
}
}


static void adm1021_init_client(struct i2c_client *client)
static void adm1021_init_client(struct i2c_client *client)
@@ -462,21 +447,10 @@ static void adm1021_init_client(struct i2c_client *client)
	i2c_smbus_write_byte_data(client, ADM1021_REG_CONV_RATE_W, 0x04);
	i2c_smbus_write_byte_data(client, ADM1021_REG_CONV_RATE_W, 0x04);
}
}


static int adm1021_remove(struct i2c_client *client)
{
	struct adm1021_data *data = i2c_get_clientdata(client);

	hwmon_device_unregister(data->hwmon_dev);
	sysfs_remove_group(&client->dev.kobj, &adm1021_min_group);
	sysfs_remove_group(&client->dev.kobj, &adm1021_group);

	return 0;
}

static struct adm1021_data *adm1021_update_device(struct device *dev)
static struct adm1021_data *adm1021_update_device(struct device *dev)
{
{
	struct i2c_client *client = to_i2c_client(dev);
	struct adm1021_data *data = dev_get_drvdata(dev);
	struct adm1021_data *data = i2c_get_clientdata(client);
	struct i2c_client *client = data->client;


	mutex_lock(&data->update_lock);
	mutex_lock(&data->update_lock);


@@ -484,7 +458,7 @@ static struct adm1021_data *adm1021_update_device(struct device *dev)
	    || !data->valid) {
	    || !data->valid) {
		int i;
		int i;


		dev_dbg(&client->dev, "Starting adm1021 update\n");
		dev_dbg(dev, "Starting adm1021 update\n");


		for (i = 0; i < 2; i++) {
		for (i = 0; i < 2; i++) {
			data->temp[i] = 1000 *
			data->temp[i] = 1000 *
+0 −1
Original line number Original line Diff line number Diff line
@@ -1115,7 +1115,6 @@ asc7621_probe(struct i2c_client *client, const struct i2c_device_id *id)
		return -ENOMEM;
		return -ENOMEM;


	i2c_set_clientdata(client, data);
	i2c_set_clientdata(client, data);
	data->valid = 0;
	mutex_init(&data->update_lock);
	mutex_init(&data->update_lock);


	/* Initialize the asc7621 chip */
	/* Initialize the asc7621 chip */
+0 −2
Original line number Original line Diff line number Diff line
@@ -353,8 +353,6 @@ static int atxp1_probe(struct i2c_client *new_client,
	data->vrm = vid_which_vrm();
	data->vrm = vid_which_vrm();


	i2c_set_clientdata(new_client, data);
	i2c_set_clientdata(new_client, data);
	data->valid = 0;

	mutex_init(&data->update_lock);
	mutex_init(&data->update_lock);


	/* Register sysfs hooks */
	/* Register sysfs hooks */
+1 −1
Original line number Original line Diff line number Diff line
@@ -1648,7 +1648,7 @@ static void __exit f71805f_exit(void)
	platform_driver_unregister(&f71805f_driver);
	platform_driver_unregister(&f71805f_driver);
}
}


MODULE_AUTHOR("Jean Delvare <khali@linux-fr>");
MODULE_AUTHOR("Jean Delvare <jdelvare@suse.de>");
MODULE_LICENSE("GPL");
MODULE_LICENSE("GPL");
MODULE_DESCRIPTION("F71805F/F71872F hardware monitoring driver");
MODULE_DESCRIPTION("F71805F/F71872F hardware monitoring driver");


Loading