STRUCT PLATFORM_DEVICE_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ¦‹ struct platform_device_info(9) πŸ¦‹

hii bestie πŸ’– welcome to the Kernel API Manual β€” this page is all about struct platform_device_info, aka the lil parameter bundle that tells the kernel how to build a platform device. no cap, it's giving "paperwork for device creation" but make it iconic.


✨ NAME ✨

struct platform_device_info β€” the set of parameters for creating a platform device. literally the blueprint, bestie πŸŽ€


πŸ’– SYNOPSIS πŸ’–

       struct platform_device_info {
           struct device *parent;
           struct fwnode_handle *fwnode;
           bool of_node_reused;
           const char *name;
           int id;
           const struct resource *res;
           unsigned int num_res;
           const void *data;
           size_t size_data;
           u64 dma_mask;
           const struct software_node *swnode;
           const struct property_entry *properties;
        };

🌸 Members 🌸

okay so here's the whole cast of characters, one by one πŸ‘‘

  • parent β€” the parent device for the new platform device. family tree vibes 🌳
  • fwnode β€” the firmware node associated with the device.
  • of_node_reused β€” says that the device tree node associated with the device is shared with another device, typically its ancestor. Setting this to true prevents the device from being matched via the OF match table, and stops the device core from automatically binding pinctrl configuration to avoid disrupting the other device. very "shared custody" energy, but for device tree nodes πŸ’…
  • name β€” name of the device.
  • id β€” instance ID of the device. Use PLATFORM_DEVID_NONE if there is only one instance of the device, or PLATFORM_DEVID_AUTO to let the kernel automatically assign a unique instance ID. pick your fighter ✨
  • res β€” set of resources to attach to the device.
  • num_res β€” number of entries in res.
  • data β€” device-specific data for this platform device.
  • size_data β€” size of device-specific data.
  • dma_mask β€” DMA mask for the device.
  • swnode β€” a secondary software node to be attached to the device. The node will be automatically registered and its lifetime tied to the platform device if it is not registered yet. automatic registration + tied lifetime? she's independent but attached, we love to see it πŸ¦‹
  • properties β€” a set of software properties for the device. If provided, a managed software node will be automatically created and assigned to the device. The properties array must be terminated with a sentinel entry. Specifying both properties and swnode is not allowed. 🚨
bestie, fr fr: don't try to pass both properties and swnode β€” that combo is not allowed.

πŸ‘‘ Description πŸ‘‘

This structure is used to hold information needed to create and register a platform device using platform_device_register_full. it's the info packet, and platform_device_register_full is the main character doing the actual registration πŸ”₯

platform_device_register_full makes deep copies of name, res, data and properties, so the caller does not need to keep them after registration. meaning you can hand over your stuff and move on, no lingering attachment 😌

If the registration is performed during initialization, these can be marked as __initconst. cute lil optimization for init-time setup, periodt ✨


πŸ”— SEE ALSO πŸ”—

go read those too, bestie, the lore is deep πŸ“šπŸ’œ


mwah πŸ’‹ this adorable page came from ./include/linux, dated October 2026, and it's literally the struct platform_device_info(9) page. bye bestie, slay your platform devices responsibly πŸ«ΆπŸŽ€

πŸ“¦ where this page comes from