From nobody Tue Nov 26 06:39:21 2024 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.2]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99D0520E33C; Sun, 20 Oct 2024 07:25:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.2 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729409113; cv=none; b=jCgCsgcmVugDKOn5ziJzzjJ+el953UXvwXd7vIBoI22XTGp6/yCgZvf5V9V6pDlfJEJk1kKHDBkO8NSUt6INrqVHbwHcs9wkjAhwrywaTELJT4kflaAPodNMjn+7N09W0oYdk00FbCvAixMEBIk3qQQYppyEuxhXg8SPlvwxZr0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729409113; c=relaxed/simple; bh=RQ7pwXdpp5N3XNDF4l0ZT9DvdsNk+dgT5EPciOu88/8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=el/k79asQbvhnAK0xg2ePtHMRas3a/Ni3CGRf8K1WJUknmXNqVfg1WhwhcZzCs07gxQ2pzhp+shPlG74BmZPqt/ZLbfP56vTqkmsBAFPcAhAu8CXLmeVA7Ue/DX+KBGVkubCiJRQe28LaZg1uI/oD54nwCdJkh3v4KRCnScfcng= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=KrsrX0mT; arc=none smtp.client-ip=117.135.210.2 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="KrsrX0mT" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id:MIME-Version; bh=3Vt9j OKkbk0VwBuWTJOwKr4gbwppQIcJn+UOHdM5dWU=; b=KrsrX0mTqqTFZMULLU0tz 0/py5ZV6AgyTeFxssSdjVbNoUMC2Uunh95VuPVTiy2YqJRWlzbyNcfHcj4kCG2BK FlrjA14LUYMs2Dg3y7wglWQTG9CDqk4p1HSoGpxF1TwBo3tNUOrzREkljFXMtFHd RLpnFlNAeoEqkaDl94/iMw= Received: from localhost.localdomain (unknown [114.253.22.201]) by gzga-smtp-mtada-g1-3 (Coremail) with SMTP id _____wD339lAsBRnRQwEAQ--.29805S2; Sun, 20 Oct 2024 15:24:49 +0800 (CST) From: Dingyan Li <18500469033@163.com> To: stern@rowland.harvard.edu, gregkh@linuxfoundation.org Cc: linux-usb@vger.kernel.org, usb-storage@lists.one-eyed-alien.net, linux-kernel@vger.kernel.org Subject: [PATCH v2] usb: storage: use US_BULK_FLAG_OUT instead of constant values Date: Sun, 20 Oct 2024 15:23:28 +0800 Message-Id: <20241020072328.26401-1-18500469033@163.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <2024102056-yearly-caregiver-d684@gregkh> References: <2024102056-yearly-caregiver-d684@gregkh> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-CM-TRANSID: _____wD339lAsBRnRQwEAQ--.29805S2 X-Coremail-Antispam: 1Uf129KBjvJXoWxZr4DGrWUuFy3tw48WF48JFb_yoWrXr1kpF WDArW5CFyrtF4Fvw15tw4UCFWrAwnYgr9rKF4Iy3s5urnxAFyUGa4qkrZ8Xw1rGr1DZFy2 yw4qqF4jkrWFgrUanT9S1TB71UUUUU7qnTZGkaVYY2UrUUUUjbIjqfuFe4nvWSU5nxnvy2 9KBjDUYxBIdaVFxhVjvjDU0xZFpf9x07jnKsUUUUUU= X-CM-SenderInfo: jprykiiquwmiitt6il2tof0z/1tbiNhV+y2cUnJW+bQAAs- Content-Type: text/plain; charset="utf-8" Macros with good names offer better readability. Signed-off-by: Dingyan Li <18500469033@163.com> --- v1 -> v2: remove contents unrelated to the patch subject. drivers/usb/storage/ene_ub6250.c | 8 ++++---- drivers/usb/storage/realtek_cr.c | 4 ++-- drivers/usb/storage/transport.c | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6= 250.c index a4bfbecbf16c..fd46e81388d2 100644 --- a/drivers/usb/storage/ene_ub6250.c +++ b/drivers/usb/storage/ene_ub6250.c @@ -737,7 +737,7 @@ static int sd_scsi_write(struct us_data *us, struct scs= i_cmnd *srb) memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D blenByte; - bcb->Flags =3D 0x00; + bcb->Flags =3D US_BULK_FLAG_OUT; bcb->CDB[0] =3D 0xF0; bcb->CDB[5] =3D (unsigned char)(bnByte); bcb->CDB[4] =3D (unsigned char)(bnByte>>8); @@ -1163,7 +1163,7 @@ static int ms_read_copyblock(struct us_data *us, u16 = oldphy, u16 newphy, memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D 0x200*len; - bcb->Flags =3D 0x00; + bcb->Flags =3D US_BULK_FLAG_OUT; bcb->CDB[0] =3D 0xF0; bcb->CDB[1] =3D 0x08; bcb->CDB[4] =3D (unsigned char)(oldphy); @@ -1759,7 +1759,7 @@ static int ms_scsi_write(struct us_data *us, struct s= csi_cmnd *srb) memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D blenByte; - bcb->Flags =3D 0x00; + bcb->Flags =3D US_BULK_FLAG_OUT; bcb->CDB[0] =3D 0xF0; bcb->CDB[1] =3D 0x04; bcb->CDB[5] =3D (unsigned char)(bn); @@ -1931,7 +1931,7 @@ static int ene_load_bincode(struct us_data *us, unsig= ned char flag) memset(bcb, 0, sizeof(struct bulk_cb_wrap)); bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D sd_fw->size; - bcb->Flags =3D 0x00; + bcb->Flags =3D US_BULK_FLAG_OUT; bcb->CDB[0] =3D 0xEF; =20 result =3D ene_send_scsi_cmd(us, FDIR_WRITE, buf, 0); diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek= _cr.c index 0c423916d7bf..54ffff86c6fa 100644 --- a/drivers/usb/storage/realtek_cr.c +++ b/drivers/usb/storage/realtek_cr.c @@ -212,7 +212,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8= lun, /* set up the command wrapper */ bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D cpu_to_le32(buf_len); - bcb->Flags =3D (dir =3D=3D DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0; + bcb->Flags =3D (dir =3D=3D DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : US_BULK_F= LAG_OUT; bcb->Tag =3D ++us->tag; bcb->Lun =3D lun; bcb->Length =3D cmd_len; @@ -301,7 +301,7 @@ static int rts51x_bulk_transport_special(struct us_data= *us, u8 lun, /* set up the command wrapper */ bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D cpu_to_le32(buf_len); - bcb->Flags =3D (dir =3D=3D DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0; + bcb->Flags =3D (dir =3D=3D DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : US_BULK_F= LAG_OUT; bcb->Tag =3D ++us->tag; bcb->Lun =3D lun; bcb->Length =3D cmd_len; diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transpor= t.c index 7449e379077a..9d767f6bf722 100644 --- a/drivers/usb/storage/transport.c +++ b/drivers/usb/storage/transport.c @@ -1133,7 +1133,7 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, st= ruct us_data *us) bcb->Signature =3D cpu_to_le32(US_BULK_CB_SIGN); bcb->DataTransferLength =3D cpu_to_le32(transfer_length); bcb->Flags =3D srb->sc_data_direction =3D=3D DMA_FROM_DEVICE ? - US_BULK_FLAG_IN : 0; + US_BULK_FLAG_IN : US_BULK_FLAG_OUT; bcb->Tag =3D ++us->tag; bcb->Lun =3D srb->device->lun; if (us->fflags & US_FL_SCM_MULT_TARG) --=20 2.25.1