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
45e16466b1
commit
c66f086e89
1 changed files with 80 additions and 74 deletions
18
ina260.c
18
ina260.c
|
@ -45,7 +45,8 @@ static ssize_t _attr##_show(struct device *dev, struct device_attribute *attr, c
|
|||
}
|
||||
|
||||
#define INA260_REG_STORE(_attr, _reg) \
|
||||
static ssize_t _attr##_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count) \
|
||||
static ssize_t _attr##_store(struct device *dev, struct device_attribute *attr, \
|
||||
const char *buf, size_t count) \
|
||||
{ \
|
||||
int uvalue, err; \
|
||||
struct client_data *cdata = dev_get_drvdata(dev); \
|
||||
|
@ -118,7 +119,8 @@ 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){
|
||||
u32 attr, int channel)
|
||||
{
|
||||
return 0444;
|
||||
}
|
||||
static const struct hwmon_channel_info *ina260_hwmon_info[] = {
|
||||
|
@ -167,7 +169,8 @@ const struct attribute_group *extra_groups[] = {
|
|||
NULL
|
||||
};
|
||||
|
||||
static int ina260_probe_new(struct i2c_client *client){
|
||||
static int ina260_probe_new(struct i2c_client *client)
|
||||
{
|
||||
struct client_data *p;
|
||||
struct device *hwmon_dev;
|
||||
|
||||
|
@ -184,7 +187,8 @@ static int ina260_probe_new(struct i2c_client *client){
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void ina260_remove(struct i2c_client *client){
|
||||
static void ina260_remove(struct i2c_client *client)
|
||||
{
|
||||
struct client_data *p = i2c_get_clientdata(client);
|
||||
kfree(p);
|
||||
hwmon_device_unregister(&client->dev);
|
||||
|
@ -207,12 +211,14 @@ static struct i2c_driver ina260_driver = {
|
|||
.id_table = ina260_ids
|
||||
};
|
||||
|
||||
static int __init ina260_init(void){
|
||||
static int __init ina260_init(void)
|
||||
{
|
||||
i2c_add_driver(&ina260_driver);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void __exit ina260_exit(void){
|
||||
static void __exit ina260_exit(void)
|
||||
{
|
||||
i2c_del_driver(&ina260_driver);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue