aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/rts_pstor
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 12:49:28 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-23 12:49:28 -0700
commit1f3a8e093f470ef193b0ca6011d90180331c8b53 (patch)
tree66b7a58decabdc7f76ffb102899881c258c1df59 /drivers/staging/rts_pstor
parentc44dead70a841d90ddc01968012f323c33217c9e (diff)
parent1a4b6f66285785ddccef049e6b45be4e7c7a2189 (diff)
downloadkernel_samsung_smdk4412-1f3a8e093f470ef193b0ca6011d90180331c8b53.zip
kernel_samsung_smdk4412-1f3a8e093f470ef193b0ca6011d90180331c8b53.tar.gz
kernel_samsung_smdk4412-1f3a8e093f470ef193b0ca6011d90180331c8b53.tar.bz2
Merge branch 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6
* 'staging-next' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging-2.6: (970 commits) staging: usbip: replace usbip_u{dbg,err,info} and printk with dev_ and pr_ staging:iio: Trivial kconfig reorganization and uniformity improvements. staging:iio:documenation partial update. staging:iio: use pollfunc allocation helpers in remaining drivers. staging:iio:max1363 misc cleanups and use of for_each_bit_set to simplify event code spitting out. staging:iio: implement an iio_info structure to take some of the constant elements out of iio_dev. staging:iio:meter:ade7758: Use private data space from iio_allocate_device staging:iio:accel:lis3l02dq make write_reg_8 take value not a pointer to value. staging:iio: ring core cleanups + check if read_last available in lis3l02dq staging:iio:core cleanup: squash tiny wrappers and use dev_set_name to handle creation of event interface name. staging:iio: poll func allocation clean up. staging:iio:ad7780 trivial unused header cleanup. staging:iio:adc: AD7780: Use private data space from iio_allocate_device + trivial fixes staging:iio:adc:AD7780: Convert to new channel registration method staging:iio:adc: AD7606: Drop dev_data in favour of iio_priv() staging:iio:adc: AD7606: Consitently use indio_dev staging:iio: Rip out helper for software rings. staging:iio:adc:AD7298: Use private data space from iio_allocate_device staging:iio: rationalization of different buffer implementation hooks. staging:iio:imu:adis16400 avoid allocating rx, tx, and state separately from iio_dev. ... Fix up trivial conflicts in - drivers/staging/intel_sst/intelmid.c: patches applied in both branches - drivers/staging/rt2860/common/cmm_data_{pci,usb}.c: removed vs spelling - drivers/staging/usbip/vhci_sysfs.c: trivial header file inclusion
Diffstat (limited to 'drivers/staging/rts_pstor')
-rw-r--r--drivers/staging/rts_pstor/ms.c52
-rw-r--r--drivers/staging/rts_pstor/rtsx.c4
-rw-r--r--drivers/staging/rts_pstor/rtsx.h3
-rw-r--r--drivers/staging/rts_pstor/sd.c1
-rw-r--r--drivers/staging/rts_pstor/spi.c34
-rw-r--r--drivers/staging/rts_pstor/xd.c4
6 files changed, 46 insertions, 52 deletions
diff --git a/drivers/staging/rts_pstor/ms.c b/drivers/staging/rts_pstor/ms.c
index d89795c..2e82587 100644
--- a/drivers/staging/rts_pstor/ms.c
+++ b/drivers/staging/rts_pstor/ms.c
@@ -864,7 +864,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
- buf = (u8 *)rtsx_alloc_dma_buf(chip, 64 * 512, GFP_KERNEL);
+ buf = kmalloc(64 * 512, GFP_KERNEL);
if (buf == NULL) {
TRACE_RET(chip, STATUS_ERROR);
}
@@ -876,11 +876,11 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
retval = rtsx_read_register(chip, MS_TRANS_CFG, &val);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (!(val & MS_INT_BREQ)) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
retval = ms_transfer_data(chip, MS_TM_AUTO_READ, PRO_READ_LONG_DATA,
@@ -892,7 +892,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
}
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -900,7 +900,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
do {
retval = rtsx_read_register(chip, MS_TRANS_CFG, &val);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -909,7 +909,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
retval = ms_transfer_tpc(chip, MS_TM_NORMAL_READ, PRO_READ_LONG_DATA, 0, WAIT_INT);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -917,18 +917,18 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
} while (i < 1024);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((buf[0] != 0xa5) && (buf[1] != 0xc3)) {
/* Signature code is wrong */
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((buf[4] < 1) || (buf[4] > 12)) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -950,15 +950,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
RTSX_DEBUGP("sys_info_addr = 0x%x, sys_info_size = 0x%x\n",
sys_info_addr, sys_info_size);
if (sys_info_size != 96) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (sys_info_addr < 0x1A0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((sys_info_size + sys_info_addr) > 0x8000) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -984,15 +984,15 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
RTSX_DEBUGP("model_name_addr = 0x%x, model_name_size = 0x%x\n",
model_name_addr, model_name_size);
if (model_name_size != 48) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if (model_name_addr < 0x1A0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
if ((model_name_size + model_name_addr) > 0x8000) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -1005,7 +1005,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
}
if (i == buf[4]) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -1042,7 +1042,7 @@ static int ms_read_attribute_info(struct rtsx_chip *chip)
memcpy(ms_card->raw_model_name, buf + model_name_addr, 48);
#endif
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
#ifdef SUPPORT_MSXC
if (CHK_MSXC(ms_card)) {
@@ -3784,7 +3784,7 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
- buf = (u8 *)rtsx_alloc_dma_buf(chip, 1540, GFP_KERNEL);
+ buf = kmalloc(1540, GFP_KERNEL);
if (!buf) {
TRACE_RET(chip, STATUS_ERROR);
}
@@ -3817,9 +3817,7 @@ int mg_get_local_EKB(struct scsi_cmnd *srb, struct rtsx_chip *chip)
rtsx_stor_set_xfer_buf(buf, bufflen, srb);
GetEKBFinish:
- if (buf) {
- rtsx_free_dma_buf(chip, buf);
- }
+ kfree(buf);
return retval;
}
@@ -4022,7 +4020,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
- buf = (u8 *)rtsx_alloc_dma_buf(chip, 1028, GFP_KERNEL);
+ buf = kmalloc(1028, GFP_KERNEL);
if (!buf) {
TRACE_RET(chip, STATUS_ERROR);
}
@@ -4055,9 +4053,7 @@ int mg_get_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)
rtsx_stor_set_xfer_buf(buf, bufflen, srb);
GetICVFinish:
- if (buf) {
- rtsx_free_dma_buf(chip, buf);
- }
+ kfree(buf);
return retval;
}
@@ -4081,7 +4077,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
- buf = (u8 *)rtsx_alloc_dma_buf(chip, 1028, GFP_KERNEL);
+ buf = kmalloc(1028, GFP_KERNEL);
if (!buf) {
TRACE_RET(chip, STATUS_ERROR);
}
@@ -4156,9 +4152,7 @@ int mg_set_ICV(struct scsi_cmnd *srb, struct rtsx_chip *chip)
#endif
SetICVFinish:
- if (buf) {
- rtsx_free_dma_buf(chip, buf);
- }
+ kfree(buf);
return retval;
}
diff --git a/drivers/staging/rts_pstor/rtsx.c b/drivers/staging/rts_pstor/rtsx.c
index 02525d5..5ff59f2 100644
--- a/drivers/staging/rts_pstor/rtsx.c
+++ b/drivers/staging/rts_pstor/rtsx.c
@@ -594,7 +594,9 @@ static int rtsx_polling_thread(void *__dev)
wait_timeout((delay_use + 5) * 1000);
for (;;) {
- wait_timeout(POLLING_INTERVAL);
+
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(POLLING_INTERVAL);
/* lock the device pointers */
mutex_lock(&(dev->dev_mutex));
diff --git a/drivers/staging/rts_pstor/rtsx.h b/drivers/staging/rts_pstor/rtsx.h
index 4d5ddf6..6afb635 100644
--- a/drivers/staging/rts_pstor/rtsx.h
+++ b/drivers/staging/rts_pstor/rtsx.h
@@ -98,9 +98,6 @@ do { \
#define SCSI_LUN(srb) ((srb)->device->lun)
-#define rtsx_alloc_dma_buf(chip, size, flag) kmalloc((size), (flag))
-#define rtsx_free_dma_buf(chip, ptr) kfree((ptr))
-
typedef unsigned long DELAY_PARA_T;
struct rtsx_chip;
diff --git a/drivers/staging/rts_pstor/sd.c b/drivers/staging/rts_pstor/sd.c
index b1277a6..bddb031 100644
--- a/drivers/staging/rts_pstor/sd.c
+++ b/drivers/staging/rts_pstor/sd.c
@@ -2227,6 +2227,7 @@ static int sd_read_lba0(struct rtsx_chip *chip)
retval = sd_read_data(chip, SD_TM_NORMAL_READ, cmd,
5, 512, 1, bus_width, NULL, 0, 100);
if (retval != STATUS_SUCCESS) {
+ rtsx_clear_sd_error(chip);
TRACE_RET(chip, STATUS_FAIL);
}
diff --git a/drivers/staging/rts_pstor/spi.c b/drivers/staging/rts_pstor/spi.c
index 8a8689b..c803ba6 100644
--- a/drivers/staging/rts_pstor/spi.c
+++ b/drivers/staging/rts_pstor/spi.c
@@ -505,7 +505,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
TRACE_RET(chip, STATUS_FAIL);
}
- buf = (u8 *)rtsx_alloc_dma_buf(chip, SF_PAGE_LEN, GFP_KERNEL);
+ buf = kmalloc(SF_PAGE_LEN, GFP_KERNEL);
if (buf == NULL)
TRACE_RET(chip, STATUS_ERROR);
@@ -543,7 +543,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = rtsx_transfer_data(chip, 0, buf, pagelen, 0, DMA_FROM_DEVICE, 10000);
if (retval < 0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
@@ -556,7 +556,7 @@ int spi_read_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
scsi_set_resid(srb, 0);
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
return STATUS_SUCCESS;
}
@@ -584,14 +584,14 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
}
if (program_mode == BYTE_PROGRAM) {
- buf = rtsx_alloc_dma_buf(chip, 4, GFP_KERNEL);
+ buf = kmalloc(4, GFP_KERNEL);
if (!buf)
TRACE_RET(chip, STATUS_ERROR);
while (len) {
retval = sf_enable_write(chip, SPI_WREN);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -605,7 +605,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = rtsx_send_cmd(chip, 0, 100);
if (retval < 0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
@@ -613,7 +613,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -621,7 +621,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len--;
}
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
} else if (program_mode == AAI_PROGRAM) {
int first_byte = 1;
@@ -630,7 +630,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS)
TRACE_RET(chip, STATUS_FAIL);
- buf = rtsx_alloc_dma_buf(chip, 4, GFP_KERNEL);
+ buf = kmalloc(4, GFP_KERNEL);
if (!buf)
TRACE_RET(chip, STATUS_ERROR);
@@ -650,7 +650,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = rtsx_send_cmd(chip, 0, 100);
if (retval < 0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
@@ -658,14 +658,14 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
len--;
}
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
retval = sf_disable_write(chip, SPI_WRDI);
if (retval != STATUS_SUCCESS)
@@ -675,7 +675,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
if (retval != STATUS_SUCCESS)
TRACE_RET(chip, STATUS_FAIL);
} else if (program_mode == PAGE_PROGRAM) {
- buf = rtsx_alloc_dma_buf(chip, SF_PAGE_LEN, GFP_KERNEL);
+ buf = kmalloc(SF_PAGE_LEN, GFP_KERNEL);
if (!buf)
TRACE_RET(chip, STATUS_NOMEM);
@@ -687,7 +687,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = sf_enable_write(chip, SPI_WREN);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -702,7 +702,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = rtsx_transfer_data(chip, 0, buf, pagelen, 0, DMA_TO_DEVICE, 100);
if (retval < 0) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
rtsx_clear_spi_error(chip);
spi_set_err_code(chip, SPI_HW_ERR);
TRACE_RET(chip, STATUS_FAIL);
@@ -710,7 +710,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
retval = sf_polling_status(chip, 100);
if (retval != STATUS_SUCCESS) {
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
TRACE_RET(chip, STATUS_FAIL);
}
@@ -718,7 +718,7 @@ int spi_write_flash(struct scsi_cmnd *srb, struct rtsx_chip *chip)
len -= pagelen;
}
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
} else {
spi_set_err_code(chip, SPI_INVALID_COMMAND);
TRACE_RET(chip, STATUS_FAIL);
diff --git a/drivers/staging/rts_pstor/xd.c b/drivers/staging/rts_pstor/xd.c
index 9f3add1..9bba5b1 100644
--- a/drivers/staging/rts_pstor/xd.c
+++ b/drivers/staging/rts_pstor/xd.c
@@ -380,7 +380,7 @@ static void xd_clear_dma_buffer(struct rtsx_chip *chip)
RTSX_DEBUGP("xD ECC error, dummy write!\n");
- buf = (u8 *)rtsx_alloc_dma_buf(chip, 512, GFP_KERNEL);
+ buf = kmalloc(512, GFP_KERNEL);
if (!buf)
return;
@@ -427,7 +427,7 @@ static void xd_clear_dma_buffer(struct rtsx_chip *chip)
rtsx_write_register(chip, CARD_STOP, SD_STOP | SD_CLR_ERR, SD_STOP | SD_CLR_ERR);
}
- rtsx_free_dma_buf(chip, buf);
+ kfree(buf);
if (chip->asic_code) {
rtsx_write_register(chip, CARD_PULL_CTL2, 0xFF, 0x55);