Skip to contentSkip to conversation

adding OF_DYNAMIC proc interface

DISCUSSION Benjamin Herrenschmidt 2 participants 2 messages Sep 28, 2012 2 messages not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

A message that is not in the archive (sent off-list or not yet received): 1348850798-24352-1-git-send-email-atull-EIB2kfCEclfQT0dZR+AlfA@public.gmane.org

#2 lore raw
Quoted 10 lines · Alan Tull

Hello,

The following patch adds a /proc/ofdt interface to add or remove device tree nodes dynamically.

Based on earlier feedback, I've changed my driver to use /proc instead of creating a new ioctl (the old thread is at
http://www.mail-archive.com/devicetree-discuss-uLR06cmDAlY/[email protected]/msg17333.html)

Quoted 7 lines

I was hoping to get some early feedback from others who might be interested who were discussing this on an earlier thread about OF_DYNAMIC usage.

This code doesn't do any notification for drivers yet. It can add multiple nodes and they will show up properly under /proc/device-tree. It has an issue that shows up when removing nodes (it appears that the memory used by proc gets corrupted after the add).

(Adding Arnd here)

Have you guys considered whether a better approach would be a file system ? IE, create a node by creating a directory, add files for properties etc... ?

It might need some trick to make the node "active" (in order to not internally in the kernel start exposing unfinished nodes), maybe a special file, maybe a permission trick ...

It should be at least considered rather than a new interface that tries to re-implement semantics (such as notification) that are pretty much already provided by a fs.

Also, what about the existing /proc/device-tree ?

Finally, if we are doing something new and for some reason not a fs, what about using sysfs rather than /proc ? Really /proc is not a great idea here.

Cheers,
Ben.

#3 lore raw
Quoted 21 lines · Benjamin Herrenschmidt
Quoted 10 lines · Alan Tull

Hello,

The following patch adds a /proc/ofdt interface to add or remove device tree nodes dynamically.

Based on earlier feedback, I've changed my driver to use /proc instead of creating a new ioctl (the old thread is at
http://www.mail-archive.com/devicetree-discuss-uLR06cmDAlY/[email protected]/msg17333.html)

Quoted 7 lines

I was hoping to get some early feedback from others who might be interested who were discussing this on an earlier thread about OF_DYNAMIC usage.

This code doesn't do any notification for drivers yet. It can add multiple nodes and they will show up properly under /proc/device-tree. It has an issue that shows up when removing nodes (it appears that the memory used by proc gets corrupted after the add).

(Adding Arnd here)

Quoted 7 lines

Have you guys considered whether a better approach would be a file system ? IE, create a node by creating a directory, add files for properties etc... ?

It might need some trick to make the node "active" (in order to not internally in the kernel start exposing unfinished nodes), maybe a special file, maybe a permission trick ...

mkdir automatically creates status="disabled" or similar internally to the kernel?