aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/most (follow)
AgeCommit message (Collapse)AuthorFilesLines
2016-03-22staging: most: hdm-dim2: Remove possible dereference errorAmitoj Kaur Chawla1-1/+1
Commit 3eced21a5afb ("staging: most: hdm-dim2: Replace request_irq with devm_request_irq") introduced the following static checker warning: drivers/staging/most/hdm-dim2/dim2_hdm.c:841 dim2_probe() error: 'dev->netinfo_task' dereferencing possible ERR_PTR() Remove the bug introduced by the commit due to change in control flow by returning PTR_ERR immediately rather than returning at the end of the function since we do not need to free anything. Fixes: 3eced21a5afb Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-11staging: most: hdm-usb: Remove invalid reference errorAmitoj Kaur Chawla1-2/+1
commit e3479f77("staging: most: hdm-usb: Remove create_workqueue()") cancel_work_sync(&anchor->clear_work_obj) is introduced after freeing `anchor` causing a invalid reference error. This patch removes this error by shifting the call to cancel_work_sync before freeing `anchor`. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10Staging: most: Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN).Sandhya Bankar1-1/+1
Use usb_endpoint_dir_in(endpoint) instead of (endpoint->bEndpointAddress & USB_DIR_IN) to check if the endpoint has IN direction. This correction is based on following semantic patch, @@ struct usb_endpoint_descriptor *endpoint; expression E; @@ ( - endpoint->bEndpointAddress & USB_DIR_IN + usb_endpoint_dir_in(endpoint) | - endpoint->bEndpointAddress == USB_DIR_IN + usb_endpoint_dir_in(endpoint) | - (endpoint->bEndpointAddress & E) == USB_DIR_IN + usb_endpoint_dir_in(endpoint) ) Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10Staging: most: Use list_first_entry instead of list_entryBhumika Goyal1-3/+3
This patch replaces list_entry with list_first_entry as it makes the code more clear. Done using coccinelle: @@ expression e; @@ ( - list_entry(e->next, + list_first_entry(e, ...) | - list_entry(e->prev, + list_last_entry(e, ...) ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-03-10Staging: most: Replace pr_err with dev_errBhumika Goyal1-2/+2
All devm functions has a device structure as the first argument which is required by dev_{err,info,dbg} printing functions. This patch converts pr_err to dev_err as dev_* is preferred after calls to devm functions. Done using coccinelle: @r1 exists@ expression e,e1; identifier f =~ "^devm_"; identifier g =~ "^pcim_"; identifier h =~ "^dmam_"; @@ e=\(f\|g\|h\)(e1,...); <+... ( - pr_info( + dev_info(e1, ...); | - pr_err( + dev_err(e1, ...); | - pr_debug( + dev_dbg(e1, ...); ) ...+> Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25staging: most: hdm-usb: Use macro DIV_ROUND_UPBhaktipriya Shridhar1-2/+1
The macro DIV_ROUND_UP performs the computation (((n) + (d) - 1) /(d)). It clarifies the divisor calculations. This occurence was detected using the coccinelle script: @@ expression e1; expression e2; @@ ( - ((e1) + e2 - 1) / (e2) + DIV_ROUND_UP(e1,e2) | - ((e1) + (e2 - 1))/ (e2) + DIV_ROUND_UP(e1,e2) ) The macro CEILING was dropped altogether and has been replaced with DIV_ROUND_UP. Signed-off-by: Bhaktipriya Shridhar <bhaktipriya96@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25Staging: most: Do not print message if kzalloc() failed.Sandhya Bankar1-1/+0
Do not print message if kzalloc() failed. kzalloc() has its own messages. So no need to add extra one. Signed-off-by: Sandhya Bankar <bankarsandhya512@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-25staging: most: compress return logic into one lineEva Rachel Retuya1-3/+1
Eliminate local variable 'ret' and modify return statement to contain the value being returned directly instead of assigning it first to 'ret' and returning this variable. Coccinelle semantic patch used: @@ expression e, ret; @@ -ret = +return e; -return ret; Signed-off-by: Eva Rachel Retuya <eraretuya@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: most: hdm-usb: Remove create_workqueue()Amitoj Kaur Chawla1-11/+6
With concurrency managed workqueues, use of dedicated workqueues can be replaced by using system_wq. Drop schedule_usb_work by using system_wq. Since there is only one work item per buf_anchor and most_dev and they do not need to be ordered, increase of concurrency by switching to system_wq should not break anything. Both work items are sync canceled before the driver can be unregistered, to ensure no work item is pending or executing on any CPU by the time exit path is in flight. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: most: hdm-dim2: Replace pr_err with dev_errAmitoj Kaur Chawla1-3/+3
Replace pr_err with dev_err when a appropriate device structure is present. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: most: hdm-dim2: Replace request_irq with devm_request_irqAmitoj Kaur Chawla1-11/+3
Devm_ functions allocate memory that is released when a driver detaches. Replace request_irq with devm_request_irq to get the interrupt for device which is automatically freed on exit. Remove corresponding free_irq from probe and remove functions of a platform device. Also, remove an unnecessary label. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: most: hdm-dim2: Switch to devm_ioremap_resource()Amitoj Kaur Chawla1-28/+5
Devm_ functions allocate memory that is released when a driver detaches. Replace request_mem_region and ioremap with devm_ioremap_resource and remove corresponding freeing functions release_mem_region and iounmap from probe and remove functions of a platform device. Also, an unnecessary platform_set_drvdata() has been removed since the driver core clears the driver data to NULL after device release or on probe failure. There is no need to manually clear the device driver data to NULL. Lastly, unnecessary labels have been removed. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-20staging: most: hdm-dim2: Replace kzalloc with devm_kzallocAmitoj Kaur Chawla1-6/+3
Devm_ functions allocate memory that is released when a driver detaches. Replace kzalloc with devm_kzalloc and remove corresponding kfrees from probe and remove functions of a platform device. Also, an unnecessary label has been removed. Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11staging: most: return proper errorSudip Mukherjee1-8/+19
We were returning ENOMEM on all types of errors. Lets return the actual error code. At the same time remove the label which became unused as a result of this patch. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-11staging: most: return error valueSudip Mukherjee1-2/+2
On error we were returning retval, but retval is not having the error value. We will get the error value using PTR_ERR. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: add __iomem for io_base and registersHugo Camboulive4-9/+10
This removes a few Sparse warnings. Signed-off-by: Hugo Camboulive <hugo.camboulive@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: replace multiple if..else with table lookupHari Prasath Gujulan Elango1-17/+24
Replace multiple if..else if..statements with simple table lookup in two functions. Signed-off-by: Hari Prasath Gujulan Elango <hgujulan@visteon.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: fix error comparisonSudip Mukherjee1-1/+1
device_create() returns ERR_PTR on error, it does not return NULL. Signed-off-by: Sudip Mukherjee <sudip@vectorindia.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove 2nd forward declaration of struct most_aimChristian Gromm1-2/+0
This patch removes the second forwared declaration of struct most_aim. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: add statistics for dropped packetsChristian Gromm1-3/+8
This patch adds a counter for dropped packets. It needed for statistical analysis. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: rearrange function aim_writeChristian Gromm1-18/+14
This patch straightens and rearranges the code of function aim_write() of module aim-cdev. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove stacked_mboChristian Gromm1-13/+3
This patch makes use of kfifo_peek and kfifo_skip, which renders the variable stacked_mbo useless. It is therefore removed. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: change type of access_refChristian Gromm1-9/+8
This patch changes the type of the access reference from atomit_t to int. It is needed, because the reference variable is secured by synchronization locks and does not need to be atomic anymore. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: fix race conditionsChristian Gromm1-35/+54
This patch fixes race conditions that might emerge from functions aim_open, aim_close, aim_read, aim_write and aim_disconnect_channel within module cdev. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: rename variable channelChristian Gromm1-108/+108
This patch renames the variable 'channel' to 'c'. This is needed to have the code look more homogeneous and to prevent format violations. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: fix retrieval of buffer availabilityChristian Gromm3-8/+14
This patch fixes the function channel_has_mbo that delivers the false information in case two AIMs are using the same tx channel. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: encapsulate shared codeChristian Gromm1-26/+29
This patch encapsulates shared code. It therefore creates the new functions stop_channel and destroy_cdev. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove redundant call to wake_up_interruptibleChristian Gromm1-2/+0
This patch prevents the cdev module from rousing the channel wait queue in case the channel is about to be closed. It is safe to do so, because the application can not be waiting within read or write and at the same time be calling close. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove redundant mutexesChristian Gromm1-9/+0
This patch removes the mutexes stop_task_mutex and deregister mutex, since they can safely be left out. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove code to destroy channelChristian Gromm1-13/+0
This patch removes unnecessary code to destroy channel objects. It is needed, because function most_stop_channel, which is indirectly triggered by function most_deregister_interface, already destroys the channels. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove reference counterChristian Gromm1-12/+1
This patch removes the unnecessary reference conter mod_ref. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove tainted flagChristian Gromm1-32/+1
This patch removes the atomic tainted flag. It is needed to get rid of logical overhead. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: move channel disconnect to function most_deregister_interfaceChristian Gromm1-13/+11
This patch moves the code that disconnects linked channels. It is needed to have cleaning things up done right. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: move mutexChristian Gromm1-2/+1
This patch removes mutex from code that doesn't need any locking. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: move initialization of pointerChristian Gromm1-2/+5
This patch makes function store_add_link initialize the pointer to an AIM right before the channel is probed. It is needed, the AIM may already call most_start_channel while probe_channel is still running. At this point the pointer to the AIM must not be NULL. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: move call to disconnect_channel callbackChristian Gromm1-2/+2
This patch invokes AIM's disconnect_channel callback before the corresponding pointers are re-initialized to NULL. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: add missing call to ida_simple_removeChristian Gromm1-0/+2
This patch adds two missing calls to function ida_simpel_remove. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove function destroy_most_c_objChristian Gromm1-24/+14
This patch removes the function destroy_most_c_obj and executes its code within function destroy_most_inst_obj. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: use readl and writel functionsChristian Gromm1-2/+2
This patch makes use of functions readl and writel instead of the __raw_* variants. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: fix tracking of MBO offsetChristian Gromm1-3/+2
This patch increments mbo_offs by the number of bytes that have been copied and resets it in case a complete mbo has been transferred to user buffer. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: fix mbo leakChristian Gromm1-1/+1
This patch fixes a potential MBO leak in case function aim_read() exits right after the MBO has been fetched from kfifo and before it has been saved to the variable stacked_mbo. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: use min_tChristian Gromm1-1/+3
This patch replaces min with min_t. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: unify typesChristian Gromm1-5/+3
This patch unifies variable types to get less castings. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: simplify expressionChristian Gromm1-1/+1
This patch replaces the ternary ?-operator with a way simpler subtraction. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: rename variablesChristian Gromm1-8/+8
This patch renames some variables for better readability. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2016-02-07staging: most: remove unnecessary keep_mbo variableChristian Gromm1-8/+4
The MBO pointer stacked_mbo and the boolean variable keep_mbo are always changed together and therefore provide the same information. This patch removes keep_mbo and uses stacked_mbo instead. Signed-off-by: Christian Gromm <christian.gromm@microchip.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15staging: most: Delete an unnecessary check before the function call "module_put"Markus Elfring1-2/+1
The module_put() function tests whether its argument is NULL and then returns immediately. Thus the test around the call is not needed. This issue was detected by using the Coccinelle software. Signed-off-by: Markus Elfring <elfring@users.sourceforge.net> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15staging: most: rename DIM_EnqueueBuffer to dim_enqueue_bufferChaehyun Lim3-6/+7
This patch renames DIM_EnqueueBuffer to dim_enqueue_buffer to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: <DIM_EnqueueBuffer> FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:877: Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15staging: most: rename DIM_GetChannelState to dim_get_channel_stateChaehyun Lim3-6/+6
This patch renames DIM_GetChannelState to dim_get_channel_state to avoid camelcase found by checkpatch. CHECK: Avoid CamelCase: <DIM_GetChannelState> FILE: drivers/staging/most/hdm-dim2/dim2_hal.c:865: Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2015-11-15staging: most: fix argument name of DIM_GetChannelStateChaehyun Lim1-1/+1
The second argument name of DIM_GetChannelState declaration changes from dim_ch_state_ptr to state_ptr. The DIM_GetChannelState declaration and definition has same argument name as state_ptr. Signed-off-by: Chaehyun Lim <chaehyun.lim@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>