mirror of
https://gitlab.com/manzerbredes/ina260-sysfs-driver.git
synced 2025-04-19 04:09:45 +00:00
Minor changes
This commit is contained in:
parent
2223403c81
commit
88e8a7b7f6
1 changed files with 10 additions and 8 deletions
18
ina260.c
18
ina260.c
|
@ -67,7 +67,7 @@ struct client_data {
|
|||
};
|
||||
|
||||
static int ina260_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
|
||||
u32 attr, int channel, long *val)
|
||||
u32 attr, int channel, long *val)
|
||||
{
|
||||
int rvalue, reg, err;
|
||||
struct client_data *cdata = dev_get_drvdata(dev);
|
||||
|
@ -96,7 +96,7 @@ static int ina260_hwmon_read(struct device *dev, enum hwmon_sensor_types type,
|
|||
}
|
||||
|
||||
static int ina260_hwmon_write(struct device *dev, enum hwmon_sensor_types type,
|
||||
u32 attr, int channel, long val)
|
||||
u32 attr, int channel, long val)
|
||||
{
|
||||
return -EOPNOTSUPP;
|
||||
}
|
||||
|
@ -118,7 +118,7 @@ INA260_REG_STORE(mask_enable, INA260_REG_MASKENABLE)
|
|||
INA260_REG_STORE(alert_limit, INA260_REG_ALERTLIMIT)
|
||||
|
||||
static umode_t ina260_hwmon_is_visible(const void *drvdata,
|
||||
enum hwmon_sensor_types type, u32 attr, int channel)
|
||||
enum hwmon_sensor_types type, u32 attr, int channel)
|
||||
{
|
||||
return 0444;
|
||||
}
|
||||
|
@ -161,6 +161,7 @@ static struct attribute *registers_attrs[] = {
|
|||
&dev_attr_die_id.attr,
|
||||
NULL,
|
||||
};
|
||||
|
||||
static const struct attribute_group registers_group = {
|
||||
.attrs = registers_attrs,
|
||||
.name = "registers"
|
||||
|
@ -177,14 +178,14 @@ static int ina260_probe_new(struct i2c_client *client)
|
|||
struct device *hwmon_dev;
|
||||
|
||||
// Initialize client data:
|
||||
printk(KERN_INFO "Adding ina260 [bus=%d address=0x%02x]\n",
|
||||
client->adapter->nr, client->addr);
|
||||
p = kzalloc(sizeof(struct client_data), GFP_KERNEL);
|
||||
dev_dbg("Adding ina260 [bus=%d address=0x%02x]\n",
|
||||
client->adapter->nr, client->addr);
|
||||
p = kzalloc(sizeof(client_data), GFP_KERNEL);
|
||||
p->client = client;
|
||||
p->regmap = devm_regmap_init_i2c(client, &ina260_regmap_config);
|
||||
|
||||
hwmon_dev = hwmon_device_register_with_info(&client->dev, client->name, p,
|
||||
&ina260_chip_info, extra_groups);
|
||||
&ina260_chip_info, extra_groups);
|
||||
if (IS_ERR(hwmon_dev))
|
||||
return PTR_ERR(hwmon_dev);
|
||||
return 0;
|
||||
|
@ -196,7 +197,8 @@ static void ina260_remove(struct i2c_client *client)
|
|||
|
||||
kfree(p);
|
||||
hwmon_device_unregister(&client->dev);
|
||||
printk(KERN_INFO "Removing ina260 [bus=%d address=0x%02x]\n", client->adapter->nr, client->addr);
|
||||
dev_dbg("Removing ina260 [bus=%d address=0x%02x]\n",
|
||||
client->adapter->nr, client->addr);
|
||||
}
|
||||
|
||||
static const struct i2c_device_id ina260_ids[] = {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue