Skip to contentSkip to conversation

kobject_set_name() uses GFP_KERNEL

DISCUSSION Marcel Holtmann 2 participants 2 messages May 5, 2009 – May 6, 2009

lore
Share & tools
lore
#0 lore raw

Hi Kay,

all the users of kobject_set_name() which includes dev_set_name() are allocating their memory for the device name with GFP_KERNEL. It is not a big deal since device_add() does the same. However it is not obvious and I ran into an issue in the Bluetooth stack where I was setting the device name from a context that can't sleep. If this behavior is on purpose, we better add an extra comment in the documentation.

Regards

Marcel

#1 lore raw
Quoted 6 lines · Marcel Holtmann

all the users of kobject_set_name() which includes dev_set_name() are allocating their memory for the device name with GFP_KERNEL. It is not a big deal since device_add() does the same. However it is not obvious and I ran into an issue in the Bluetooth stack where I was setting the device name from a context that can't sleep. If this behavior is on purpose, we better add an extra comment in the documentation.

It's the entire driver core and kobjects which use GFP_KERNEL, so it just "happened" for that function too, I guess.

If it helps to documents that, where should it be added? Maybe you can just send a patch?

Thanks,
Kay