ChangeSet 1.1119.1.4, 2003/08/06 15:50:53-07:00, stern@rowland.harvard.edu [PATCH] USB: usb-storage: Move static string out of initializers.h This patch seems to have fallen through the cracks. It takes a string constant defined as a macro in initializers.h and instead makes it a static string in initializers.c. It also subtracts 1 from the sizeof() value to avoid transmitting the terminating NUL. Finally, the patch removes an unnecessary debugging printout -- the value printed is an _output_ buffer, so of course it won't change. drivers/usb/storage/initializers.c | 6 +++--- drivers/usb/storage/initializers.h | 2 -- 2 files changed, 3 insertions(+), 5 deletions(-) diff -Nru a/drivers/usb/storage/initializers.c b/drivers/usb/storage/initializers.c --- a/drivers/usb/storage/initializers.c Fri Aug 8 17:06:08 2003 +++ b/drivers/usb/storage/initializers.c Fri Aug 8 17:06:08 2003 @@ -55,7 +55,6 @@ 0x0C, USB_RECIP_INTERFACE | USB_TYPE_VENDOR, 0x01, 0x0, us->iobuf, 0x1, 5*HZ); US_DEBUGP("-- result is %d\n", result); - US_DEBUGP("-- data afterwards is %d\n", us->iobuf[0]); return 0; } @@ -67,6 +66,7 @@ struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap*) us->iobuf; struct bulk_cs_wrap *bcs = (struct bulk_cs_wrap*) us->iobuf; int res, partial; + static char init_string[] = "\xec\x0a\x06\x00$PCCHIPS"; US_DEBUGP("Sending UCR-61S2B initialization packet...\n"); @@ -74,9 +74,9 @@ bcb->Tag = 0; bcb->DataTransferLength = cpu_to_le32(0); bcb->Flags = bcb->Lun = 0; - bcb->Length = sizeof(UCR61S2B_INIT); + bcb->Length = sizeof(init_string) - 1; memset(bcb->CDB, 0, sizeof(bcb->CDB)); - memcpy(bcb->CDB, UCR61S2B_INIT, sizeof(UCR61S2B_INIT)); + memcpy(bcb->CDB, init_string, sizeof(init_string) - 1); res = usb_stor_bulk_transfer_buf(us, us->send_bulk_pipe, bcb, US_BULK_CB_WRAP_LEN, &partial); diff -Nru a/drivers/usb/storage/initializers.h b/drivers/usb/storage/initializers.h --- a/drivers/usb/storage/initializers.h Fri Aug 8 17:06:08 2003 +++ b/drivers/usb/storage/initializers.h Fri Aug 8 17:06:08 2003 @@ -49,8 +49,6 @@ int sddr09_init(struct us_data *us); #endif -#define UCR61S2B_INIT "\xec\x0a\x06\x00$PCCHIPS" - /* This function is required to activate all four slots on the UCR-61S2B * flash reader */ int usb_stor_ucr61s2b_init(struct us_data *us);