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

John Garry <[email protected]>
Newsgroups org.kernel.vger.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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.