Re: [PATCH] scsi: alua: Use access state macros

Bart Van Assche <[email protected]>
Newsgroups org.kernel.vger.linux-scsi
Message-ID <[email protected]>
On 8/4/26 4:16 AM, John Garry wrote:
> diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c
> index 80ab0ff921d43..4258c48d93339 100644
> --- a/drivers/scsi/device_handler/scsi_dh_alua.c
> +++ b/drivers/scsi/device_handler/scsi_dh_alua.c
> @@ -693,8 +693,8 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg)
>   				    !(tmp_pg->flags & ALUA_PG_RUNNING)) {
>   					struct alua_dh_data *h;
>   
> -					tmp_pg->state = desc[0] & 0x0f;
> -					tmp_pg->pref = desc[0] >> 7;
> +					tmp_pg->state = desc[0] & SCSI_ACCESS_STATE_MASK;
> +					tmp_pg->pref = desc[0] >> __fls(SCSI_ACCESS_STATE_PREFERRED);
>   					rcu_read_lock();
>   					list_for_each_entry_rcu(h,
>   						&tmp_pg->dh_list, node) {

Please use FIELD_GET() instead of open-coding this macro.

Thanks,

Bart.
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.