From 4acb4daa59b19c1295b35d8fa7e14742f1aa1ef6 Mon Sep 17 00:00:00 2001 From: Loic Guegan Date: Mon, 14 Aug 2023 17:10:40 +0200 Subject: [PATCH] Minor changes --- ina260.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/ina260.c b/ina260.c index 090e168..757af1c 100755 --- a/ina260.c +++ b/ina260.c @@ -17,14 +17,14 @@ #include // INA260 registers -#define INA260_REG_CONFIGURATION 0x00 -#define INA260_REG_CURRENT 0x01 -#define INA260_REG_VOLTAGE 0x02 -#define INA260_REG_POWER 0x03 -#define INA260_REG_MASKENABLE 0x06 -#define INA260_REG_ALERTLIMIT 0x07 -#define INA260_REG_MANUFACTURER 0xFE -#define INA260_REG_DIE 0xFF +#define INA260_REG_CONFIGURATION 0x00 +#define INA260_REG_CURRENT 0x01 +#define INA260_REG_VOLTAGE 0x02 +#define INA260_REG_POWER 0x03 +#define INA260_REG_MASKENABLE 0x06 +#define INA260_REG_ALERTLIMIT 0x07 +#define INA260_REG_MANUFACTURER 0xFE +#define INA260_REG_DIE 0xFF static struct regmap_config ina260_regmap_config = { .max_register = INA260_REG_DIE, @@ -41,7 +41,7 @@ static ssize_t _attr##_show(struct device *dev, struct device_attribute *attr, c err = regmap_read(cdata->regmap, (_reg), &rvalue); \ if(err>0) \ return err; \ - return sprintf(buf, "%x\n", rvalue); \ + return sprintf(buf, "0x%x\n", rvalue); \ } #define INA260_REG_STORE(_attr,_reg) \ @@ -57,18 +57,6 @@ static ssize_t _attr##_store(struct device *dev, struct device_attribute *attr, return count; \ } -/** - * @brief This macro is not available on old kernel especially the one - * used by Beaglebones Single Board Computers - */ -#define HWMON_CHANNEL_INFO(stype, ...) \ - (&(struct hwmon_channel_info) { \ - .type = hwmon_##stype, \ - .config = (u32 []) { \ - __VA_ARGS__, 0 \ - } \ - }) - /** * @brief Embedded user data */