strncpy(chipinfo.name, dev_name(&gdev->dev),
sizeof(chipinfo.name));
chipinfo.name[sizeof(chipinfo.name)-1] = '\0';
+ strncpy(chipinfo.label, gdev->label,
+ sizeof(chipinfo.label));
+ chipinfo.label[sizeof(chipinfo.label)-1] = '\0';
chipinfo.lines = gdev->ngpio;
if (copy_to_user(ip, &chipinfo, sizeof(chipinfo)))
return -EFAULT;
status = -EINVAL;
goto err_free_gdev;
}
+
+ if (chip->label)
+ gdev->label = devm_kstrdup(&gdev->dev, chip->label, GFP_KERNEL);
+ else
+ gdev->label = devm_kstrdup(&gdev->dev, "unknown", GFP_KERNEL);
+ if (!gdev->label) {
+ status = -ENOMEM;
+ goto err_free_gdev;
+ }
+
gdev->ngpio = chip->ngpio;
gdev->data = data;
* of the @descs array.
* @base: GPIO base in the DEPRECATED global Linux GPIO numberspace, assigned
* at device creation time.
+ * @label: a descriptive name for the GPIO device, such as the part number
+ * or name of the IP component in a System on Chip.
* @data: per-instance data assigned by the driver
* @list: links gpio_device:s together for traversal
*
struct gpio_desc *descs;
int base;
u16 ngpio;
+ char *label;
void *data;
struct list_head list;
/**
* struct gpio_chip - abstract a GPIO controller
- * @label: for diagnostics
+ * @label: a functional name for the GPIO device, such as a part
+ * number or the name of the SoC IP-block implementing it.
* @gpiodev: the internal state holder, opaque struct
* @parent: optional parent device providing the GPIOs
* @owner: helps prevent removal of modules exporting active GPIOs
/**
* struct gpiochip_info - Information about a certain GPIO chip
* @name: the name of this GPIO chip
+ * @label: a functional name for this GPIO chip
* @lines: number of GPIO lines on this chip
*/
struct gpiochip_info {
char name[32];
+ char label[32];
__u32 lines;
};
goto free_chrdev_name;
}
- fprintf(stdout, "GPIO chip: %s, %u GPIO lines\n",
- cinfo.name, cinfo.lines);
+ fprintf(stdout, "GPIO chip: %s, \"%s\", %u GPIO lines\n",
+ cinfo.name, cinfo.label, cinfo.lines);
if (close(fd) == -1) {
ret = -errno;