hwmon: (occ) Replace open-coded variant of %*phN specifier

printf()-like functions in the kernel have extensions, such as
%*phN to dump small pieces of memory as hex bytes.

Replace custom approach with the direct use of %*phN.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20220726143110.4809-1-andriy.shevchenko@linux.intel.com
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
This commit is contained in:
Andy Shevchenko 2022-07-26 17:31:10 +03:00 committed by Guenter Roeck
parent 7d4edccc9b
commit 03009a605f

View File

@ -729,18 +729,14 @@ static ssize_t occ_show_extended(struct device *dev,
rc = sysfs_emit(buf, "%u",
get_unaligned_be32(&extn->sensor_id));
} else {
rc = sysfs_emit(buf, "%02x%02x%02x%02x\n",
extn->name[0], extn->name[1],
extn->name[2], extn->name[3]);
rc = sysfs_emit(buf, "%4phN\n", extn->name);
}
break;
case 1:
rc = sysfs_emit(buf, "%02x\n", extn->flags);
break;
case 2:
rc = sysfs_emit(buf, "%02x%02x%02x%02x%02x%02x\n",
extn->data[0], extn->data[1], extn->data[2],
extn->data[3], extn->data[4], extn->data[5]);
rc = sysfs_emit(buf, "%6phN\n", extn->data);
break;
default:
return -EINVAL;