Re: [PATCH] staging: Fix a Fix me in tranzport.c

2014-07-19 Thread Dan Carpenter
On Sat, Jul 19, 2014 at 01:26:52AM -0400, Nicholas Krause wrote:
 This patch add a atomic lock in usb_tranzport_usb for preventing
 a tiny race in this function.
 
 Signed-off-by: Nicholas Krause xerofo...@gmail.com

Is this a guess work patch or have you tested it?

regards,
dan carpenter


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] Solves some problems reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 75ca15e..177e4b9 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -155,7 +155,7 @@ struct sep_queue_info *sep_queue_status_add(
unsigned long lck_flags;
struct sep_queue_info *my_elem = NULL;
 
-   my_elem = kzalloc(sizeof(struct sep_queue_info), GFP_KERNEL);
+   my_elem = kzalloc(sizeof(*my_elem), GFP_KERNEL);
 
if (!my_elem)
return NULL;
@@ -1006,8 +1006,8 @@ static int sep_crypto_dma(
return -ENOMEM;
}
 
-   sep_dma = kmalloc(sizeof(struct sep_dma_map) *
-   count_mapped, GFP_ATOMIC);
+   sep_dma = kmalloc_array(count_mapped, sizeof(struct sep_dma_map),
+   GFP_ATOMIC);
 
if (sep_dma == NULL) {
dev_dbg(sep-pdev-dev, Cannot allocate dma_maps\n);
@@ -1070,7 +1070,8 @@ static int sep_crypto_lli(
 
sep_map = *maps;
 
-   sep_lli = kmalloc(sizeof(struct sep_lli_entry) * nbr_ents, GFP_ATOMIC);
+   sep_lli = kmalloc_array(nbr_ents, sizeof(struct sep_lli_entry),
+   GFP_ATOMIC);
 
if (sep_lli == NULL) {
dev_dbg(sep-pdev-dev, Cannot allocate lli_maps\n);
@@ -3398,7 +3399,7 @@ static ssize_t sep_create_dcb_dmatables_context(struct 
sep_device *sep,
}
 
/* Allocate thread-specific memory for DCB */
-   *dcb_region = kzalloc(num_dcbs * sizeof(struct sep_dcblock),
+   *dcb_region = kcalloc(num_dcbs, sizeof(struct sep_dcblock),
  GFP_KERNEL);
if (!(*dcb_region)) {
error = -ENOMEM;
@@ -3480,7 +3481,7 @@ int sep_create_dcb_dmatables_context_kernel(struct 
sep_device *sep,
current-pid, num_dcbs);
 
/* Allocate thread-specific memory for DCB */
-   *dcb_region = kzalloc(num_dcbs * sizeof(struct sep_dcblock),
+   *dcb_region = kcalloc(num_dcbs, sizeof(struct sep_dcblock),
  GFP_KERNEL);
if (!(*dcb_region)) {
error = -ENOMEM;
@@ -4090,7 +4091,7 @@ static int sep_probe(struct pci_dev *pdev,
}
 
/* Allocate the sep_device structure for this device */
-   sep_dev = kzalloc(sizeof(struct sep_device), GFP_ATOMIC);
+   sep_dev = kzalloc(sizeof(*sep_dev), GFP_ATOMIC);
if (sep_dev == NULL) {
error = -ENOMEM;
goto end_function_disable_device;
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] Fix blank lines issue reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 47 --
 1 file changed, 4 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 6f98881..89a1d53 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -492,7 +492,6 @@ int sep_free_dma_table_data_handler(struct sep_device *sep,
 * memory is not available to the o/s at all.
 */
if (!(*dma_ctx)-secure_dma  dma-out_map_array) {
-
for (count = 0; count  dma-out_num_pages; count++) {
dma_unmap_page(sep-pdev-dev,
dma-out_map_array[count].dma_addr,
@@ -513,7 +512,6 @@ int sep_free_dma_table_data_handler(struct sep_device *sep,
 
/* Again, we do this only for non secure dma */
if (!(*dma_ctx)-secure_dma  dma-out_page_array) {
-
for (count = 0; count  dma-out_num_pages; count++) {
if (!PageReserved(dma-out_page_array[count]))
 
@@ -633,7 +631,6 @@ static int sep_end_transaction_handler(struct sep_device 
*sep,
return 0;
 }
 
-
 /**
  * sep_release - close a SEP device
  * @inode: inode of SEP device
@@ -766,7 +763,6 @@ static unsigned int sep_poll(struct file *filp, poll_table 
*wait)
goto end_function;
}
 
-
/* Add the event to the polling wait table */
dev_dbg(sep-pdev-dev, [PID%d] poll: calling wait sep_event\n,
current-pid);
@@ -856,7 +852,6 @@ static unsigned long sep_set_time(struct sep_device *sep)
struct timeval time;
u32 *time_addr; /* Address of time as seen by the kernel */
 
-
do_gettimeofday(time);
 
/* Set value in the SYSTEM MEMORY offset */
@@ -905,7 +900,6 @@ int sep_send_command_handler(struct sep_device *sep)
msg_pool += 1;
if ((*msg_pool  2) ||
(*msg_pool  SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES)) {
-
dev_warn(sep-pdev-dev, invalid message size\n);
error = -EPROTO;
goto end_function;
@@ -1023,7 +1017,6 @@ static int sep_crypto_dma(
 
*dma_maps = sep_dma;
return count_mapped;
-
 }
 
 /**
@@ -1053,7 +1046,6 @@ static int sep_crypto_lli(
u32 data_size,
enum dma_data_direction direction)
 {
-
int ct1;
struct sep_lli_entry *sep_lli;
struct sep_dma_map *sep_map;
@@ -1318,7 +1310,6 @@ static int sep_lock_user_pages(struct sep_device *sep,
(unsigned long)lli_array[0].bus_address,
lli_array[0].block_size);
 
-
/* Check the size of the last page */
if (num_pages  1) {
lli_array[num_pages - 1].block_size =
@@ -1663,7 +1654,6 @@ static void sep_build_lli_table(struct sep_device *sep,
 
/* Set the output parameter */
*num_processed_entries_ptr += array_counter;
-
 }
 
 /**
@@ -1747,7 +1737,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
/* Print entries of the table (without info entry) */
for (entries_count = 0; entries_count  num_table_entries;
entries_count++, lli_table_ptr++) {
-
dev_dbg(sep-pdev-dev,
[PID%d] lli_table_ptr address is %08lx\n,
current-pid,
@@ -1773,7 +1762,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
current-pid,
(unsigned long)lli_table_ptr-bus_address);
 
-
table_data_size = lli_table_ptr-block_size  0xff;
num_table_entries = (lli_table_ptr-block_size  24)  0xff;
 
@@ -1796,7 +1784,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
 #endif
 }
 
-
 /**
  * sep_prepare_empty_lli_table - create a blank LLI table
  * @sep: pointer to struct sep_device
@@ -1972,7 +1959,6 @@ static int sep_prepare_input_dma_table(struct sep_device 
*sep,
 
/* Loop till all the entries in in array are processed */
while (current_entry  sep_lli_entries) {
-
/* Set the new input and output tables */
in_lli_table_ptr =
(struct sep_lli_entry *)lli_table_alloc_addr;
@@ -1988,10 +1974,8 @@ static int sep_prepare_input_dma_table(struct sep_device 
*sep,
((void *)sep-shared_addr +
SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES +
SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES)) {
-
error = -ENOMEM;
goto end_function_error;
-
}
 
/* Update the number of created tables */
@@ -2022,7 +2006,6 @@ static int sep_prepare_input_dma_table(struct 

[PATCH 3/4] Fix misceanellous problems reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 1580d95f..6f98881 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -130,7 +130,6 @@ void sep_queue_status_remove(struct sep_device *sep,
 
dev_dbg(sep-pdev-dev, [PID%d] sep_queue_status_remove return\n,
current-pid);
-   return;
 }
 
 /**
@@ -1737,7 +1736,7 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
return;
}
 
-   while ((unsigned long) lli_table_ptr-bus_address != 0x) {
+   while ((unsigned long)lli_table_ptr-bus_address != 0x) {
dev_dbg(sep-pdev-dev,
[PID%d] lli table %08lx, table_data_size is (hex) 
%lx\n,
current-pid, table_count, table_data_size);
@@ -1752,7 +1751,7 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
dev_dbg(sep-pdev-dev,
[PID%d] lli_table_ptr address is %08lx\n,
current-pid,
-   (unsigned long) lli_table_ptr);
+   (unsigned long)lli_table_ptr);
 
dev_dbg(sep-pdev-dev,
[PID%d] phys address is %08lx block size is 
(hex) %x\n,
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] No else is necessary after a break (reported by checkpatch)

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 177e4b9..1580d95f 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -2881,12 +2881,11 @@ static int sep_free_dma_tables_and_dcb(struct 
sep_device *sep, bool isapplet,
if (is_kva) {
error = -ENODEV;
break;
-   } else {
-   error_temp = copy_to_user(
+   }
+   error_temp = copy_to_user(
(void __user *)tail_pt,
dcb_table_ptr-tail_data,
dcb_table_ptr-tail_data_size);
-   }
if (error_temp) {
/* Release the DMA resource */
error = -EFAULT;
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging:iio:ad7280a: Use managed interfaces

2014-07-19 Thread Himangi Saraogi
This patch moves data allocated using unmanaged interfaces to managed
interfaces like devm_kzalloc, devm_iio_device_register, devm_kasprintf,
devm_request_threaded_irq and does away with the calls to free the
allocated memory in the probe and remove functions. Some labels in the
probe function are also removed.

Signed-off-by: Himangi Saraogi himangi...@gmail.com
---
I am not very sure if devmifying request_irq is a good idea as it
leads to the freeing of the interrupt after the ad7280_write.
 drivers/staging/iio/adc/ad7280a.c | 57 ++-
 1 file changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c 
b/drivers/staging/iio/adc/ad7280a.c
index d215edf..3706b3e 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -486,8 +486,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
 {
int dev, ch, cnt;
 
-   st-channels = kcalloc((st-slave_num + 1) * 12 + 2,
-  sizeof(*st-channels), GFP_KERNEL);
+   st-channels = devm_kcalloc(st-spi-dev, (st-slave_num + 1) * 12 + 2,
+   sizeof(*st-channels), GFP_KERNEL);
if (st-channels == NULL)
return -ENOMEM;
 
@@ -547,8 +547,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
 {
int dev, ch, cnt;
 
-   st-iio_attr = kzalloc(sizeof(*st-iio_attr) * (st-slave_num + 1) *
-   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
+   st-iio_attr = devm_kzalloc(st-spi-dev, sizeof(*st-iio_attr) *
+   (st-slave_num + 1) *
+   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
if (st-iio_attr == NULL)
return -ENOMEM;
 
@@ -564,7 +565,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
st-iio_attr[cnt].dev_attr.store =
ad7280_store_balance_sw;
st-iio_attr[cnt].dev_attr.attr.name =
-   kasprintf(GFP_KERNEL,
+   devm_kasprintf(st-spi-dev, GFP_KERNEL,
in%d-in%d_balance_switch_en,
(dev * AD7280A_CELLS_PER_DEV) + ch,
(dev * AD7280A_CELLS_PER_DEV) + ch + 1);
@@ -581,7 +582,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
st-iio_attr[cnt].dev_attr.store =
ad7280_store_balance_timer;
st-iio_attr[cnt].dev_attr.attr.name =
-   kasprintf(GFP_KERNEL, in%d-in%d_balance_timer,
+   devm_kasprintf(st-spi-dev, GFP_KERNEL,
+   in%d-in%d_balance_timer,
(dev * AD7280A_CELLS_PER_DEV) + ch,
(dev * AD7280A_CELLS_PER_DEV) + ch + 1);
ad7280_attributes[cnt] =
@@ -900,48 +902,36 @@ static int ad7280_probe(struct spi_device *spi)
 
ret = ad7280_attr_init(st);
if (ret  0)
-   goto error_free_channels;
+   return ret;
 
-   ret = iio_device_register(indio_dev);
+   ret = devm_iio_device_register(spi-dev, indio_dev);
if (ret)
-   goto error_free_attr;
+   return ret;
 
if (spi-irq  0) {
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
   AD7280A_ALERT, 1,
   AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
if (ret)
-   goto error_unregister;
+   return ret;
 
ret = ad7280_write(st, AD7280A_DEVADDR(st-slave_num),
   AD7280A_ALERT, 0,
   AD7280A_ALERT_GEN_STATIC_HIGH |
   (pdata-chain_last_alert_ignore  0xF));
if (ret)
-   goto error_unregister;
-
-   ret = request_threaded_irq(spi-irq,
-  NULL,
-  ad7280_event_handler,
-  IRQF_TRIGGER_FALLING |
-  IRQF_ONESHOT,
-  indio_dev-name,
-  indio_dev);
+   return ret;
+
+   ret = devm_request_threaded_irq(spi-dev, spi-irq, NULL,
+   ad7280_event_handler,
+   IRQF_TRIGGER_FALLING |
+   IRQF_ONESHOT, indio_dev-name,
+   indio_dev);
if (ret)
-   goto error_unregister;
+

[PATCH 1/1] Staging: comedi: adl_paci9118: organized entry comments

2014-07-19 Thread Sam Asadi
Introductory comments organized according to Linux's comment
coding style.

Signed-off-by: Sam Asadi asadi.sam...@gmail.com
---
 drivers/staging/comedi/drivers/adl_pci9118.c |  109 +-
 1 file changed, 55 insertions(+), 54 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adl_pci9118.c 
b/drivers/staging/comedi/drivers/adl_pci9118.c
index a715cd3..f916632 100644
--- a/drivers/staging/comedi/drivers/adl_pci9118.c
+++ b/drivers/staging/comedi/drivers/adl_pci9118.c
@@ -7,61 +7,62 @@
  *
  * Author: Michal Dobes do...@tesnet.cz
  *
-*/
+ */
+
 /*
-Driver: adl_pci9118
-Description: Adlink PCI-9118DG, PCI-9118HG, PCI-9118HR
-Author: Michal Dobes do...@tesnet.cz
-Devices: [ADLink] PCI-9118DG (pci9118dg), PCI-9118HG (pci9118hg),
-  PCI-9118HR (pci9118hr)
-Status: works
-
-This driver supports AI, AO, DI and DO subdevices.
-AI subdevice supports cmd and insn interface,
-other subdevices support only insn interface.
-For AI:
-- If cmd-scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
-- If cmd-convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
-- If cmd-start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
-- It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
-  cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
-- If return value of cmdtest is 5 then you've bad channel list
-  (it isn't possible mixture S.E. and DIFF inputs or bipolar and unipolar
-  ranges).
-
-There are some hardware limitations:
-a) You cann't use mixture of unipolar/bipoar ranges or differencial/single
-   ended inputs.
-b) DMA transfers must have the length aligned to two samples (32 bit),
-   so there is some problems if cmd-chanlist_len is odd. This driver tries
-   bypass this with adding one sample to the end of the every scan and discard
-   it on output but this cann't be used if cmd-scan_begin_src=TRIG_FOLLOW
-   and is used flag TRIG_WAKE_EOS, then driver switch to interrupt driven mode
-   with interrupt after every sample.
-c) If isn't used DMA then you can use only mode where
-   cmd-scan_begin_src=TRIG_FOLLOW.
-
-Configuration options:
-  [0] - PCI bus of device (optional)
-  [1] - PCI slot of device (optional)
-   If bus/slot is not specified, then first available PCI
-   card will be used.
-  [2] - 0= standard 8 DIFF/16 SE channels configuration
-   n = external multiplexer connected, 1 = n = 256
-  [3] - 0=autoselect DMA or EOC interrupts operation
-   1 = disable DMA mode
-   3 = disable DMA and INT, only insn interface will work
-  [4] - samplehold signal - card can generate signal for external SH board
-   0 = use SSHO(pin 45) signal is generated in onboard hardware SH logic
-   0 != use ADCHN7(pin 23) signal is generated from driver, number say how
-   long delay is requested in ns and sign polarity of the hold
-   (in this case external multiplexor can serve only 128 channels)
-  [5] - 0=stop measure on all hardware errors
-   2 | = ignore ADOR - A/D Overrun status
-   8|=ignore Bover - A/D Burst Mode Overrun status
-   256|=ignore nFull - A/D FIFO Full status
-
-*/
+ * Driver: adl_pci9118
+ * Description: Adlink PCI-9118DG, PCI-9118HG, PCI-9118HR
+ * Author: Michal Dobes do...@tesnet.cz
+ * Devices: [ADLink] PCI-9118DG (pci9118dg), PCI-9118HG (pci9118hg),
+ * PCI-9118HR (pci9118hr)
+ * Status: works
+ *
+ * This driver supports AI, AO, DI and DO subdevices.
+ * AI subdevice supports cmd and insn interface,
+ * other subdevices support only insn interface.
+ * For AI:
+ * - If cmd-scan_begin_src=TRIG_EXT then trigger input is TGIN (pin 46).
+ * - If cmd-convert_src=TRIG_EXT then trigger input is EXTTRG (pin 44).
+ * - If cmd-start_src/stop_src=TRIG_EXT then trigger input is TGIN (pin 46).
+ * - It is not necessary to have cmd.scan_end_arg=cmd.chanlist_len but
+ * cmd.scan_end_arg modulo cmd.chanlist_len must by 0.
+ * - If return value of cmdtest is 5 then you've bad channel list
+ * (it isn't possible mixture S.E. and DIFF inputs or bipolar and unipolar
+ * ranges).
+ *
+ * There are some hardware limitations:
+ * a) You cann't use mixture of unipolar/bipoar ranges or differencial/single
+ *  ended inputs.
+ * b) DMA transfers must have the length aligned to two samples (32 bit),
+ *  so there is some problems if cmd-chanlist_len is odd. This driver tries
+ *  bypass this with adding one sample to the end of the every scan and discard
+ *  it on output but this cann't be used if cmd-scan_begin_src=TRIG_FOLLOW
+ *  and is used flag TRIG_WAKE_EOS, then driver switch to interrupt driven mode
+ *  with interrupt after every sample.
+ * c) If isn't used DMA then you can use only mode where
+ *  cmd-scan_begin_src=TRIG_FOLLOW.
+ *
+ * Configuration options:
+ * [0] - PCI bus of device (optional)
+ * [1] - PCI slot of device (optional)
+ *  If bus/slot is not specified, then first available PCI
+ *  card will be used.
+ * [2] - 0= standard 8 DIFF/16 SE channels configuration
+ *

[PATCH 6/8] staging: unisys: clean up diagdump proc entry code

2014-07-19 Thread Benjamin Romer
Remove remnant code left over from the diagdump proc entry.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 drivers/staging/unisys/visorchipset/visorchipset_main.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 37d83e4..50d5d91 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -126,9 +126,6 @@ InitPartitionProperties(void)
 
 static MYPROCTYPE *PartitionType;
 
-#define VISORCHIPSET_DIAG_PROC_ENTRY_FN diagdump
-static struct proc_dir_entry *diag_proc_dir;
-
 static LIST_HEAD(BusInfoList);
 static LIST_HEAD(DevInfoList);
 
@@ -2613,10 +2610,7 @@ visorchipset_exit(void)
visor_proc_DestroyType(PartitionType);
PartitionType = NULL;
}
-   if (diag_proc_dir) {
-   remove_proc_entry(VISORCHIPSET_DIAG_PROC_ENTRY_FN, ProcDir);
-   diag_proc_dir = NULL;
-   }
+
memset(g_DiagMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER));
 
memset(g_ChipSetMsgHdr, 0, sizeof(CONTROLVM_MESSAGE_HEADER));
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 0/8] staging: unisys: visorchipset proc fixes

2014-07-19 Thread Benjamin Romer
This patch set moves several interfaces in the visorchipset module from procfs
to sysfs, and removes the remaining proc interfaces from the module. It includes
documentation for the new interfaces in Documentation/ABI, and some code cleanup
in the new sysfs handler functions.

Benjamin Romer (8):
  staging: unisys: add toolaction to sysfs
  staging: unisys: move boottotool out of proc to sysfs
  staging: unisys: move installer to sysfs and split fields
  staging: unisys: move chipsetready to sysfs
  staging: unisys: move parahotplug to sysfs
  staging: unisys: clean up diagdump proc entry code
  staging: unisys: remove partition information from proc
  staging: unisys: ABI documentation for new sysfs entries

 .../Documentation/ABI/sysfs-platform-visorchipset  |  74 ++
 .../unisys/visorchipset/visorchipset_main.c| 783 -
 2 files changed, 354 insertions(+), 503 deletions(-)
 create mode 100644 
drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset

-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/8] staging: unisys: move chipsetready to sysfs

2014-07-19 Thread Benjamin Romer
Move the chipsetready proc entry to sysfs under a new directory guest. This
entry is used by Unisys application software on the guest to acknowledge
completion of specific events for integration purposes, but these
acknowledgements are not required for the guest to operate correctly.

The store function is simplified as well, to use scanf() instead of copying
the buffer and using strsep().

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 .../unisys/visorchipset/visorchipset_main.c| 90 +-
 1 file changed, 37 insertions(+), 53 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index b13343d..150b575 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -129,9 +129,6 @@ static MYPROCTYPE *PartitionType;
 #define VISORCHIPSET_DIAG_PROC_ENTRY_FN diagdump
 static struct proc_dir_entry *diag_proc_dir;
 
-#define VISORCHIPSET_CHIPSET_PROC_ENTRY_FN chipsetready
-static struct proc_dir_entry *chipset_proc_dir;
-
 #define VISORCHIPSET_PARAHOTPLUG_PROC_ENTRY_FN parahotplug
 static struct proc_dir_entry *parahotplug_proc_dir;
 
@@ -323,6 +320,9 @@ static ssize_t show_remaining_steps(struct device *dev,
 static ssize_t store_remaining_steps(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
 
+static ssize_t store_chipsetready(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+
 static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
store_toolaction);
 
@@ -336,6 +336,8 @@ static DEVICE_ATTR(textid, S_IRUSR | S_IWUSR, show_textid, 
store_textid);
 static DEVICE_ATTR(remaining_steps, S_IRUSR | S_IWUSR, show_remaining_steps,
store_remaining_steps);
 
+static DEVICE_ATTR(chipsetready, S_IWUSR, NULL, store_chipsetready);
+
 static struct attribute *visorchipset_install_attrs[] = {
dev_attr_toolaction.attr,
dev_attr_boottotool.attr,
@@ -350,8 +352,19 @@ static struct attribute_group visorchipset_install_group = 
{
.attrs = visorchipset_install_attrs
 };
 
+static struct attribute *visorchipset_guest_attrs[] = {
+   dev_attr_chipsetready.attr,
+   NULL
+};
+
+static struct attribute_group visorchipset_guest_group = {
+   .name = guest,
+   .attrs = visorchipset_guest_attrs
+};
+
 static const struct attribute_group *visorchipset_dev_groups[] = {
visorchipset_install_group,
+   visorchipset_guest_group,
NULL
 };
 
@@ -2417,46 +2430,29 @@ visorchipset_cache_free(struct kmem_cache *pool, void 
*p, char *fn, int ln)
kmem_cache_free(pool, p);
 }
 
-#define gettoken(bufp) strsep(bufp,  -\t\n)
-
-static ssize_t
-chipset_proc_write(struct file *file, const char __user *buffer,
-  size_t count, loff_t *ppos)
+ssize_t store_chipsetready(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
 {
-   char buf[512];
-   char *token, *p;
-
-   if (count  sizeof(buf) - 1) {
-   LOGERR(chipset_proc_write: count (%d) exceeds size of buffer 
(%d),
-(int) count, (int) sizeof(buffer));
-   return -EINVAL;
-   }
-   if (copy_from_user(buf, buffer, count)) {
-   LOGERR(chipset_proc_write: copy_from_user failed);
-   return -EFAULT;
-   }
-   buf[count] = '\0';
-
-   p = buf;
-   token = gettoken(p);
-
-   if (strcmp(token, CALLHOMEDISK_MOUNTED) == 0) {
-   token = gettoken(p);
-   /* The Call Home Disk has been mounted */
-   if (strcmp(token, 0) == 0)
-   chipset_events[0] = 1;
-   } else if (strcmp(token, MODULES_LOADED) == 0) {
-   token = gettoken(p);
-   /* All modules for the partition have been loaded */
-   if (strcmp(token, 0) == 0)
-   chipset_events[1] = 1;
-   } else if (token == NULL) {
-   /* No event specified */
-   LOGERR(No event was specified to send CHIPSET_READY response);
-   return -1;
+   char msgtype[64];
+   int msgparam;
+
+   if (sscanf(buf, %63s %d, msgtype, msgparam) == 2) {
+   if (strcmp(msgtype, CALLHOMEDISK_MOUNTED) == 0) {
+   /* The Call Home Disk has been mounted */
+   if (msgparam == 0)
+   chipset_events[0] = 1;
+   } else if (strcmp(msgtype, MODULES_LOADED) == 0) {
+   /* All modules for the partition have been loaded */
+   if (msgparam == 0)
+   chipset_events[1] = 1;
+   } else {
+   /* Unsupported event specified */
+   LOGERR(%s is an invalid event for sending 
CHIPSET_READY 

[PATCH 8/8] staging: unisys: ABI documentation for new sysfs entries

2014-07-19 Thread Benjamin Romer
This patch adds a documentation file for all of the interfaces that were moved
to sysfs by the other patches in this set.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 .../Documentation/ABI/sysfs-platform-visorchipset  | 74 ++
 1 file changed, 74 insertions(+)
 create mode 100644 
drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset

diff --git 
a/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset 
b/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset
new file mode 100644
index 000..ec6138b
--- /dev/null
+++ b/drivers/staging/unisys/Documentation/ABI/sysfs-platform-visorchipset
@@ -0,0 +1,74 @@
+What:  install/error
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   used to send the ID of a string that should be displayed on
+   s-Par's automatic installation progress screen when an error
+   is encountered during installation. This field has no effect
+   if not in installation mode.
+Users: sparmaintai...@unisys.com
+
+What:  install/remainingsteps
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   used to set the value of the progress bar on the s-Par automatic
+   installation progress screen. This field has no effect if not in
+   installation mode.
+Users: sparmaintai...@unisys.com
+
+What:  install/textid
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   used to send the ID of a string that should be displayed on
+   s-Par's automatic installation progress screen. Setting this
+   field when not in installation mode (boottotool was set on
+   the previous guest boot) has no effect.
+Users: sparmaintai...@unisys.com
+
+What:  install/boottotool
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   The boottotool flag controls s-Par behavior on the next boot of
+   this guest. Setting the flag will cause the guest to boot from
+   the utility and installation image, which will use the value in
+   the toolaction field to determine what operation is being
+   requested.
+Users: sparmaintai...@unisys.com
+
+What:  install/toolaction
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   This field is used to tell s-Par which type of recovery tool
+   action to perform on the next guest boot-up. The meaning of the
+   value is dependent on the type of installation software used to
+   commission the guest.
+Users: sparmaintai...@unisys.com
+
+What:  guest/chipsetready
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   This entry is used by Unisys application software on the guest
+   to acknowledge completion of specific events for integration
+   purposes, but these acknowledgements are not required for the
+   guest to operate correctly.
+Users: sparmaintai...@unisys.com
+
+What:  guest/parahotplug
+Date:  7/18/2014
+KernelVersion: TBD
+Contact:   sparmaintai...@unisys.com   
+Description:   The parahotplug interface is used to deal with recovery
+   situations on s-Par guest partitions. The command service
+   partition will send a message to a guest when a device that
+   guest is using needs to be temporarily removed. The message
+   triggers a udev event that will cause a recovery script to run.
+   When that script has completed its work, it will write to the
+   parahotplug interface to send a message back to Command
+   indicating that it is safe to remove the device.
+Users: sparmaintai...@unisys.com
+
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 5/8] staging: unisys: move parahotplug to sysfs

2014-07-19 Thread Benjamin Romer
Move the /proc/visorchipset/parahotplug interface to sysfs under
/sys/devices/platform/visorchipset/guest/parahotplug.

The parahotplug interface is used to deal with recovery situations on s-Par
guest partitions. The command service partition will send a message to a guest
when a device that guest is using needs to be temporarily removed. The message
triggers a udev event that will cause a recovery script to run. When that
script has completed its work, it will write to the parahotplug interface to
send a message back to Command indicating that it is safe to remove the device.

Moving this interface to sysfs orphans the visorchipset_proc_read_writeonly()
function, so it is also removed.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 .../unisys/visorchipset/visorchipset_main.c| 60 +-
 1 file changed, 12 insertions(+), 48 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 150b575..37d83e4 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -129,19 +129,12 @@ static MYPROCTYPE *PartitionType;
 #define VISORCHIPSET_DIAG_PROC_ENTRY_FN diagdump
 static struct proc_dir_entry *diag_proc_dir;
 
-#define VISORCHIPSET_PARAHOTPLUG_PROC_ENTRY_FN parahotplug
-static struct proc_dir_entry *parahotplug_proc_dir;
-
 static LIST_HEAD(BusInfoList);
 static LIST_HEAD(DevInfoList);
 
 static struct proc_dir_entry *ProcDir;
 static VISORCHANNEL *ControlVm_channel;
 
-static ssize_t visorchipset_proc_read_writeonly(struct file *file,
-   char __user *buf,
-   size_t len, loff_t *offset);
-
 typedef struct {
U8 __iomem *ptr;/* pointer to base address of payload pool */
U64 offset; /* offset from beginning of controlvm
@@ -323,6 +316,9 @@ static ssize_t store_remaining_steps(struct device *dev,
 static ssize_t store_chipsetready(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
 
+static ssize_t store_parahotplug(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+
 static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
store_toolaction);
 
@@ -338,6 +334,8 @@ static DEVICE_ATTR(remaining_steps, S_IRUSR | S_IWUSR, 
show_remaining_steps,
 
 static DEVICE_ATTR(chipsetready, S_IWUSR, NULL, store_chipsetready);
 
+static DEVICE_ATTR(parahotplug, S_IWUSR, NULL, store_parahotplug);
+
 static struct attribute *visorchipset_install_attrs[] = {
dev_attr_toolaction.attr,
dev_attr_boottotool.attr,
@@ -354,6 +352,7 @@ static struct attribute_group visorchipset_install_group = {
 
 static struct attribute *visorchipset_guest_attrs[] = {
dev_attr_chipsetready.attr,
+   dev_attr_parahotplug.attr,
NULL
 };
 
@@ -1861,30 +1860,17 @@ parahotplug_process_message(CONTROLVM_MESSAGE *inmsg)
 
 /*
  * Gets called when the udev script writes to
- * /proc/visorchipset/parahotplug.  Expects input in the form of id
- * active where id is the identifier passed to the script that
- * matches a request on the request list, and active is 0 or 1
- * indicating whether the device is now enabled or not.
+ * /sys/devices/platform/visorchipset/guest/parahotplug.
+ * Expects input in the form of id active where id is the identifier
+ * passed to the script that matches a request on the request list, and 
active
+ * is 0 or 1 indicating whether the device is now enabled or not.
  */
-static ssize_t
-parahotplug_proc_write(struct file *file, const char __user *buffer,
-  size_t count, loff_t *ppos)
+ssize_t store_parahotplug(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
 {
-   char buf[64];
uint id;
ushort active;
 
-   if (count  sizeof(buf) - 1) {
-   LOGERR(parahotplug_proc_write: count (%d) exceeds size of 
buffer (%d),
-(int) count, (int) sizeof(buf));
-   return -EINVAL;
-   }
-   if (copy_from_user(buf, buffer, count)) {
-   LOGERR(parahotplug_proc_write: copy_from_user failed);
-   return -EFAULT;
-   }
-   buf[count] = '\0';
-
if (sscanf(buf, %u %hu, id, active) != 2) {
id = 0;
active = 0;
@@ -1900,12 +1886,6 @@ parahotplug_proc_write(struct file *file, const char 
__user *buffer,
return count;
 }
 
-static const struct file_operations parahotplug_proc_fops = {
-   .owner = THIS_MODULE,
-   .read = visorchipset_proc_read_writeonly,
-   .write = parahotplug_proc_write,
-};
-
 /* Process a controlvm message.
  * Return result:
  *FALSE - this function will return FALSE only in the case where the
@@ -2459,13 +2439,6 @@ ssize_t 

[PATCH 1/8] staging: unisys: add toolaction to sysfs

2014-07-19 Thread Benjamin Romer
Move the proc entry for controlling the toolaction field to sysfs. The field
appears in /sys/devices/platform/visorchipset/install/toolaction.

This field is used to tell s-Par which type of recovery tool action to perform
on the next guest boot-up. The meaning of the value is dependent on the type
of installation software used to commission the guest.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 .../unisys/visorchipset/visorchipset_main.c| 151 -
 1 file changed, 60 insertions(+), 91 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index a16d67e..f45e352 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -149,11 +149,6 @@ static ssize_t proc_read_installer(struct file *file, char 
__user *buf,
 static ssize_t proc_write_installer(struct file *file,
const char __user *buffer,
size_t count, loff_t *ppos);
-static ssize_t proc_read_toolaction(struct file *file, char __user *buf,
-   size_t len, loff_t *offset);
-static ssize_t proc_write_toolaction(struct file *file,
-const char __user *buffer,
-size_t count, loff_t *ppos);
 static ssize_t proc_read_bootToTool(struct file *file, char __user *buf,
size_t len, loff_t *offset);
 static ssize_t proc_write_bootToTool(struct file *file,
@@ -164,11 +159,6 @@ static const struct file_operations proc_installer_fops = {
.write = proc_write_installer,
 };
 
-static const struct file_operations proc_toolaction_fops = {
-   .read = proc_read_toolaction,
-   .write = proc_write_toolaction,
-};
-
 static const struct file_operations proc_bootToTool_fops = {
.read = proc_read_bootToTool,
.write = proc_write_bootToTool,
@@ -321,10 +311,36 @@ static VISORCHIPSET_BUSDEV_RESPONDERS BusDev_Responders = 
{
 /* info for /dev/visorchipset */
 static dev_t MajorDev = -1; /** indicates major num for device */
 
+/* prototypes for attributes */
+static ssize_t show_toolaction(struct device *dev,
+   struct device_attribute *attr, char *buf);
+
+static ssize_t store_toolaction(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+
+static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
+   store_toolaction);
+
+static struct attribute *visorchipset_install_attrs[] = {
+   dev_attr_toolaction.attr,
+   NULL
+};
+
+static struct attribute_group visorchipset_install_group = {
+   .name = install,
+   .attrs = visorchipset_install_attrs
+};
+
+static const struct attribute_group *visorchipset_dev_groups[] = {
+   visorchipset_install_group,
+   NULL
+};
+
 /* /sys/devices/platform/visorchipset */
 static struct platform_device Visorchipset_platform_device = {
.name = visorchipset,
.id = -1,
+   .dev.groups = visorchipset_dev_groups,
 };
 
 /* Function prototypes */
@@ -336,6 +352,40 @@ static void 
controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER *
  msgHdr, int response,
  ULTRA_SEGMENT_STATE state);
 
+ssize_t show_toolaction(struct device *dev, struct device_attribute *attr,
+   char *buf)
+{
+   if (ControlVm_channel) {
+   U8 toolAction;
+
+   visorchannel_read(ControlVm_channel,
+   offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
+  ToolAction), toolAction, sizeof(U8));
+   return scnprintf(buf, PAGE_SIZE, %u\n, toolAction);
+   } else
+   return -ENODEV;
+}
+
+ssize_t store_toolaction(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   if (ControlVm_channel) {
+   U8 toolAction;
+
+   if (sscanf(buf, %hhu\n, toolAction) == 1) {
+   if (visorchannel_write(ControlVm_channel,
+   offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
+   ToolAction),
+   toolAction, sizeof(U8))  0)
+   return -EFAULT;
+   else
+   return count;
+   } else
+   return -EIO;
+   } else
+   return -ENODEV;
+}
+
 static void
 show_partition_property(struct seq_file *f, void *ctx, int property)
 {
@@ -2368,83 +2418,6 @@ proc_write_installer(struct file *file,
 }
 
 /**
- * Reads the ToolAction field of ControlVMChannel.
- */
-static ssize_t
-proc_read_toolaction(struct file *file, char __user *buf,
-  

[PATCH 3/8] staging: unisys: move installer to sysfs and split fields

2014-07-19 Thread Benjamin Romer
The installer entry in /proc/visorchipset/installer was composed of three
separate fields as one entry. This patch removes the proc entry and associated
functions, and creates new fields with distinct entries under sysfs in the
visorchipset/install directory. The fields are:

textid: used to send the ID of a string that should be displayed on
s-Par's automatic installation progress screen. Setting this
field when not in installation mode (boottotool was set on
the previous guest boot) has no effect.

remaining_steps: used to set the value of the progress bar on the
s-Par automatic installation progress screen. This field has
no effect if not in installation mode.

error: used to send the ID of a string that should be displayed on
s-Par's automatic installation progress screen when an error
is encountered during installation. This field has no effect
if not in installation mode.

Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
---
 .../unisys/visorchipset/visorchipset_main.c| 261 +++--
 1 file changed, 134 insertions(+), 127 deletions(-)

diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
b/drivers/staging/unisys/visorchipset/visorchipset_main.c
index 6036bf5..b13343d 100644
--- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
+++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
@@ -144,16 +144,6 @@ static VISORCHANNEL *ControlVm_channel;
 static ssize_t visorchipset_proc_read_writeonly(struct file *file,
char __user *buf,
size_t len, loff_t *offset);
-static ssize_t proc_read_installer(struct file *file, char __user *buf,
-  size_t len, loff_t *offset);
-static ssize_t proc_write_installer(struct file *file,
-   const char __user *buffer,
-   size_t count, loff_t *ppos);
-
-static const struct file_operations proc_installer_fops = {
-   .read = proc_read_installer,
-   .write = proc_write_installer,
-};
 
 typedef struct {
U8 __iomem *ptr;/* pointer to base address of payload pool */
@@ -315,15 +305,43 @@ static ssize_t show_boottotool(struct device *dev,
 static ssize_t store_boottotool(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count);
 
+static ssize_t show_error(struct device *dev, struct device_attribute *attr,
+   char *buf);
+
+static ssize_t store_error(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count);
+
+static ssize_t show_textid(struct device *dev, struct device_attribute *attr,
+   char *buf);
+
+static ssize_t store_textid(struct device *dev,struct device_attribute 
*attr,
+   const char *buf, size_t count);
+
+static ssize_t show_remaining_steps(struct device *dev,
+   struct device_attribute *attr, char *buf);
+
+static ssize_t store_remaining_steps(struct device *dev,
+   struct device_attribute *attr, const char *buf, size_t count);
+
 static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
store_toolaction);
 
 static DEVICE_ATTR(boottotool, S_IRUSR | S_IWUSR, show_boottotool,
store_boottotool);
 
+static DEVICE_ATTR(error, S_IRUSR | S_IWUSR, show_error, store_error);
+
+static DEVICE_ATTR(textid, S_IRUSR | S_IWUSR, show_textid, store_textid);
+
+static DEVICE_ATTR(remaining_steps, S_IRUSR | S_IWUSR, show_remaining_steps,
+   store_remaining_steps);
+
 static struct attribute *visorchipset_install_attrs[] = {
dev_attr_toolaction.attr,
dev_attr_boottotool.attr,
+   dev_attr_error.attr,
+   dev_attr_textid.attr,
+   dev_attr_remaining_steps.attr,
NULL
 };
 
@@ -427,6 +445,112 @@ ssize_t store_boottotool(struct device *dev, struct 
device_attribute *attr,
return -ENODEV;
}
 }
+
+ssize_t show_error(struct device *dev, struct device_attribute *attr,
+   char *buf)
+{
+   U32 error;
+
+   if (ControlVm_channel) {
+   visorchannel_read(ControlVm_channel, offsetof(
+   ULTRA_CONTROLVM_CHANNEL_PROTOCOL, InstallationError),
+   error, sizeof(U32));
+   return scnprintf(buf, PAGE_SIZE, %i\n, error);
+   } else {
+   return -ENODEV;
+   }
+}
+
+ssize_t store_error(struct device *dev, struct device_attribute *attr,
+   const char *buf, size_t count)
+{
+   U32 error;
+
+   if (ControlVm_channel) {
+   if (sscanf(buf, %i\n, error) == 1) {
+   if (visorchannel_write(ControlVm_channel,
+   offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
+   InstallationError),
+   

Re: [PATCH 1/8] staging: unisys: add toolaction to sysfs

2014-07-19 Thread Greg KH
On Sat, Jul 19, 2014 at 10:26:54AM -0400, Benjamin Romer wrote:
 Move the proc entry for controlling the toolaction field to sysfs. The field
 appears in /sys/devices/platform/visorchipset/install/toolaction.
 
 This field is used to tell s-Par which type of recovery tool action to perform
 on the next guest boot-up. The meaning of the value is dependent on the type
 of installation software used to commission the guest.
 
 Signed-off-by: Benjamin Romer benjamin.ro...@unisys.com
 ---
  .../unisys/visorchipset/visorchipset_main.c| 151 
 -
  1 file changed, 60 insertions(+), 91 deletions(-)
 
 diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c 
 b/drivers/staging/unisys/visorchipset/visorchipset_main.c
 index a16d67e..f45e352 100644
 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c
 +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c
 @@ -149,11 +149,6 @@ static ssize_t proc_read_installer(struct file *file, 
 char __user *buf,
  static ssize_t proc_write_installer(struct file *file,
   const char __user *buffer,
   size_t count, loff_t *ppos);
 -static ssize_t proc_read_toolaction(struct file *file, char __user *buf,
 - size_t len, loff_t *offset);
 -static ssize_t proc_write_toolaction(struct file *file,
 -  const char __user *buffer,
 -  size_t count, loff_t *ppos);
  static ssize_t proc_read_bootToTool(struct file *file, char __user *buf,
   size_t len, loff_t *offset);
  static ssize_t proc_write_bootToTool(struct file *file,
 @@ -164,11 +159,6 @@ static const struct file_operations proc_installer_fops 
 = {
   .write = proc_write_installer,
  };
  
 -static const struct file_operations proc_toolaction_fops = {
 - .read = proc_read_toolaction,
 - .write = proc_write_toolaction,
 -};
 -
  static const struct file_operations proc_bootToTool_fops = {
   .read = proc_read_bootToTool,
   .write = proc_write_bootToTool,
 @@ -321,10 +311,36 @@ static VISORCHIPSET_BUSDEV_RESPONDERS BusDev_Responders 
 = {
  /* info for /dev/visorchipset */
  static dev_t MajorDev = -1; /** indicates major num for device */
  
 +/* prototypes for attributes */
 +static ssize_t show_toolaction(struct device *dev,
 + struct device_attribute *attr, char *buf);
 +
 +static ssize_t store_toolaction(struct device *dev,
 + struct device_attribute *attr, const char *buf, size_t count);
 +
 +static DEVICE_ATTR(toolaction, S_IRUSR | S_IWUSR, show_toolaction,
 + store_toolaction);

DEVICE_ATTR_RW() please.  Never use the raw DEVICE_ATTR() if at all
possible because it's harder to audit that you really got the
permissions properly.

 +
 +static struct attribute *visorchipset_install_attrs[] = {
 + dev_attr_toolaction.attr,
 + NULL
 +};
 +
 +static struct attribute_group visorchipset_install_group = {
 + .name = install,
 + .attrs = visorchipset_install_attrs
 +};
 +
 +static const struct attribute_group *visorchipset_dev_groups[] = {
 + visorchipset_install_group,
 + NULL
 +};
 +
  /* /sys/devices/platform/visorchipset */
  static struct platform_device Visorchipset_platform_device = {
   .name = visorchipset,
   .id = -1,
 + .dev.groups = visorchipset_dev_groups,

Only create this device when ControlVm_channel is present in the system,
that should take out your check for it in the show/store function.

Same goes for the rest of these patches.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: sep: Fix issues reported by checkpatch

2014-07-19 Thread LABBE Corentin
Hello

The drivers/staging/sep/sep_main.c have lots of checkpatch issue.
This patch series solves them and since there are many, I have splitted 
corrections in 4 patch.

Note that this work is done for the Eudyptulla Challenge.

Best regards

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/4] staging: sep: No else is necessary after a break (reported by checkpatch)

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 177e4b9..1580d95f 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -2881,12 +2881,11 @@ static int sep_free_dma_tables_and_dcb(struct 
sep_device *sep, bool isapplet,
if (is_kva) {
error = -ENODEV;
break;
-   } else {
-   error_temp = copy_to_user(
+   }
+   error_temp = copy_to_user(
(void __user *)tail_pt,
dcb_table_ptr-tail_data,
dcb_table_ptr-tail_data_size);
-   }
if (error_temp) {
/* Release the DMA resource */
error = -EFAULT;
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/4] staging: sep: Fix misceanellous problems reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 1580d95f..6f98881 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -130,7 +130,6 @@ void sep_queue_status_remove(struct sep_device *sep,
 
dev_dbg(sep-pdev-dev, [PID%d] sep_queue_status_remove return\n,
current-pid);
-   return;
 }
 
 /**
@@ -1737,7 +1736,7 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
return;
}
 
-   while ((unsigned long) lli_table_ptr-bus_address != 0x) {
+   while ((unsigned long)lli_table_ptr-bus_address != 0x) {
dev_dbg(sep-pdev-dev,
[PID%d] lli table %08lx, table_data_size is (hex) 
%lx\n,
current-pid, table_count, table_data_size);
@@ -1752,7 +1751,7 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
dev_dbg(sep-pdev-dev,
[PID%d] lli_table_ptr address is %08lx\n,
current-pid,
-   (unsigned long) lli_table_ptr);
+   (unsigned long)lli_table_ptr);
 
dev_dbg(sep-pdev-dev,
[PID%d] phys address is %08lx block size is 
(hex) %x\n,
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/4] staging: sep: Solves some problems reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 75ca15e..177e4b9 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -155,7 +155,7 @@ struct sep_queue_info *sep_queue_status_add(
unsigned long lck_flags;
struct sep_queue_info *my_elem = NULL;
 
-   my_elem = kzalloc(sizeof(struct sep_queue_info), GFP_KERNEL);
+   my_elem = kzalloc(sizeof(*my_elem), GFP_KERNEL);
 
if (!my_elem)
return NULL;
@@ -1006,8 +1006,8 @@ static int sep_crypto_dma(
return -ENOMEM;
}
 
-   sep_dma = kmalloc(sizeof(struct sep_dma_map) *
-   count_mapped, GFP_ATOMIC);
+   sep_dma = kmalloc_array(count_mapped, sizeof(struct sep_dma_map),
+   GFP_ATOMIC);
 
if (sep_dma == NULL) {
dev_dbg(sep-pdev-dev, Cannot allocate dma_maps\n);
@@ -1070,7 +1070,8 @@ static int sep_crypto_lli(
 
sep_map = *maps;
 
-   sep_lli = kmalloc(sizeof(struct sep_lli_entry) * nbr_ents, GFP_ATOMIC);
+   sep_lli = kmalloc_array(nbr_ents, sizeof(struct sep_lli_entry),
+   GFP_ATOMIC);
 
if (sep_lli == NULL) {
dev_dbg(sep-pdev-dev, Cannot allocate lli_maps\n);
@@ -3398,7 +3399,7 @@ static ssize_t sep_create_dcb_dmatables_context(struct 
sep_device *sep,
}
 
/* Allocate thread-specific memory for DCB */
-   *dcb_region = kzalloc(num_dcbs * sizeof(struct sep_dcblock),
+   *dcb_region = kcalloc(num_dcbs, sizeof(struct sep_dcblock),
  GFP_KERNEL);
if (!(*dcb_region)) {
error = -ENOMEM;
@@ -3480,7 +3481,7 @@ int sep_create_dcb_dmatables_context_kernel(struct 
sep_device *sep,
current-pid, num_dcbs);
 
/* Allocate thread-specific memory for DCB */
-   *dcb_region = kzalloc(num_dcbs * sizeof(struct sep_dcblock),
+   *dcb_region = kcalloc(num_dcbs, sizeof(struct sep_dcblock),
  GFP_KERNEL);
if (!(*dcb_region)) {
error = -ENOMEM;
@@ -4090,7 +4091,7 @@ static int sep_probe(struct pci_dev *pdev,
}
 
/* Allocate the sep_device structure for this device */
-   sep_dev = kzalloc(sizeof(struct sep_device), GFP_ATOMIC);
+   sep_dev = kzalloc(sizeof(*sep_dev), GFP_ATOMIC);
if (sep_dev == NULL) {
error = -ENOMEM;
goto end_function_disable_device;
-- 
1.8.5.5

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 4/4] staging: sep: Fix blank lines issue reported by checkpatch

2014-07-19 Thread LABBE Corentin
Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
---
 drivers/staging/sep/sep_main.c | 47 --
 1 file changed, 4 insertions(+), 43 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 6f98881..89a1d53 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -492,7 +492,6 @@ int sep_free_dma_table_data_handler(struct sep_device *sep,
 * memory is not available to the o/s at all.
 */
if (!(*dma_ctx)-secure_dma  dma-out_map_array) {
-
for (count = 0; count  dma-out_num_pages; count++) {
dma_unmap_page(sep-pdev-dev,
dma-out_map_array[count].dma_addr,
@@ -513,7 +512,6 @@ int sep_free_dma_table_data_handler(struct sep_device *sep,
 
/* Again, we do this only for non secure dma */
if (!(*dma_ctx)-secure_dma  dma-out_page_array) {
-
for (count = 0; count  dma-out_num_pages; count++) {
if (!PageReserved(dma-out_page_array[count]))
 
@@ -633,7 +631,6 @@ static int sep_end_transaction_handler(struct sep_device 
*sep,
return 0;
 }
 
-
 /**
  * sep_release - close a SEP device
  * @inode: inode of SEP device
@@ -766,7 +763,6 @@ static unsigned int sep_poll(struct file *filp, poll_table 
*wait)
goto end_function;
}
 
-
/* Add the event to the polling wait table */
dev_dbg(sep-pdev-dev, [PID%d] poll: calling wait sep_event\n,
current-pid);
@@ -856,7 +852,6 @@ static unsigned long sep_set_time(struct sep_device *sep)
struct timeval time;
u32 *time_addr; /* Address of time as seen by the kernel */
 
-
do_gettimeofday(time);
 
/* Set value in the SYSTEM MEMORY offset */
@@ -905,7 +900,6 @@ int sep_send_command_handler(struct sep_device *sep)
msg_pool += 1;
if ((*msg_pool  2) ||
(*msg_pool  SEP_DRIVER_MAX_MESSAGE_SIZE_IN_BYTES)) {
-
dev_warn(sep-pdev-dev, invalid message size\n);
error = -EPROTO;
goto end_function;
@@ -1023,7 +1017,6 @@ static int sep_crypto_dma(
 
*dma_maps = sep_dma;
return count_mapped;
-
 }
 
 /**
@@ -1053,7 +1046,6 @@ static int sep_crypto_lli(
u32 data_size,
enum dma_data_direction direction)
 {
-
int ct1;
struct sep_lli_entry *sep_lli;
struct sep_dma_map *sep_map;
@@ -1318,7 +1310,6 @@ static int sep_lock_user_pages(struct sep_device *sep,
(unsigned long)lli_array[0].bus_address,
lli_array[0].block_size);
 
-
/* Check the size of the last page */
if (num_pages  1) {
lli_array[num_pages - 1].block_size =
@@ -1663,7 +1654,6 @@ static void sep_build_lli_table(struct sep_device *sep,
 
/* Set the output parameter */
*num_processed_entries_ptr += array_counter;
-
 }
 
 /**
@@ -1747,7 +1737,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
/* Print entries of the table (without info entry) */
for (entries_count = 0; entries_count  num_table_entries;
entries_count++, lli_table_ptr++) {
-
dev_dbg(sep-pdev-dev,
[PID%d] lli_table_ptr address is %08lx\n,
current-pid,
@@ -1773,7 +1762,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
current-pid,
(unsigned long)lli_table_ptr-bus_address);
 
-
table_data_size = lli_table_ptr-block_size  0xff;
num_table_entries = (lli_table_ptr-block_size  24)  0xff;
 
@@ -1796,7 +1784,6 @@ static void sep_debug_print_lli_tables(struct sep_device 
*sep,
 #endif
 }
 
-
 /**
  * sep_prepare_empty_lli_table - create a blank LLI table
  * @sep: pointer to struct sep_device
@@ -1972,7 +1959,6 @@ static int sep_prepare_input_dma_table(struct sep_device 
*sep,
 
/* Loop till all the entries in in array are processed */
while (current_entry  sep_lli_entries) {
-
/* Set the new input and output tables */
in_lli_table_ptr =
(struct sep_lli_entry *)lli_table_alloc_addr;
@@ -1988,10 +1974,8 @@ static int sep_prepare_input_dma_table(struct sep_device 
*sep,
((void *)sep-shared_addr +
SYNCHRONIC_DMA_TABLES_AREA_OFFSET_BYTES +
SYNCHRONIC_DMA_TABLES_AREA_SIZE_BYTES)) {
-
error = -ENOMEM;
goto end_function_error;
-
}
 
/* Update the number of created tables */
@@ -2022,7 +2006,6 @@ static int sep_prepare_input_dma_table(struct 

Re: [PATCH 0/8] staging: unisys: visorchipset proc fixes

2014-07-19 Thread Ben Romer
Greg KH gre...@linuxfoundation.org wrote:

 What happened to the idea of only creating the sysfs files _if_ it is
 needed?  You are always creating these files, and then can return
 -ENODEV if the device really isn't there, that's not what you should do
 for a sysfs file.  If the file is present, it should return data, not
 return an error.  If the device isn't there, just don't create the file.

Greg,

I submitted a set of patches before this set that does just that. I moved the
controlvm channel function into visorchipset_main.c and removed the old files,
and made it so that if the channel is not present the module wouldn't load. I
also removed all the code that returns ENODEV, except for the module init
function, where it gets returned if there's no controlvm channel present.

I could change that to some other error, or let the module load and then not
create files if the channel isn't present, if you'd prefer that? But if the
module doesn't load, the files in sys don't get created, so I thought that
would be a good solution.

The commit numbers were 524b0b6 for the controlvm channel function, and
8a1182e for the extraneous checks and ENODEV errors being removed.

-- Ben

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


staging: lustre/lustre/lov: Cleanup style issues in lov_request.c

2014-07-19 Thread Riccardo Lucchese
Hello,

This patch series fixes two coding style issues and removes an unneeded
'if' statement in lov_request.c.

Thanks,
riccardo

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/3] staging: lustre/lustre/lov: Add a blank line after declarations in lov_request.c

2014-07-19 Thread Riccardo Lucchese
Fix the following checkpatch.pl issue in lov_request.c:
WARNING: Missing a blank line after declarations

Signed-off-by: Riccardo Lucchese riccardo.lucch...@gmail.com
---
 drivers/staging/lustre/lustre/lov/lov_request.c | 7 +--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
b/drivers/staging/lustre/lustre/lov/lov_request.c
index 90fc66a..d9344c7 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -141,14 +141,14 @@ void lov_set_add_req(struct lov_request *req, struct 
lov_request_set *set)
 static int lov_check_set(struct lov_obd *lov, int idx)
 {
int rc;
-   mutex_lock(lov-lov_lock);
 
+   mutex_lock(lov-lov_lock);
rc = lov-lov_tgts[idx] == NULL ||
lov-lov_tgts[idx]-ltd_active ||
(lov-lov_tgts[idx]-ltd_exp != NULL 
 
class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried);
-
mutex_unlock(lov-lov_lock);
+
return rc;
 }
 
@@ -835,6 +835,7 @@ static int cb_getattr_update(void *cookie, int rc)
 {
struct obd_info *oinfo = cookie;
struct lov_request *lovreq;
+
lovreq = container_of(oinfo, struct lov_request, rq_oi);
return lov_update_common_set(lovreq-rq_rqset, lovreq, rc);
 }
@@ -1017,6 +1018,7 @@ static int cb_setattr_update(void *cookie, int rc)
 {
struct obd_info *oinfo = cookie;
struct lov_request *lovreq;
+
lovreq = container_of(oinfo, struct lov_request, rq_oi);
return lov_update_setattr_set(lovreq-rq_rqset, lovreq, rc);
 }
@@ -1140,6 +1142,7 @@ static int cb_update_punch(void *cookie, int rc)
 {
struct obd_info *oinfo = cookie;
struct lov_request *lovreq;
+
lovreq = container_of(oinfo, struct lov_request, rq_oi);
return lov_update_punch_set(lovreq-rq_rqset, lovreq, rc);
 }
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/3] staging: lustre/lustre/lov: Remove unneeded 'if' statement in lov_request.c/lov_check_set()

2014-07-19 Thread Riccardo Lucchese
It is silly to go through an if statement to set a single boolean
value in function of a single boolean expression. In the function
lov_check_set, assign the return value directly.

Signed-off-by: Riccardo Lucchese riccardo.lucch...@gmail.com
---
 drivers/staging/lustre/lustre/lov/lov_request.c | 11 +--
 1 file changed, 5 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
b/drivers/staging/lustre/lustre/lov/lov_request.c
index ce830e4..90fc66a 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -140,14 +140,13 @@ void lov_set_add_req(struct lov_request *req, struct 
lov_request_set *set)
 
 static int lov_check_set(struct lov_obd *lov, int idx)
 {
-   int rc = 0;
+   int rc;
mutex_lock(lov-lov_lock);
 
-   if (lov-lov_tgts[idx] == NULL ||
-   lov-lov_tgts[idx]-ltd_active ||
-   (lov-lov_tgts[idx]-ltd_exp != NULL 
-class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried))
-   rc = 1;
+   rc = lov-lov_tgts[idx] == NULL ||
+   lov-lov_tgts[idx]-ltd_active ||
+   (lov-lov_tgts[idx]-ltd_exp != NULL 
+
class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried);
 
mutex_unlock(lov-lov_lock);
return rc;
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 3/3] staging: lustre/lustre/lov: Add a space before open braces '{' in lov_request.c

2014-07-19 Thread Riccardo Lucchese
Fix the following checkpatch.pl issue in lov_request.c:
ERROR: space required before the open brace '{'

Signed-off-by: Riccardo Lucchese riccardo.lucch...@gmail.com
---
 drivers/staging/lustre/lustre/lov/lov_request.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
b/drivers/staging/lustre/lustre/lov/lov_request.c
index d9344c7..57ee94d 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -477,7 +477,7 @@ int lov_prep_match_set(struct obd_export *exp, struct 
obd_info *oinfo,
GOTO(out_set, rc = -ENOMEM);
lockh-cookie = set-set_lockh-llh_handle.h_cookie;
 
-   for (i = 0; i  lsm-lsm_stripe_count; i++){
+   for (i = 0; i  lsm-lsm_stripe_count; i++) {
struct lov_oinfo *loi;
struct lov_request *req;
obd_off start, end;
@@ -565,7 +565,7 @@ int lov_prep_cancel_set(struct obd_export *exp, struct 
obd_info *oinfo,
}
lockh-cookie = set-set_lockh-llh_handle.h_cookie;
 
-   for (i = 0; i  lsm-lsm_stripe_count; i++){
+   for (i = 0; i  lsm-lsm_stripe_count; i++) {
struct lov_request *req;
struct lustre_handle *lov_lockhp;
struct lov_oinfo *loi = lsm-lsm_oinfo[i];
@@ -733,7 +733,7 @@ int lov_prep_brw_set(struct obd_export *exp, struct 
obd_info *oinfo,
 
/* alloc and initialize lov request */
shift = 0;
-   for (i = 0; i  oinfo-oi_md-lsm_stripe_count; i++){
+   for (i = 0; i  oinfo-oi_md-lsm_stripe_count; i++) {
struct lov_oinfo *loi = NULL;
struct lov_request *req;
 
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 0/8] staging: unisys: visorchipset proc fixes

2014-07-19 Thread Greg KH
On Sat, Jul 19, 2014 at 02:26:48PM -0400, Ben Romer wrote:
 Greg KH gre...@linuxfoundation.org wrote:
 
  What happened to the idea of only creating the sysfs files _if_ it is
  needed?  You are always creating these files, and then can return
  -ENODEV if the device really isn't there, that's not what you should do
  for a sysfs file.  If the file is present, it should return data, not
  return an error.  If the device isn't there, just don't create the file.
 
 Greg,
 
 I submitted a set of patches before this set that does just that. I moved the
 controlvm channel function into visorchipset_main.c and removed the old files,
 and made it so that if the channel is not present the module wouldn't load. I
 also removed all the code that returns ENODEV, except for the module init
 function, where it gets returned if there's no controlvm channel present.
 
 I could change that to some other error, or let the module load and then not
 create files if the channel isn't present, if you'd prefer that? But if the
 module doesn't load, the files in sys don't get created, so I thought that
 would be a good solution.
 
 The commit numbers were 524b0b6 for the controlvm channel function, and
 8a1182e for the extraneous checks and ENODEV errors being removed.

See my comments in your patch 1/8 for the specifics as to why I didn't
know that you have done this work (remember, I deal with hundreds of
patches a week and have no short term memory...)

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/8] staging: unisys: add toolaction to sysfs

2014-07-19 Thread Greg KH
On Sat, Jul 19, 2014 at 10:26:54AM -0400, Benjamin Romer wrote:
 +ssize_t show_toolaction(struct device *dev, struct device_attribute *attr,
 + char *buf)
 +{
 + if (ControlVm_channel) {
 + U8 toolAction;
 +
 + visorchannel_read(ControlVm_channel,
 + offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
 +ToolAction), toolAction, sizeof(U8));
 + return scnprintf(buf, PAGE_SIZE, %u\n, toolAction);
 + } else
 + return -ENODEV;
 +}
 +
 +ssize_t store_toolaction(struct device *dev, struct device_attribute *attr,
 + const char *buf, size_t count)
 +{
 + if (ControlVm_channel) {
 + U8 toolAction;
 +
 + if (sscanf(buf, %hhu\n, toolAction) == 1) {
 + if (visorchannel_write(ControlVm_channel,
 + offsetof(ULTRA_CONTROLVM_CHANNEL_PROTOCOL,
 + ToolAction),
 + toolAction, sizeof(U8))  0)
 + return -EFAULT;
 + else
 + return count;
 + } else
 + return -EIO;
 + } else
 + return -ENODEV;
 +}

How could ControlVm_channel ever be NULL?  Don't check for this, as the
file shouldn't even be here if ControlVm_channel is null.

Same goes for the other sysfs files in this patch series.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: lustre/lustre/lov: Remove unneeded 'if' statement in lov_request.c/lov_check_set()

2014-07-19 Thread Joe Perches
On Sat, 2014-07-19 at 21:34 +0200, Riccardo Lucchese wrote:
 It is silly to go through an if statement to set a single boolean
 value in function of a single boolean expression. In the function
 lov_check_set, assign the return value directly.
[]
 diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
 b/drivers/staging/lustre/lustre/lov/lov_request.c
[]
 @@ -140,14 +140,13 @@ void lov_set_add_req(struct lov_request *req, struct 
 lov_request_set *set)
  
  static int lov_check_set(struct lov_obd *lov, int idx)
  {
 - int rc = 0;
 + int rc;
   mutex_lock(lov-lov_lock);
  
 - if (lov-lov_tgts[idx] == NULL ||
 - lov-lov_tgts[idx]-ltd_active ||
 - (lov-lov_tgts[idx]-ltd_exp != NULL 
 -  class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried))
 - rc = 1;
 + rc = lov-lov_tgts[idx] == NULL ||
 + lov-lov_tgts[idx]-ltd_active ||
 + (lov-lov_tgts[idx]-ltd_exp != NULL 
 +  
 class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried);
  
   mutex_unlock(lov-lov_lock);
   return rc;

Maybe consider using a temporary for lov-lov_tgtx[idx] like:

---

 drivers/staging/lustre/lustre/lov/lov_request.c | 14 --
 1 file changed, 8 insertions(+), 6 deletions(-)

diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c
b/drivers/staging/lustre/lustre/lov/lov_request.c
index ce830e4..53a4575 100644
--- a/drivers/staging/lustre/lustre/lov/lov_request.c
+++ b/drivers/staging/lustre/lustre/lov/lov_request.c
@@ -140,16 +140,18 @@ void lov_set_add_req(struct lov_request *req,
struct lov_request_set *set)
 
 static int lov_check_set(struct lov_obd *lov, int idx)
 {
-   int rc = 0;
+   int rc;
+   struct lmv_tgt_desc *tgt;
+
mutex_lock(lov-lov_lock);
 
-   if (lov-lov_tgts[idx] == NULL ||
-   lov-lov_tgts[idx]-ltd_active ||
-   (lov-lov_tgts[idx]-ltd_exp != NULL 
-class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried))
-   rc = 1;
+   tgt = lov-lov_tgts[idx];
+   rc = (!tgt || tgt-ltd_active ||
+ (tgt-ltd_exp 
+  class_exp2cliimp(tgt-ltd_exp)-imp_connect_tried));
 
mutex_unlock(lov-lov_lock);
+
return rc;
 }
 


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH] staging:iio:ad7280a: Use managed interfaces

2014-07-19 Thread Julia Lawall


On Sat, 19 Jul 2014, Jonathan Cameron wrote:

 On 19/07/14 11:33, Himangi Saraogi wrote:
  This patch moves data allocated using unmanaged interfaces to managed
  interfaces like devm_kzalloc, devm_iio_device_register, devm_kasprintf,
  devm_request_threaded_irq and does away with the calls to free the
  allocated memory in the probe and remove functions. Some labels in the
  probe function are also removed.
  
  Signed-off-by: Himangi Saraogi himangi...@gmail.com
 cc'ing Lars who tends to look after Analog Devices drivers
 and more specifically was involved in the thread that lead to this
 patch.
 
 Also, the devm_kasprintf does not appear to be in upstream so this
 patch should have made an dependency clear.
 
 https://lkml.org/lkml/2014/7/16/667
 
 What is the intended merge path for that patch?

Greg said that he would be taking it.  He already took the devm_kasprintf 
patch.

julia

 
 
  ---
  I am not very sure if devmifying request_irq is a good idea as it
  leads to the freeing of the interrupt after the ad7280_write.
 Agreed. I wouldn't do it!
 
 Otherwise, all looks fine.
drivers/staging/iio/adc/ad7280a.c | 57
  ++-
1 file changed, 20 insertions(+), 37 deletions(-)
  
  diff --git a/drivers/staging/iio/adc/ad7280a.c
  b/drivers/staging/iio/adc/ad7280a.c
  index d215edf..3706b3e 100644
  --- a/drivers/staging/iio/adc/ad7280a.c
  +++ b/drivers/staging/iio/adc/ad7280a.c
  @@ -486,8 +486,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
{
  int dev, ch, cnt;
  
  -   st-channels = kcalloc((st-slave_num + 1) * 12 + 2,
  -  sizeof(*st-channels), GFP_KERNEL);
  +   st-channels = devm_kcalloc(st-spi-dev, (st-slave_num + 1) * 12 +
  2,
  +   sizeof(*st-channels), GFP_KERNEL);
  if (st-channels == NULL)
  return -ENOMEM;
  
  @@ -547,8 +547,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
{
  int dev, ch, cnt;
  
  -   st-iio_attr = kzalloc(sizeof(*st-iio_attr) * (st-slave_num + 1) *
  -   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
  +   st-iio_attr = devm_kzalloc(st-spi-dev, sizeof(*st-iio_attr) *
  +   (st-slave_num + 1) *
  +   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
  if (st-iio_attr == NULL)
  return -ENOMEM;
  
  @@ -564,7 +565,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
  st-iio_attr[cnt].dev_attr.store =
  ad7280_store_balance_sw;
  st-iio_attr[cnt].dev_attr.attr.name =
  -   kasprintf(GFP_KERNEL,
  +   devm_kasprintf(st-spi-dev, GFP_KERNEL,
  in%d-in%d_balance_switch_en,
  (dev * AD7280A_CELLS_PER_DEV) + ch,
  (dev * AD7280A_CELLS_PER_DEV) + ch +
  1);
  @@ -581,7 +582,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
  st-iio_attr[cnt].dev_attr.store =
  ad7280_store_balance_timer;
  st-iio_attr[cnt].dev_attr.attr.name =
  -   kasprintf(GFP_KERNEL,
  in%d-in%d_balance_timer,
  +   devm_kasprintf(st-spi-dev, GFP_KERNEL,
  +   in%d-in%d_balance_timer,
  (dev * AD7280A_CELLS_PER_DEV) + ch,
  (dev * AD7280A_CELLS_PER_DEV) + ch +
  1);
  ad7280_attributes[cnt] =
  @@ -900,48 +902,36 @@ static int ad7280_probe(struct spi_device *spi)
  
  ret = ad7280_attr_init(st);
  if (ret  0)
  -   goto error_free_channels;
  +   return ret;
  
  -   ret = iio_device_register(indio_dev);
  +   ret = devm_iio_device_register(spi-dev, indio_dev);
  if (ret)
  -   goto error_free_attr;
  +   return ret;
  
  if (spi-irq  0) {
  ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
 AD7280A_ALERT, 1,
 AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
  if (ret)
  -   goto error_unregister;
  +   return ret;
  
  ret = ad7280_write(st, AD7280A_DEVADDR(st-slave_num),
 AD7280A_ALERT, 0,
 AD7280A_ALERT_GEN_STATIC_HIGH |
 (pdata-chain_last_alert_ignore  0xF));
  if (ret)
  -   goto error_unregister;
  -
  -   ret = request_threaded_irq(spi-irq,
  -  NULL,
  -  ad7280_event_handler,
  -  IRQF_TRIGGER_FALLING |
  -  IRQF_ONESHOT,
  -  

Re: [PATCH] staging:iio:ad7280a: Use managed interfaces

2014-07-19 Thread Jonathan Cameron

On 19/07/14 21:46, Julia Lawall wrote:



On Sat, 19 Jul 2014, Jonathan Cameron wrote:


On 19/07/14 11:33, Himangi Saraogi wrote:

This patch moves data allocated using unmanaged interfaces to managed
interfaces like devm_kzalloc, devm_iio_device_register, devm_kasprintf,
devm_request_threaded_irq and does away with the calls to free the
allocated memory in the probe and remove functions. Some labels in the
probe function are also removed.

Signed-off-by: Himangi Saraogi himangi...@gmail.com

cc'ing Lars who tends to look after Analog Devices drivers
and more specifically was involved in the thread that lead to this
patch.

Also, the devm_kasprintf does not appear to be in upstream so this
patch should have made an dependency clear.

https://lkml.org/lkml/2014/7/16/667

What is the intended merge path for that patch?


Greg said that he would be taking it.  He already took the devm_kasprintf
patch.

Cool.  That's fine (and now you mention it - he did say that in the thread
I just forgot).  Still, it did want mentioning in the description for this
patch as well.


julia





---
I am not very sure if devmifying request_irq is a good idea as it
leads to the freeing of the interrupt after the ad7280_write.

Agreed. I wouldn't do it!

Otherwise, all looks fine.

   drivers/staging/iio/adc/ad7280a.c | 57
++-
   1 file changed, 20 insertions(+), 37 deletions(-)

diff --git a/drivers/staging/iio/adc/ad7280a.c
b/drivers/staging/iio/adc/ad7280a.c
index d215edf..3706b3e 100644
--- a/drivers/staging/iio/adc/ad7280a.c
+++ b/drivers/staging/iio/adc/ad7280a.c
@@ -486,8 +486,8 @@ static int ad7280_channel_init(struct ad7280_state *st)
   {
int dev, ch, cnt;

-   st-channels = kcalloc((st-slave_num + 1) * 12 + 2,
-  sizeof(*st-channels), GFP_KERNEL);
+   st-channels = devm_kcalloc(st-spi-dev, (st-slave_num + 1) * 12 +
2,
+   sizeof(*st-channels), GFP_KERNEL);
if (st-channels == NULL)
return -ENOMEM;

@@ -547,8 +547,9 @@ static int ad7280_attr_init(struct ad7280_state *st)
   {
int dev, ch, cnt;

-   st-iio_attr = kzalloc(sizeof(*st-iio_attr) * (st-slave_num + 1) *
-   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
+   st-iio_attr = devm_kzalloc(st-spi-dev, sizeof(*st-iio_attr) *
+   (st-slave_num + 1) *
+   AD7280A_CELLS_PER_DEV * 2, GFP_KERNEL);
if (st-iio_attr == NULL)
return -ENOMEM;

@@ -564,7 +565,7 @@ static int ad7280_attr_init(struct ad7280_state *st)
st-iio_attr[cnt].dev_attr.store =
ad7280_store_balance_sw;
st-iio_attr[cnt].dev_attr.attr.name =
-   kasprintf(GFP_KERNEL,
+   devm_kasprintf(st-spi-dev, GFP_KERNEL,
in%d-in%d_balance_switch_en,
(dev * AD7280A_CELLS_PER_DEV) + ch,
(dev * AD7280A_CELLS_PER_DEV) + ch +
1);
@@ -581,7 +582,8 @@ static int ad7280_attr_init(struct ad7280_state *st)
st-iio_attr[cnt].dev_attr.store =
ad7280_store_balance_timer;
st-iio_attr[cnt].dev_attr.attr.name =
-   kasprintf(GFP_KERNEL,
in%d-in%d_balance_timer,
+   devm_kasprintf(st-spi-dev, GFP_KERNEL,
+   in%d-in%d_balance_timer,
(dev * AD7280A_CELLS_PER_DEV) + ch,
(dev * AD7280A_CELLS_PER_DEV) + ch +
1);
ad7280_attributes[cnt] =
@@ -900,48 +902,36 @@ static int ad7280_probe(struct spi_device *spi)

ret = ad7280_attr_init(st);
if (ret  0)
-   goto error_free_channels;
+   return ret;

-   ret = iio_device_register(indio_dev);
+   ret = devm_iio_device_register(spi-dev, indio_dev);
if (ret)
-   goto error_free_attr;
+   return ret;

if (spi-irq  0) {
ret = ad7280_write(st, AD7280A_DEVADDR_MASTER,
   AD7280A_ALERT, 1,
   AD7280A_ALERT_RELAY_SIG_CHAIN_DOWN);
if (ret)
-   goto error_unregister;
+   return ret;

ret = ad7280_write(st, AD7280A_DEVADDR(st-slave_num),
   AD7280A_ALERT, 0,
   AD7280A_ALERT_GEN_STATIC_HIGH |
   (pdata-chain_last_alert_ignore  0xF));
if (ret)
-   goto error_unregister;
-
-   ret = request_threaded_irq(spi-irq,
-  

Re: [PATCH] staging: Fix a Fix me in tranzport.c

2014-07-19 Thread Nick Krause
On Sat, Jul 19, 2014 at 5:14 AM, Dan Carpenter dan.carpen...@oracle.com wrote:
 On Sat, Jul 19, 2014 at 12:09:53PM +0300, Dan Carpenter wrote:
 On Sat, Jul 19, 2014 at 01:26:52AM -0400, Nicholas Krause wrote:
  This patch add a atomic lock in usb_tranzport_usb for preventing
  a tiny race in this function.
 
  Signed-off-by: Nicholas Krause xerofo...@gmail.com

 Is this a guess work patch or have you tested it?

 Nevermind.  This patch doesn't even compile.

 regards,
 dan carpenter

I am new so how do I compile test a directory if you can test me
perhaps I can test my
changes better.
Cheers Nick
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 2/2] Staging: comedi: adv_pci1710.c line over 80 fixed

2014-07-19 Thread Sam Asadi
A line over 80 issue fixed, which is a comment.

Signed-off-by: Sam Asadi asadi.sam...@gmail.com
---
 drivers/staging/comedi/drivers/adv_pci1710.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 602b7a1..13ff78c 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -723,7 +723,8 @@ static int pci171x_ai_cancel(struct comedi_device *dev,
devpriv-CntrlReg = Control_CNT0;
devpriv-CntrlReg |= Control_SW;
 
-   outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL); /*  
reset any operations */
+   outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL);
+   /* reset any operations */
pci171x_start_pacer(dev, false);
outb(0, dev-iobase + PCI171x_CLRFIFO);
outb(0, dev-iobase + PCI171x_CLRINT);
-- 
1.9.1

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/1] Staging: comedi: 8255.c Missing a blank line fixed

2014-07-19 Thread Joe Perches
On Sun, 2014-07-20 at 03:43 +0300, Sam Asadi wrote:
 A 'Missing a blank line after declarations' issue fixed and also tested
 by 'make M=...'. It seems that after 'unsigned long iobase' declaration
 a blank line is desperately needed.
[]
 diff --git a/drivers/staging/comedi/drivers/8255.c 
 b/drivers/staging/comedi/drivers/8255.c
[]
 @@ -94,6 +94,7 @@ I/O port base address can be found in the output of 'lspci 
 -v'.
  
  struct subdev_8255_private {
   unsigned long iobase;
 +
   int (*io)(int, int, int, unsigned long);
  };
  

You used an old version of checkpatch without a
modification to the blank line after declarations
test that supports function pointers.

Use the latest version from --next instead.

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/4] staging: sep: No else is necessary after a break (reported by checkpatch)

2014-07-19 Thread Joe Perches
(Adding Mark Allyn and Jayant Mangalampalli)

Is this still project still active?

On Sat, 2014-07-19 at 19:34 +0200, LABBE Corentin wrote:
 Signed-off-by: LABBE Corentin clabbe.montj...@gmail.com
 ---
  drivers/staging/sep/sep_main.c | 5 ++---
  1 file changed, 2 insertions(+), 3 deletions(-)
 
 diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
 index 177e4b9..1580d95f 100644
 --- a/drivers/staging/sep/sep_main.c
 +++ b/drivers/staging/sep/sep_main.c
 @@ -2881,12 +2881,11 @@ static int sep_free_dma_tables_and_dcb(struct 
 sep_device *sep, bool isapplet,
   if (is_kva) {
   error = -ENODEV;
   break;
 - } else {
 - error_temp = copy_to_user(
 + }
 + error_temp = copy_to_user(
   (void __user *)tail_pt,
   dcb_table_ptr-tail_data,
   dcb_table_ptr-tail_data_size);
 - }
   if (error_temp) {
   /* Release the DMA resource */
   error = -EFAULT;

It'd be probably be better to rewrite the code to unindent
a level by using continue.  Something like below:

btw:

the is_kva test looks very odd and should probably be
moved outside the loop.

pt_hold should probably be void * not unsigned long
as it loses high order bits on x86-32.

definition:
aligned_u64 out_vr_tail_pt;
use:
+   pt_hold = (unsigned long)dcb_table_ptr-
+   out_vr_tail_pt;

---
 drivers/staging/sep/sep_main.c | 37 +
 1 file changed, 17 insertions(+), 20 deletions(-)

diff --git a/drivers/staging/sep/sep_main.c b/drivers/staging/sep/sep_main.c
index 75ca15e..24b4a54 100644
--- a/drivers/staging/sep/sep_main.c
+++ b/drivers/staging/sep/sep_main.c
@@ -2871,26 +2871,23 @@ static int sep_free_dma_tables_and_dcb(struct 
sep_device *sep, bool isapplet,
 * Go over each DCB and see if
 * tail pointer must be updated
 */
-   for (i = 0; i  (*dma_ctx)-nr_dcb_creat;
-i++, dcb_table_ptr++) {
-   if (dcb_table_ptr-out_vr_tail_pt) {
-   pt_hold = (unsigned long)dcb_table_ptr-
-   out_vr_tail_pt;
-   tail_pt = (void *)pt_hold;
-   if (is_kva) {
-   error = -ENODEV;
-   break;
-   } else {
-   error_temp = copy_to_user(
-   (void __user *)tail_pt,
-   dcb_table_ptr-tail_data,
-   dcb_table_ptr-tail_data_size);
-   }
-   if (error_temp) {
-   /* Release the DMA resource */
-   error = -EFAULT;
-   break;
-   }
+   for (i = 0; i  (*dma_ctx)-nr_dcb_creat; i++, dcb_table_ptr++) 
{
+   if (!dcb_table_ptr-out_vr_tail_pt)
+   continue;
+   pt_hold = (unsigned long)dcb_table_ptr-
+   out_vr_tail_pt;
+   tail_pt = (void *)pt_hold;
+   if (is_kva) {
+   error = -ENODEV;
+   break;
+   }
+   error_temp = copy_to_user((void __user *)tail_pt,
+ dcb_table_ptr-tail_data,
+ 
dcb_table_ptr-tail_data_size);
+   if (error_temp) {
+   /* Release the DMA resource */
+   error = -EFAULT;
+   break;
}
}
}


___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 2/2] Staging: comedi: adv_pci1710.c line over 80 fixed

2014-07-19 Thread Greg KH
On Sun, Jul 20, 2014 at 04:15:50AM +0300, Sam Asadi wrote:
 A line over 80 issue fixed, which is a comment.
 
 Signed-off-by: Sam Asadi asadi.sam...@gmail.com
 ---
  drivers/staging/comedi/drivers/adv_pci1710.c | 3 ++-
  1 file changed, 2 insertions(+), 1 deletion(-)
 
 diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
 b/drivers/staging/comedi/drivers/adv_pci1710.c
 index 602b7a1..13ff78c 100644
 --- a/drivers/staging/comedi/drivers/adv_pci1710.c
 +++ b/drivers/staging/comedi/drivers/adv_pci1710.c
 @@ -723,7 +723,8 @@ static int pci171x_ai_cancel(struct comedi_device *dev,
   devpriv-CntrlReg = Control_CNT0;
   devpriv-CntrlReg |= Control_SW;
  
 - outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL); /*  
 reset any operations */
 + outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL);
 + /* reset any operations */

That really doesn't make any sense now, does it?

Please put it _before_ the outw() call.

thanks,

greg k-h
___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] staging: android: ion: ion_cma_heap.c: Fix checkpatch warning

2014-07-19 Thread Phong Tran
This patch fix coding style:

- Remove fail memory allocation waring
- Remove return of void function

Tested by compilation only

Signed-off-by: Phong Tran tranmanph...@gmail.com
---
 drivers/staging/android/ion/ion_cma_heap.c | 9 ++---
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/drivers/staging/android/ion/ion_cma_heap.c 
b/drivers/staging/android/ion/ion_cma_heap.c
index ce68ecf..f8cabcb 100644
--- a/drivers/staging/android/ion/ion_cma_heap.c
+++ b/drivers/staging/android/ion/ion_cma_heap.c
@@ -76,10 +76,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
return -EINVAL;
 
info = kzalloc(sizeof(struct ion_cma_buffer_info), GFP_KERNEL);
-   if (!info) {
-   dev_err(dev, Can't allocate buffer info\n);
+   if (!info)
return ION_CMA_ALLOCATE_FAILED;
-   }
 
info-cpu_addr = dma_alloc_coherent(dev, len, (info-handle),
GFP_HIGHUSER | __GFP_ZERO);
@@ -90,10 +88,8 @@ static int ion_cma_allocate(struct ion_heap *heap, struct 
ion_buffer *buffer,
}
 
info-table = kmalloc(sizeof(struct sg_table), GFP_KERNEL);
-   if (!info-table) {
-   dev_err(dev, Fail to allocate sg table\n);
+   if (!info-table)
goto free_mem;
-   }
 
if (ion_cma_get_sgtable
(dev, info-table, info-cpu_addr, info-handle, len))
@@ -155,7 +151,6 @@ static struct sg_table *ion_cma_heap_map_dma(struct 
ion_heap *heap,
 static void ion_cma_heap_unmap_dma(struct ion_heap *heap,
   struct ion_buffer *buffer)
 {
-   return;
 }
 
 static int ion_cma_mmap(struct ion_heap *mapper, struct ion_buffer *buffer,
-- 
1.9.3

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH 1/1] Staging: comedi: adv_pci1710: a line over 80 fixed

2014-07-19 Thread Sam Asadi
a line over 80 issue fixed by removing the cross-lined comment
to the previous line.

Signed-off-by: Sam Asadi asadi.sam...@gmail.com
---
 drivers/staging/comedi/drivers/adv_pci1710.c |5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/comedi/drivers/adv_pci1710.c 
b/drivers/staging/comedi/drivers/adv_pci1710.c
index 602b7a1..040a5cb 100644
--- a/drivers/staging/comedi/drivers/adv_pci1710.c
+++ b/drivers/staging/comedi/drivers/adv_pci1710.c
@@ -722,8 +722,9 @@ static int pci171x_ai_cancel(struct comedi_device *dev,
default:
devpriv-CntrlReg = Control_CNT0;
devpriv-CntrlReg |= Control_SW;
-
-   outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL); /*  
reset any operations */
+
+   /* reset any operations */
+   outw(devpriv-CntrlReg, dev-iobase + PCI171x_CONTROL);
pci171x_start_pacer(dev, false);
outb(0, dev-iobase + PCI171x_CLRFIFO);
outb(0, dev-iobase + PCI171x_CLRINT);
-- 
1.7.10.4

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


Re: [PATCH 1/3] staging: lustre/lustre/lov: Remove unneeded 'if' statement in lov_request.c/lov_check_set()

2014-07-19 Thread Dan Carpenter
On Sat, Jul 19, 2014 at 09:34:56PM +0200, Riccardo Lucchese wrote:
 It is silly to go through an if statement to set a single boolean
 value in function of a single boolean expression. In the function
 lov_check_set, assign the return value directly.
 
 Signed-off-by: Riccardo Lucchese riccardo.lucch...@gmail.com
 ---
  drivers/staging/lustre/lustre/lov/lov_request.c | 11 +--
  1 file changed, 5 insertions(+), 6 deletions(-)
 
 diff --git a/drivers/staging/lustre/lustre/lov/lov_request.c 
 b/drivers/staging/lustre/lustre/lov/lov_request.c
 index ce830e4..90fc66a 100644
 --- a/drivers/staging/lustre/lustre/lov/lov_request.c
 +++ b/drivers/staging/lustre/lustre/lov/lov_request.c
 @@ -140,14 +140,13 @@ void lov_set_add_req(struct lov_request *req, struct 
 lov_request_set *set)
  
  static int lov_check_set(struct lov_obd *lov, int idx)
  {
 - int rc = 0;
 + int rc;
   mutex_lock(lov-lov_lock);
  
 - if (lov-lov_tgts[idx] == NULL ||
 - lov-lov_tgts[idx]-ltd_active ||
 - (lov-lov_tgts[idx]-ltd_exp != NULL 
 -  class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried))
 - rc = 1;
 + rc = lov-lov_tgts[idx] == NULL ||
 + lov-lov_tgts[idx]-ltd_active ||
 + (lov-lov_tgts[idx]-ltd_exp != NULL 
 +  
 class_exp2cliimp(lov-lov_tgts[idx]-ltd_exp)-imp_connect_tried);

I don't see how this makes the code more readable at all.

regards,
dan carpenter

___
devel mailing list
de...@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel


[PATCH] Staging: vt6655: remove redundant comments

2014-07-19 Thread Igor Bezukh
Clean redundant comments in the code.
Since I perform single fix type per patch, I've ignored the 80 line warning
when checking the patch against checkpatch.
I will fix the 80 line warnings on further patches.

Signed-off-by: Igor Bezukh igb...@gmail.com
---
 drivers/staging/vt6655/wcmd.c |   46 -
 1 file changed, 13 insertions(+), 33 deletions(-)

diff --git a/drivers/staging/vt6655/wcmd.c b/drivers/staging/vt6655/wcmd.c
index a689645..2456b30 100644
--- a/drivers/staging/vt6655/wcmd.c
+++ b/drivers/staging/vt6655/wcmd.c
@@ -54,13 +54,7 @@
 #include iowpa.h
 #include channel.h
 
-/*-  Static Definitions -*/
-
-/*-  Static Classes  */
-
-/*-  Static Variables  --*/
 static int msglevel = MSG_LEVEL_INFO;
-/*-  Static Functions  --*/
 
 static
 void
@@ -85,10 +79,6 @@ s_bCommandComplete(
PSDevice pDevice
 );
 
-/*-  Export Variables  --*/
-
-/*-  Export Functions  --*/
-
 /*
  * Description:
  *  Stop AdHoc beacon during scan process
@@ -134,7 +124,7 @@ vAdHocBeaconStop(PSDevice  pDevice)
 
if (bStop)
MACvRegBitsOff(pDevice-PortOffset, MAC_REG_TCR, TCR_AUTOBCNTX);
-} /* vAdHocBeaconStop */
+}
 
 /*
  * Description:
@@ -167,7 +157,7 @@ vAdHocBeaconRestart(PSDevice pDevice)
}
 }
 
-/*+
+/*
  *
  * Routine Description:
  *   Prepare and send probe request management frames.
@@ -176,7 +166,7 @@ vAdHocBeaconRestart(PSDevice pDevice)
  * Return Value:
  *none.
  *
- -*/
+ */
 
 static
 void
@@ -223,7 +213,7 @@ s_vProbeChannel(
}
 }
 
-/*+
+/*
  *
  * Routine Description:
  *  Constructs an probe request frame
@@ -232,7 +222,7 @@ s_vProbeChannel(
  * Return Value:
  *A ptr to Tx frame or NULL on allocation failure
  *
- -*/
+ */
 
 PSTxMgmtPacket
 s_MgrMakeProbeRequest(
@@ -292,7 +282,6 @@ vCommandTimerWait(
init_timer(pDevice-sTimerCommand);
pDevice-sTimerCommand.data = (unsigned long) pDevice;
pDevice-sTimerCommand.function = (TimerFunction)vCommandTimer;
-   // RUN_AT :1 msec ~= (HZ/1024)
pDevice-sTimerCommand.expires = (unsigned int)RUN_AT((MSecond * HZ)  
10);
add_timer(pDevice-sTimerCommand);
return;
@@ -366,9 +355,8 @@ vCommandTimer(
s_bCommandComplete(pDevice);
 
} else {
-//2008-8-4 add by chester
if (!is_channel_valid(pMgmt-uScanChannel)) {
-   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO Invalid 
channel pMgmt-uScanChannel = %d \n, pMgmt-uScanChannel);
+   DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO Invalid 
channel pMgmt-uScanChannel = %d\n, pMgmt-uScanChannel);
s_bCommandComplete(pDevice);
spin_unlock_irq(pDevice-lock);
return;
@@ -394,7 +382,6 @@ vCommandTimer(
 
CARDbSetBSSID(pMgmt-pAdapter, pMgmt-abyCurrBSSID, 
OP_MODE_UNKNOWN);
pMgmt-uScanChannel++;
-//2008-8-4 modify by chester
if (!is_channel_valid(pMgmt-uScanChannel) 
pMgmt-uScanChannel = pDevice-byMaxChannel) {
pMgmt-uScanChannel = pDevice-byMaxChannel + 1;
@@ -431,7 +418,6 @@ vCommandTimer(
 
pMgmt-eScanState = WMAC_NO_SCANNING;
vAdHocBeaconRestart(pDevice);
-//2008-0409-07, Add by Einsn Liu
 #ifdef WPA_SUPPLICANT_DRIVER_WEXT_SUPPORT
if (pMgmt-eScanType == WMAC_SCAN_PASSIVE)
{//send scan event to wpa_Supplicant
@@ -471,7 +457,6 @@ vCommandTimer(
return;
}
DBG_PRT(MSG_LEVEL_DEBUG, KERN_INFO  CARDbRadioPowerOff\n);
-   //2008-09-02  markby chester
s_bCommandComplete(pDevice);
break;
 
@@ -482,7 +467,6 @@ vCommandTimer(
spin_unlock_irq(pDevice-lock);
return;
}
-//2008-09-02  mark by chester
s_bCommandComplete(pDevice);
break;
 
@@ -615,7 +599,7 @@ vCommandTimer(
 
else if (pMgmt-eCurrState  WMAC_STATE_AUTHPENDING) {
printk(WLAN_AUTHENTICATE_WAIT:Authen Fail???\n);
-   } else if (pDevice-byLinkWaitCount = 4) {//mike add:wait 
another 2 sec if authenticated_frame delay!
+   } else if (pDevice-byLinkWaitCount = 4) {
pDevice-byLinkWaitCount++;
printk(WLAN_AUTHENTICATE_WAIT:wait %d times!!\n, 
pDevice-byLinkWaitCount);
spin_unlock_irq(pDevice-lock);
@@ -652,7 +636,7 @@ vCommandTimer(