@@ -682,7 +682,7 @@ int platform_device_add(struct platform_device *pdev)
if (ret < 0)
return ret;
pdev->id = ret;
- pdev->id_auto = true;
+ pdev->flags |= PLATFORM_DEVICE_FLAG_ID_AUTO;
dev_set_name(dev, "%s.%d.auto", pdev->name, pdev->id);
break;
}
@@ -720,7 +720,7 @@ int platform_device_add(struct platform_device *pdev)
return 0;
failed:
- if (pdev->id_auto) {
+ if (pdev->flags & PLATFORM_DEVICE_FLAG_ID_AUTO) {
ida_free(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
@@ -750,7 +750,7 @@ void platform_device_del(struct platform_device *pdev)
if (!IS_ERR_OR_NULL(pdev)) {
device_del(&pdev->dev);
- if (pdev->id_auto) {
+ if (pdev->flags & PLATFORM_DEVICE_FLAG_ID_AUTO) {
ida_free(&platform_devid_ida, pdev->id);
pdev->id = PLATFORM_DEVID_AUTO;
}
@@ -23,7 +23,8 @@ struct platform_device_id;
struct platform_device {
const char *name;
int id;
- bool id_auto;
+ u8 flags;
+#define PLATFORM_DEVICE_FLAG_ID_AUTO BIT(0)
struct device dev;
u64 platform_dma_mask;
struct device_dma_parameters dma_parms;
struct platform_device->id_auto is the only boolean stored inside the structure. Remove it and add an u8 flags field. The goal is to allow more flags (without using more memory). Cc: <stable@vger.kernel.org> Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com> --- drivers/base/platform.c | 6 +++--- include/linux/platform_device.h | 3 ++- 2 files changed, 5 insertions(+), 4 deletions(-)