diff options
-rw-r--r-- | drivers/staging/keucr/scsiglue.c | 16 | ||||
-rw-r--r-- | drivers/staging/keucr/smilmain.c | 46 | ||||
-rw-r--r-- | drivers/staging/keucr/smilsub.c | 19 | ||||
-rw-r--r-- | drivers/staging/keucr/smscsi.c | 32 | ||||
-rw-r--r-- | drivers/staging/keucr/usb.c | 36 |
5 files changed, 99 insertions, 50 deletions
diff --git a/drivers/staging/keucr/scsiglue.c b/drivers/staging/keucr/scsiglue.c index 48e1005..2894ce7 100644 --- a/drivers/staging/keucr/scsiglue.c +++ b/drivers/staging/keucr/scsiglue.c @@ -73,7 +73,8 @@ static int slave_configure(struct scsi_device *sdev) if (us->fflags & US_FL_CAPACITY_HEURISTICS) sdev->guess_capacity = 1; if (sdev->scsi_level > SCSI_2) - sdev->sdev_target->scsi_level = sdev->scsi_level = SCSI_2; + sdev->sdev_target->scsi_level = sdev->scsi_level + = SCSI_2; sdev->retry_hwerror = 1; sdev->allow_restart = 1; sdev->last_sector_bug = 1; @@ -319,8 +320,10 @@ static ssize_t store_max_sectors(struct device *dev, return -EINVAL; } -static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors, store_max_sectors); -static struct device_attribute *sysfs_device_attr_list[] = {&dev_attr_max_sectors, NULL, }; +static DEVICE_ATTR(max_sectors, S_IRUGO | S_IWUSR, show_max_sectors, + store_max_sectors); +static struct device_attribute *sysfs_device_attr_list[] = + {&dev_attr_max_sectors, NULL, }; /* this defines our host template, with which we'll allocate hosts */ @@ -393,8 +396,9 @@ unsigned char usb_stor_sense_invalidCDB[18] = { /* * usb_stor_access_xfer_buf() */ -unsigned int usb_stor_access_xfer_buf(struct us_data *us, unsigned char *buffer, - unsigned int buflen, struct scsi_cmnd *srb, struct scatterlist **sgptr, +unsigned int usb_stor_access_xfer_buf(struct us_data *us, + unsigned char *buffer, unsigned int buflen, + struct scsi_cmnd *srb, struct scatterlist **sgptr, unsigned int *offset, enum xfer_buf_dir dir) { unsigned int cnt; @@ -424,7 +428,7 @@ unsigned int usb_stor_access_xfer_buf(struct us_data *us, unsigned char *buffer, while (sglen > 0) { unsigned int plen = min(sglen, - (unsigned int)PAGE_SIZE - poff); + (unsigned int)PAGE_SIZE - poff); unsigned char *ptr = kmap(page); if (dir == TO_XFER_BUF) diff --git a/drivers/staging/keucr/smilmain.c b/drivers/staging/keucr/smilmain.c index b158447..dd73f88 100644 --- a/drivers/staging/keucr/smilmain.c +++ b/drivers/staging/keucr/smilmain.c @@ -310,7 +310,8 @@ int Media_D_ReadOneSect(struct us_data *us, WORD count, BYTE *buf) err = ErrCode; for (retry = 0; retry < 2; retry++) { - if (Copy_D_BlockAll(us, (err == ERR_EccReadErr) ? REQ_FAIL : REQ_ERASE)) { + if (Copy_D_BlockAll(us, + (err == ERR_EccReadErr) ? REQ_FAIL : REQ_ERASE)) { if (ErrCode == ERR_HwError) return ERROR; continue; @@ -344,7 +345,8 @@ int Copy_D_BlockAll(struct us_data *us, DWORD mode) if (mode == REQ_FAIL) SectCopyMode = REQ_FAIL; - for (Media.Sector = 0; Media.Sector < Ssfdc.MaxSectors; Media.Sector++) { + for (Media.Sector = 0; Media.Sector < Ssfdc.MaxSectors; + Media.Sector++) { if (Copy_D_PhyOneSect(us)) { if (ErrCode == ERR_HwError) return ERROR; @@ -373,7 +375,8 @@ int Assign_D_WriteBlock(void) { ReadBlock = Media.PhyBlock; - for (WriteBlock = AssignStart[Media.Zone]; WriteBlock < Ssfdc.MaxBlocks; WriteBlock++) { + for (WriteBlock = AssignStart[Media.Zone]; + WriteBlock < Ssfdc.MaxBlocks; WriteBlock++) { if (!Chk_D_Bit(Assign[Media.Zone], WriteBlock)) { Set_D_Bit(Assign[Media.Zone], WriteBlock); AssignStart[Media.Zone] = WriteBlock + 1; @@ -383,7 +386,8 @@ int Assign_D_WriteBlock(void) } } - for (WriteBlock = 0; WriteBlock < AssignStart[Media.Zone]; WriteBlock++) { + for (WriteBlock = 0; + WriteBlock < AssignStart[Media.Zone]; WriteBlock++) { if (!Chk_D_Bit(Assign[Media.Zone], WriteBlock)) { Set_D_Bit(Assign[Media.Zone], WriteBlock); AssignStart[Media.Zone] = WriteBlock + 1; @@ -459,7 +463,8 @@ int Copy_D_PhyOneSect(struct us_data *us) for (retry = 0; retry < 2; retry++) { if (retry != 0) { Ssfdc_D_Reset(us); - if (Ssfdc_D_ReadCisSect(us, WorkBuf, WorkRedund)) { + if (Ssfdc_D_ReadCisSect(us, WorkBuf, + WorkRedund)) { ErrCode = ERR_HwError; MediaChange = ERROR; return ERROR; @@ -606,7 +611,9 @@ int Search_D_CIS(struct us_data *us) Media.Zone = 0; Media.Sector = 0; - for (Media.PhyBlock = 0; Media.PhyBlock < (Ssfdc.MaxBlocks - Ssfdc.MaxLogBlocks - 1); Media.PhyBlock++) { + for (Media.PhyBlock = 0; + Media.PhyBlock < (Ssfdc.MaxBlocks - Ssfdc.MaxLogBlocks - 1); + Media.PhyBlock++) { if (Ssfdc_D_ReadRedtData(us, Redundant)) { Ssfdc_D_Reset(us); return ERROR; @@ -658,7 +665,8 @@ int Make_D_LogTable(struct us_data *us) WORD phyblock, logblock; if (Log2Phy[Media.Zone] == NULL) { - Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(WORD), GFP_KERNEL); + Log2Phy[Media.Zone] = kmalloc(MAX_LOGBLOCK * sizeof(WORD), + GFP_KERNEL); /* pr_info("ExAllocatePool Zone = %x, Addr = %x\n", Media.Zone, Log2Phy[Media.Zone]); */ if (Log2Phy[Media.Zone] == NULL) @@ -670,14 +678,18 @@ int Make_D_LogTable(struct us_data *us) { /* pr_info("Make_D_LogTable --- MediaZone = 0x%x\n", Media.Zone); */ - for (Media.LogBlock = 0; Media.LogBlock < Ssfdc.MaxLogBlocks; Media.LogBlock++) + for (Media.LogBlock = 0; Media.LogBlock < Ssfdc.MaxLogBlocks; + Media.LogBlock++) Log2Phy[Media.Zone][Media.LogBlock] = NO_ASSIGN; - for (Media.PhyBlock = 0; Media.PhyBlock < (MAX_BLOCKNUM / 8); Media.PhyBlock++) + for (Media.PhyBlock = 0; Media.PhyBlock < (MAX_BLOCKNUM / 8); + Media.PhyBlock++) Assign[Media.Zone][Media.PhyBlock] = 0x00; - for (Media.PhyBlock = 0; Media.PhyBlock < Ssfdc.MaxBlocks; Media.PhyBlock++) { - if ((!Media.Zone) && (Media.PhyBlock <= CisArea.PhyBlock)) { + for (Media.PhyBlock = 0; Media.PhyBlock < Ssfdc.MaxBlocks; + Media.PhyBlock++) { + if ((!Media.Zone) && + (Media.PhyBlock <= CisArea.PhyBlock)) { Set_D_Bit(Assign[Media.Zone], Media.PhyBlock); continue; } @@ -702,7 +714,8 @@ int Make_D_LogTable(struct us_data *us) continue; if (Log2Phy[Media.Zone][Media.LogBlock] == NO_ASSIGN) { - Log2Phy[Media.Zone][Media.LogBlock] = Media.PhyBlock; + Log2Phy[Media.Zone][Media.LogBlock] = + Media.PhyBlock; continue; } @@ -717,9 +730,11 @@ int Make_D_LogTable(struct us_data *us) if (!Load_D_LogBlockAddr(Redundant)) { if (Media.LogBlock == logblock) { - Media.PhyBlock = Log2Phy[Media.Zone][logblock]; + Media.PhyBlock = + Log2Phy[Media.Zone][logblock]; - if (Ssfdc_D_ReadRedtData(us, Redundant)) { + if (Ssfdc_D_ReadRedtData(us, + Redundant)) { Ssfdc_D_Reset(us); return ERROR; } @@ -759,7 +774,8 @@ int MarkFail_D_PhyOneBlock(struct us_data *us) sect = Media.Sector; Set_D_FailBlock(WorkRedund); - for (Media.Sector = 0; Media.Sector < Ssfdc.MaxSectors; Media.Sector++) { + for (Media.Sector = 0; Media.Sector < Ssfdc.MaxSectors; + Media.Sector++) { if (Ssfdc_D_WriteRedtData(us, WorkRedund)) { Ssfdc_D_Reset(us); Media.Sector = sect; diff --git a/drivers/staging/keucr/smilsub.c b/drivers/staging/keucr/smilsub.c index 8b35d21..b10e8c2 100644 --- a/drivers/staging/keucr/smilsub.c +++ b/drivers/staging/keucr/smilsub.c @@ -103,8 +103,10 @@ int Load_D_LogBlockAddr(BYTE *redundant) { WORD addr1, addr2; - addr1 = (WORD)*(redundant + REDT_ADDR1H)*0x0100 + (WORD)*(redundant + REDT_ADDR1L); - addr2 = (WORD)*(redundant + REDT_ADDR2H)*0x0100 + (WORD)*(redundant + REDT_ADDR2L); + addr1 = (WORD)*(redundant + REDT_ADDR1H)*0x0100 + + (WORD)*(redundant + REDT_ADDR1L); + addr2 = (WORD)*(redundant + REDT_ADDR2H)*0x0100 + + (WORD)*(redundant + REDT_ADDR2L); if (addr1 == addr2) if ((addr1 & 0xF000) == 0x1000) { @@ -151,7 +153,8 @@ void Set_D_LogBlockAddr(BYTE *redundant) if ((hweight16(addr) % 2)) addr++; - *(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) = (BYTE)(addr / 0x0100); + *(redundant + REDT_ADDR1H) = *(redundant + REDT_ADDR2H) = + (BYTE)(addr / 0x0100); *(redundant + REDT_ADDR1L) = *(redundant + REDT_ADDR2L) = (BYTE)addr; } @@ -191,7 +194,9 @@ int Ssfdc_D_ReadCisSect(struct us_data *us, BYTE *buf, BYTE *redundant) Media.Sector = CisArea.Sector; if (Ssfdc_D_ReadSect(us, buf, redundant)) { - Media.Zone = zone; Media.PhyBlock = block; Media.Sector = sector; + Media.Zone = zone; + Media.PhyBlock = block; + Media.Sector = sector; return ERROR; } @@ -252,7 +257,8 @@ int Ssfdc_D_ReadSect(struct us_data *us, BYTE *buf, BYTE *redundant) } /* ----- Ssfdc_D_ReadBlock() --------------------------------------------- */ -int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, BYTE *redundant) +int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, + BYTE *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; @@ -304,7 +310,8 @@ int Ssfdc_D_ReadBlock(struct us_data *us, WORD count, BYTE *buf, BYTE *redundant /* ----- Ssfdc_D_CopyBlock() -------------------------------------------- */ -int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, BYTE *redundant) +int Ssfdc_D_CopyBlock(struct us_data *us, WORD count, BYTE *buf, + BYTE *redundant) { struct bulk_cb_wrap *bcb = (struct bulk_cb_wrap *) us->iobuf; int result; diff --git a/drivers/staging/keucr/smscsi.c b/drivers/staging/keucr/smscsi.c index 58b5555..cda2447 100644 --- a/drivers/staging/keucr/smscsi.c +++ b/drivers/staging/keucr/smscsi.c @@ -56,7 +56,7 @@ int SM_SCSIIrp(struct us_data *us, struct scsi_cmnd *srb) return result; } -/* ----- SM_SCSI_Test_Unit_Ready() -------------------------------------------------- */ +/* ----- SM_SCSI_Test_Unit_Ready() ------------------------------------- */ int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) { if (us->SM_Status.Insert && us->SM_Status.Ready) @@ -69,21 +69,27 @@ int SM_SCSI_Test_Unit_Ready(struct us_data *us, struct scsi_cmnd *srb) return USB_STOR_TRANSPORT_GOOD; } -/* ----- SM_SCSI_Inquiry() -------------------------------------------------- */ +/* ----- SM_SCSI_Inquiry() --------------------------------------------- */ int SM_SCSI_Inquiry(struct us_data *us, struct scsi_cmnd *srb) { - BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20, 0x20, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, 0x61, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, 0x30, 0x31, 0x30, 0x30}; + BYTE data_ptr[36] = {0x00, 0x80, 0x02, 0x00, 0x1F, 0x00, 0x00, 0x00, + 0x55, 0x53, 0x42, 0x32, 0x2E, 0x30, 0x20, + 0x20, 0x43, 0x61, 0x72, 0x64, 0x52, 0x65, + 0x61, 0x64, 0x65, 0x72, 0x20, 0x20, 0x20, + 0x20, 0x20, 0x20, 0x30, 0x31, 0x30, 0x30}; usb_stor_set_xfer_buf(us, data_ptr, 36, srb, TO_XFER_BUF); return USB_STOR_TRANSPORT_GOOD; } -/* ----- SM_SCSI_Mode_Sense() -------------------------------------------------- */ +/* ----- SM_SCSI_Mode_Sense() ------------------------------------------ */ int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) { - BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; - BYTE mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; + BYTE mediaNoWP[12] = {0x0b, 0x00, 0x00, 0x08, 0x00, 0x00, + 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; + BYTE mediaWP[12] = {0x0b, 0x00, 0x80, 0x08, 0x00, 0x00, + 0x71, 0xc0, 0x00, 0x00, 0x02, 0x00}; if (us->SM_Status.WtP) usb_stor_set_xfer_buf(us, mediaWP, 12, srb, TO_XFER_BUF); @@ -94,7 +100,7 @@ int SM_SCSI_Mode_Sense(struct us_data *us, struct scsi_cmnd *srb) return USB_STOR_TRANSPORT_GOOD; } -/* ----- SM_SCSI_Read_Capacity() -------------------------------------------------- */ +/* ----- SM_SCSI_Read_Capacity() --------------------------------------- */ int SM_SCSI_Read_Capacity(struct us_data *us, struct scsi_cmnd *srb) { unsigned int offset = 0; @@ -131,8 +137,10 @@ int SM_SCSI_Read(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; PBYTE Cdb = srb->cmnd; - DWORD bn = ((Cdb[2] << 24) & 0xff000000) | ((Cdb[3] << 16) & 0x00ff0000) | - ((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[5] << 0) & 0x000000ff); + DWORD bn = ((Cdb[2] << 24) & 0xff000000) | + ((Cdb[3] << 16) & 0x00ff0000) | + ((Cdb[4] << 8) & 0x0000ff00) | + ((Cdb[5] << 0) & 0x000000ff); WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); DWORD blenByte = blen * 0x200; void *buf; @@ -161,8 +169,10 @@ int SM_SCSI_Write(struct us_data *us, struct scsi_cmnd *srb) { int result = 0; PBYTE Cdb = srb->cmnd; - DWORD bn = ((Cdb[2] << 24) & 0xff000000) | ((Cdb[3] << 16) & 0x00ff0000) | - ((Cdb[4] << 8) & 0x0000ff00) | ((Cdb[5] << 0) & 0x000000ff); + DWORD bn = ((Cdb[2] << 24) & 0xff000000) | + ((Cdb[3] << 16) & 0x00ff0000) | + ((Cdb[4] << 8) & 0x0000ff00) | + ((Cdb[5] << 0) & 0x000000ff); WORD blen = ((Cdb[7] << 8) & 0xff00) | ((Cdb[8] << 0) & 0x00ff); DWORD blenByte = blen * 0x200; void *buf; diff --git a/drivers/staging/keucr/usb.c b/drivers/staging/keucr/usb.c index db3b080..efadfcf 100644 --- a/drivers/staging/keucr/usb.c +++ b/drivers/staging/keucr/usb.c @@ -124,7 +124,8 @@ static int eucr_post_reset(struct usb_interface *iface) return 0; } -void fill_inquiry_response(struct us_data *us, unsigned char *data, unsigned int data_len) +void fill_inquiry_response(struct us_data *us, unsigned char *data, + unsigned int data_len) { pr_info("usb --- fill_inquiry_response\n"); if (data_len < 36) /* You lose. */ @@ -133,7 +134,8 @@ void fill_inquiry_response(struct us_data *us, unsigned char *data, unsigned int if (data[0]&0x20) { memset(data+8, 0, 28); } else { - u16 bcdDevice = le16_to_cpu(us->pusb_dev->descriptor.bcdDevice); + u16 bcdDevice = + le16_to_cpu(us->pusb_dev->descriptor.bcdDevice); memcpy(data+8, us->unusual_dev->vendorName, strlen(us->unusual_dev->vendorName) > 8 ? 8 : strlen(us->unusual_dev->vendorName)); @@ -194,7 +196,8 @@ static int usb_stor_control_thread(void * __us) us->srb->result = DID_BAD_TARGET << 16; } else if ((us->srb->cmnd[0] == INQUIRY) && (us->fflags & US_FL_FIX_INQUIRY)) { - unsigned char data_ptr[36] = {0x00, 0x80, 0x02, 0x02, 0x1F, 0x00, 0x00, 0x00}; + unsigned char data_ptr[36] = {0x00, 0x80, 0x02, 0x02, + 0x1F, 0x00, 0x00, 0x00}; fill_inquiry_response(us, data_ptr, 36); us->srb->result = SAM_STAT_GOOD; @@ -253,13 +256,15 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) usb_set_intfdata(intf, us); /* Allocate the device-related DMA-mapped buffers */ - us->cr = usb_alloc_coherent(us->pusb_dev, sizeof(*us->cr), GFP_KERNEL, &us->cr_dma); + us->cr = usb_alloc_coherent(us->pusb_dev, sizeof(*us->cr), GFP_KERNEL, + &us->cr_dma); if (!us->cr) { pr_info("usb_ctrlrequest allocation failed\n"); return -ENOMEM; } - us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, GFP_KERNEL, &us->iobuf_dma); + us->iobuf = usb_alloc_coherent(us->pusb_dev, US_IOBUF_SIZE, GFP_KERNEL, + &us->iobuf_dma); if (!us->iobuf) { pr_info("I/O buffer allocation failed\n"); return -ENOMEM; @@ -275,7 +280,8 @@ static int associate_dev(struct us_data *us, struct usb_interface *intf) static int get_device_info(struct us_data *us, const struct usb_device_id *id) { struct usb_device *dev = us->pusb_dev; - struct usb_interface_descriptor *idesc = &us->pusb_intf->cur_altsetting->desc; + struct usb_interface_descriptor *idesc = + &us->pusb_intf->cur_altsetting->desc; pr_info("usb --- get_device_info\n"); @@ -374,10 +380,13 @@ static int get_pipes(struct us_data *us) /* Calculate and store the pipe values */ us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0); us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); - us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); - us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); + us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, + ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); + us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, + ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); if (ep_int) { - us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); + us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, + ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); us->ep_bInterval = ep_int->bInterval; } return 0; @@ -434,9 +443,11 @@ static void dissociate_dev(struct us_data *us) /* Free the device-related DMA-mapped buffers */ if (us->cr) - usb_free_coherent(us->pusb_dev, sizeof(*us->cr), us->cr, us->cr_dma); + usb_free_coherent(us->pusb_dev, sizeof(*us->cr), us->cr, + us->cr_dma); if (us->iobuf) - usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, us->iobuf_dma); + usb_free_coherent(us->pusb_dev, US_IOBUF_SIZE, us->iobuf, + us->iobuf_dma); /* Remove our private data from the interface */ usb_set_intfdata(us->pusb_intf, NULL); @@ -515,7 +526,8 @@ static int usb_stor_scan_thread(void * __us) complete_and_exit(&us->scanning_done, 0); } -static int eucr_probe(struct usb_interface *intf, const struct usb_device_id *id) +static int eucr_probe(struct usb_interface *intf, + const struct usb_device_id *id) { struct Scsi_Host *host; struct us_data *us; |