[PATCH 7/7] nvme: Send change uevent when AEN completes

James Smart james.smart at broadcom.com
Tue Jul 11 10:14:20 PDT 2017


On 7/11/2017 7:43 AM, Keith Busch wrote:
> On Mon, Jul 10, 2017 at 04:57:43PM -0700, James Smart wrote:
>> On 7/7/2017 9:23 AM, Keith Busch wrote:
>>> +void nvme_aen_uevent(struct nvme_ctrl *ctrl)
>>> +{
>>> +	char buffer[20]; /* NVME_AEN=0xffffffff\0 */
>>> +	char *envp[2] = {buffer, NULL};
>>> +	u32 aen = ctrl->aen;
>>> +
>>> +	ctrl->aen = 0;
>>> +	if (!aen)
>>> +		return;
>>> +
>>> +	snprintf(buffer, sizeof(buffer), "NVME_AEN=%#08x", aen);
>>> +	kobject_uevent_env(&ctrl->device->kobj, KOBJ_CHANGE, envp);
>>> +}
>>> +
>> Passing on a comment from Christoph received on a similar fc udev event:
>> "Please use kasprintf so that we have a dynamic allocation and don't need to
>> hardcode buffer sizes"
> I agree that usage for dynamic strings is better, but this is a fixed
> sized string that will always be 20 bytes.

My scenario was the same - fixed sized, not dynamic.  Just being the 
messenger for consistency.

-- james



More information about the Linux-nvme mailing list