Turn gpiochip into device

Registered by Linus Walleij

The struct gpio_chip currently does not contain a struct device entry, but it should, and gpiochip_add() should use device_register().

The biggest symptom is the sysfs interface which is creating devices on-the-fly just to be able to spawn sysfs entries. Replace the sysfs hooks on-demand creation of devices with referencesto the new struct device in struct gpio_chip.

As a side effect, gpiochip_get() should use try_module_get() on the this new gpiochip device and increase reference count, and all current users doing module_get() on chip->owner should move to using gpiochip_get(), or maybe we should do both (needs to be investigated).

Blueprint information

Status:
Started
Approver:
Deepak Saxena
Priority:
Low
Drafter:
Linus Walleij
Direction:
Needs approval
Assignee:
Linus Walleij
Definition:
Approved
Series goal:
Accepted for kernel-merge-window
Implementation:
Needs Infrastructure
Milestone target:
None
Started by
Linus Walleij

Related branches

Sprints

Whiteboard

Meta:
Roadmap id: KWG-MAINTENANCE
Headline: TODO
Acceptance: TODO

(?)

Work Items

Work items for backlog:
Inspect the userspace sysfs ABI for GPIO, maybe create some test: TODO
Make a patch removing the dummy devices and replace with a real refcounting device: TODO
Test the userspace with the changes: TODO
Iterate until the ABI conforms 100% to the old one: TODO
Submit patch to the linux-kernel mailing list: TODO
Await review: TODO
Iterate patch, collect ACKs: TODO
Await integration upstream: TODO

Dependency tree

* Blueprints in grey have been implemented.

This blueprint contains Public information 
Everyone can see this information.