Re: [PATCH v5 5/6] scsi: core: Protect host state changes with the host lock

John Garry <[email protected]> Fri, 7 Aug 2026 09:21:47 +0100
Newsgroups gmane.linux.scsi
Organization Oracle Corporation
Message-ID <[email protected]>
On 06/08/2026 18:19, Bart Van Assche wrote:
>>> +int scsi_host_set_state(struct Scsi_Host *shost, enum scsi_host_state 
>>> state)
>>> +    __must_hold(shost->host_lock);
>> 
>> How come we have this in the prototype and not the actual function itself?
> 
> Adding __must_hold() to the function declaration is sufficient. Adding
> __must_hold() to the function definition is optional if it has already
> been added to the function definition.

Understood, but I would have thought that adding it in the actual 
function would be nice as when developers analyze the code, they look at 
the function and not the prototype (and it is nice to know the locking 
state).

Thanks,
John