Re: [PATCH V3 2/7] Drivers: scsi: storvsc: Set cmd_per_lun to reflect value supported by the Host
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: Set cmd_per_lun to reflect value supported by the Host. In this version of the patch I have addressed comments from Christoph Hellwig h...@infradead.org Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 8938b13..cebcef7 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1690,7 +1690,7 @@ static struct scsi_host_template scsi_driver = { .slave_alloc = storvsc_device_alloc, .slave_destroy =storvsc_device_destroy, .slave_configure = storvsc_device_configure, - .cmd_per_lun = 1, + .cmd_per_lun = 255, .can_queue =STORVSC_MAX_IO_REQUESTS*STORVSC_MAX_TARGETS, .this_id = -1, /* no use setting to 0 since ll_blk_rw reset it to 1 */ Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 4/7] Drivers: scsi: storvsc: Fix a bug in handling VMBUS protocol version
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: Based on the negotiated VMBUS protocol version, we adjust the size of the storage protocol messages. The two sizes we currently handle are pre-win8 and post-win8. In WS2012 R2, we are negotiating higher VMBUS protocol version than the win8 version. Make adjustments to correctly handle this. In this version of the patch I have addressed comments from Christoph Hellwig h...@infradead.org Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c | 17 ++--- 1 files changed, 10 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 8f8847e..7e8a642 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1752,19 +1752,22 @@ static int storvsc_probe(struct hv_device *device, * set state to properly communicate with the host. */ - if (vmbus_proto_version == VERSION_WIN8) { - 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; - } else { + switch (vmbus_proto_version) { + case VERSION_WS2008: + case VERSION_WIN7: 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; + break; + default: + 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; + break; } - if (dev_id-driver_data == SFC_GUID) scsi_driver.can_queue = (STORVSC_MAX_IO_REQUESTS * STORVSC_FC_MAX_TARGETS); Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 3/7] Drivers: scsi: storvsc: Filter commands based on the storage protocol version
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: Going forward it is possible that some of the commands that are not currently implemented will be implemented on future Windows hosts. Even if they are not implemented, we are told the host will corrrectly handle unsupported commands (by returning appropriate return code and sense information). Make command filtering depend on the host version. In this version of the patch I have addressed comments from Christoph Hellwig h...@infradead.org Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c | 16 +--- 1 files changed, 13 insertions(+), 3 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index cebcef7..8f8847e 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1553,9 +1553,19 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) struct vmscsi_request *vm_srb; struct stor_mem_pools *memp = scmnd-device-hostdata; - if (!storvsc_scsi_cmd_ok(scmnd)) { - scmnd-scsi_done(scmnd); - return 0; + if (vmstor_current_major = VMSTOR_WIN8_MAJOR) { + /* +* On legacy hosts filter unimplemented commands. +* Future hosts are expected to correctly handle +* unsupported commands. Furthermore, it is +* possible that some of the currently +* unsupported commands maybe supported in +* future versions of the host. +*/ + if (!storvsc_scsi_cmd_ok(scmnd)) { + scmnd-scsi_done(scmnd); + return 0; + } } request_size = sizeof(struct storvsc_cmd_request); Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/7] Drivers: scsi: storvsc: Implement a timedout handler
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: On Azure, we have seen instances of unbounded I/O latencies. To deal with this issue, implement handler that can reset the timeout. Note that the host gaurantees that it will respond to each command that has been issued. Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c | 10 ++ 1 files changed, 10 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 7e8a642..3516761 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -33,6 +33,7 @@ #include linux/device.h #include linux/hyperv.h #include linux/mempool.h +#include linux/blkdev.h #include scsi/scsi.h #include scsi/scsi_cmnd.h #include scsi/scsi_host.h @@ -1518,6 +1519,14 @@ static int storvsc_host_reset_handler(struct scsi_cmnd *scmnd) return SUCCESS; } +static enum blk_eh_timer_return storvsc_timeout_handler(struct scsi_cmnd *scmnd) +{ + /* +* The host will respond; ask for more time. +*/ + return BLK_EH_RESET_TIMER; +} + static bool storvsc_scsi_cmd_ok(struct scsi_cmnd *scmnd) { bool allowed = true; @@ -1697,6 +1706,7 @@ static struct scsi_host_template scsi_driver = { .bios_param = storvsc_get_chs, .queuecommand = storvsc_queuecommand, .eh_host_reset_handler =storvsc_host_reset_handler, + .eh_timed_out = storvsc_timeout_handler, .slave_alloc = storvsc_device_alloc, .slave_destroy =storvsc_device_destroy, .slave_configure = storvsc_device_configure, Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 7/7] drivers: scsi: storvsc: Correctly handle TEST_UNIT_READY failure
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: On some Windows hosts on FC SANs, TEST_UNIT_READY can return SRB_STATUS_ERROR. Correctly handle this. Note that there is sufficient sense information to support scsi error handling even in this case. In this version of the patch I have addressed comments from Christoph Hellwig h...@infradead.org Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c |7 +++ 1 files changed, 7 insertions(+), 0 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 9342ba4..29d0329 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1018,6 +1018,13 @@ static void storvsc_handle_error(struct vmscsi_request *vm_srb, case ATA_12: set_host_byte(scmnd, DID_PASSTHROUGH); break; + /* +* On Some Windows hosts TEST_UNIT_READY command can return +* SRB_STATUS_ERROR, let the upper level code deal with it +* based on the sense information. +*/ + case TEST_UNIT_READY: + break; default: set_host_byte(scmnd, DID_TARGET_FAILURE); } Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 6/7] drivers: scsi: storvsc: Set srb_flags in all cases
On 07/12/2014 06:48 PM, K. Y. Srinivasan wrote: Correctly set SRB flags for all valid I/O directions. Some IHV drivers on the Windows host require this. The host validates the command and SRB flags prior to passing the command down to native driver stack. Signed-off-by: K. Y. Srinivasan k...@microsoft.com Cc: sta...@vger.kernel.org --- drivers/scsi/storvsc_drv.c | 12 +--- 1 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/scsi/storvsc_drv.c b/drivers/scsi/storvsc_drv.c index 3516761..9342ba4 100644 --- a/drivers/scsi/storvsc_drv.c +++ b/drivers/scsi/storvsc_drv.c @@ -1599,26 +1599,24 @@ static int storvsc_queuecommand(struct Scsi_Host *host, struct scsi_cmnd *scmnd) vm_srb = cmd_request-vstor_packet.vm_srb; vm_srb-win8_extension.time_out_value = 60; + vm_srb-win8_extension.srb_flags |= + (SRB_FLAGS_QUEUE_ACTION_ENABLE | + SRB_FLAGS_DISABLE_SYNCH_TRANSFER); /* Build the SRB */ switch (scmnd-sc_data_direction) { case DMA_TO_DEVICE: vm_srb-data_in = WRITE_TYPE; vm_srb-win8_extension.srb_flags |= SRB_FLAGS_DATA_OUT; - vm_srb-win8_extension.srb_flags |= - (SRB_FLAGS_QUEUE_ACTION_ENABLE | - SRB_FLAGS_DISABLE_SYNCH_TRANSFER); break; case DMA_FROM_DEVICE: vm_srb-data_in = READ_TYPE; vm_srb-win8_extension.srb_flags |= SRB_FLAGS_DATA_IN; - vm_srb-win8_extension.srb_flags |= - (SRB_FLAGS_QUEUE_ACTION_ENABLE | - SRB_FLAGS_DISABLE_SYNCH_TRANSFER); break; default: vm_srb-data_in = UNKNOWN_TYPE; - vm_srb-win8_extension.srb_flags = 0; + vm_srb-win8_extension.srb_flags |= (SRB_FLAGS_DATA_IN | +SRB_FLAGS_DATA_OUT); break; } Reviewed-by: Hannes Reinecke h...@suse.de Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] xillybus: place 'else' on same line as '}'
Hi, Thanks for this. And since I looked at the part in Codingstyle that deals with if-else, I found another few mistakes regarding braces around a single statement. The rules say, it turns out, that if one of the clauses in an if-else is longer than one statement, both clauses should be wrapped with braces. This rule is broken in lines 162, 536 and 613 of the same file. To avoid possible conflicts, I'll wait for this patch to be applied, and submit my corrections after that. Regards, Eli On 14/07/14 06:07, Jeremiah Mahler wrote: Place 'else' on same line as closing brace '}' as per Documentation/CodingStyle. Fixes 1 error found by checkpatch.pl. Signed-off-by: Jeremiah Mahlerjmmah...@gmail.com --- drivers/staging/xillybus/xillybus_core.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/xillybus/xillybus_core.c b/drivers/staging/xillybus/xillybus_core.c index ab6502c..7de4c11 100644 --- a/drivers/staging/xillybus/xillybus_core.c +++ b/drivers/staging/xillybus/xillybus_core.c @@ -546,8 +546,7 @@ static int xilly_setupchannels(struct xilly_endpoint *ep, channel-rd_buffers = buffers; rc = xilly_get_dma_buffers(ep,rd_alloc, buffers, bufnum, bytebufsize); - } - else if (channelnum 0) { + } else if (channelnum 0) { channel-num_wr_buffers = bufnum; channel-seekable = seekable; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'
On Sun, Jul 13, 2014 at 12:22:02PM -0700, Greg Kroah-Hartman wrote: On Sun, Jul 13, 2014 at 04:25:06PM +0200, Lars-Peter Clausen wrote: On 07/13/2014 04:03 PM, Richard Weinberger wrote: Am 13.07.2014 15:56, schrieb Lars-Peter Clausen: On 07/13/2014 03:40 PM, Richard Weinberger wrote: Am 13.07.2014 15:26, schrieb Lars-Peter Clausen: On 07/13/2014 11:45 AM, Richard Weinberger wrote: Am 13.07.2014 11:27, schrieb Lennox Wu: As I said before, some configurations don't make sense. If such a configuration can be achieved using allmod/yesconfig it has to be fixed. Chen's fixes seem reasonable as not all architectures support iomem. Maybe we should stub out ioremap() and friends when COMPILE_TEST is enabled to avoid these linker errors. That's in my opinion better than turning most of the 'depends on COMPILE_TEST' into 'depends on COMPILE_TEST HAS_IOMEM'. The issue comes up quite a lot and it is often overlooked when adding a driver that can be build when COMPILE_TEST is enabled. And what should this stub do? Except calling BUG()... return NULL; It's for compile testing, it's not meant to work at runtime. Hm, I really don't like the idea of having a non-working kernel. IMHO either it should build _and_ run and nothing else. Greg, what do you think? The kernel will still be working fine and you can run it on a system. The drivers which use ioremap() or similar are probably not instantiated on a system that does not provide HAS_IOMEM. But even if it was the driver should handle ioremap() returning NULL gracefully and abort the driver probe. That said you'll probably not run a kernel that was built with COMPILE_TEST on your real hardware since it contains so many drivers that are completely useless on your hardware. The idea of COMPILE_TEST is to have as much compile test exposure as possible to the code that is enabled by COMPILE_TEST. Stubbing out ioremap() and friends when HAS_IOMEM is not set and COMPILE_TEST is set makes it easier to get there. I run my kernels with COMPILE_TEST enabled as I need to build test things that I don't happen to use. I like the 'return NULL' option for this, it hits us all the time, might as well fix it properly like this so that we don't have to deal with Kconfig changes everywhere. I agree. One nit, though: devm_ioremap_resource() returns an ERR_PTR()- encoded error code, so the dummy should probably be returning something like ERR_PTR(-ENOSYS) instead of NULL. Also put a big This platform does not support IOMEM error printk in there, so that people have a chance to figure out what is going on if they happen to run such a driver on a platform that can't support it. Yes, that sounds like a very good idea and should be indication enough of what exactly has gone wrong. Thierry pgpQEbFxoZ04h.pgp Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Anybody working on ced1401?
On 13/07/2014 18:46, Greg KH wrote: On Fri, Jun 27, 2014 at 05:11:45PM +0200, Luca Ellero wrote: Hi Greg, On 27/06/2014 16:55, Greg KH wrote: On Fri, Jun 27, 2014 at 03:04:43PM +0200, Luca Ellero wrote: Il 26/06/2014 21:23, Greg KH ha scritto: On Thu, Jun 26, 2014 at 09:36:17AM +0200, Alois Schloegl wrote: On 2014-06-18 13:33, Kristina Martšenko wrote: Hi Alois, I'm helping Greg do a bit of cleanup in the staging tree. I noticed that nobody seems to have worked towards moving ced1401 out of staging in over a year. Are there any plans to clean it up and move it out soon? Because otherwise we're going to have to delete the driver, as we don't want staging to become a permanent place for unfinished code. Thanks, Kristina Hi Kristina, thanks for the notice. Please, give me some time for checking here how we want to go forward with this. What do you mean by this? You all have had a lot of time, with no real progress at all? How about we delete the driver and if you decide to continue to work on it, we can revert that deletion and go from there? thanks, greg k-h Hi, I have a hundred patches for this driver ready to send. Why have you not sent them previously? What is preventing you to send them? Because it's only for a few weeks that I've been working on them. They basically convert all camelCase and Hungarian notation names to Linux convention and fix some checkpatch errors (no logic is modified). Do you have this hardware to test the code with? Do you want to work on getting this driver merged out of the staging tree? I used to have one CED1401, but unfortunately I don't have it any more. Anyway if Alois (or someone else) can test the patches it would be great. I can do a bit more work to get this driver out of staging. As you don't have the hardware anymore, does it make much sense to keep working on the driver? I'd recommend just deleting it, if someone shows up with the hardware later, we can always revert it. Hi Greg, I agree. Without hardware, it's very hard to go ahead. I sent the patches in the hope that someone can test them. But if no one is interested, I have no objection in removing the driver. regards Luca ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host
On Mon, Jul 14, 2014 at 08:15:17AM +0200, Hannes Reinecke wrote: Limiting max_lun to 255 will make the driver to _not_ respond to LUNs higher than that; ie Well-known LUN won't work here. Also the SCSI stack will be using REPORT LUNS anyway since you're advertising SPC-2 compliance. So your driver runs into issues if Hyper-V would ever return more than 256 LUNs with the REPORT LUN command or if any of the LUNs has an addressing scheme other than '0x00'. I would suggest to raise this to the technical limit (ie the largest LUN which the _protocol_ supports) and let REPORT LUNS deal with the actual LUNs. I suspect hypverv doesn't support anything more. For now I'd be inclined to just put it in ASAP and if your suggestion works out fix it up later, although I'll wait a bit for more review feedback. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'
Am 13.07.2014 22:17, schrieb Greg Kroah-Hartman: On Sun, Jul 13, 2014 at 09:33:38PM +0200, Richard Weinberger wrote: Maybe we could add COMPILE_TEST to the version string too? Just to detect such kernels fast in user bug reports... What kind of bug report are you going to get? User manages to enable CONFIG_FOO by selecting COMPILE_TEST and complains that it does not work. :) Thanks, //richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3] staging: android: Clean up else statement from binder_send_failed_reply
On Sun, Jul 13, 2014 at 08:25:13PM -0300, Lucas Tanure wrote: Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of struct binder_transaction *next made outside of while, and initialized with NULL. Don't initialize it at all. It just disables GCC's builtin warning for using unitialized variables. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'
On 07/14/2014 10:31 AM, Richard Weinberger wrote: Am 13.07.2014 22:17, schrieb Greg Kroah-Hartman: On Sun, Jul 13, 2014 at 09:33:38PM +0200, Richard Weinberger wrote: Maybe we could add COMPILE_TEST to the version string too? Just to detect such kernels fast in user bug reports... What kind of bug report are you going to get? User manages to enable CONFIG_FOO by selecting COMPILE_TEST and complains that it does not work. :) These drivers are typically drivers for some SoC peripheral and the device will simply physically not exist on a platform that does not provide HAS_IOMEM. This is not really any different from making the driver selectable via COMPILE_TEST for any other platform. To hit the issue you'd have to instantiate a device driver instance for a device that physically does not exist. This will always result in a failure. - Lars ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] xillybus: place 'else' on same line as '}'
On Mon, Jul 14, 2014 at 09:40:39AM +0300, Eli Billauer wrote: Hi, Thanks for this. And since I looked at the part in Codingstyle that deals with if-else, I found another few mistakes regarding braces around a single statement. The rules say, it turns out, that if one of the clauses in an if-else is longer than one statement, both clauses should be wrapped with braces. This rule is broken in lines 162, 536 and 613 of the same file. To avoid possible conflicts, I'll wait for this patch to be applied, and submit my corrections after that. In theory there shouldn't be any need to wait because the rules about which patches go in first are very clear and predictable. First come first serve. Unless a patch is rejected. And they are only rejected if they violate some rule, but normally ok patches go in. This patch is almost totally ok except it doesn't have staging in the subject. I'm not sure if that's enough to reject it... Probably it's ok and you should assume it will be merged. The other reason that you don't need to wait is that this patch won't conflict with the other patch you are proposing. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'
Am 14.07.2014 10:48, schrieb Lars-Peter Clausen: On 07/14/2014 10:31 AM, Richard Weinberger wrote: Am 13.07.2014 22:17, schrieb Greg Kroah-Hartman: On Sun, Jul 13, 2014 at 09:33:38PM +0200, Richard Weinberger wrote: Maybe we could add COMPILE_TEST to the version string too? Just to detect such kernels fast in user bug reports... What kind of bug report are you going to get? User manages to enable CONFIG_FOO by selecting COMPILE_TEST and complains that it does not work. :) These drivers are typically drivers for some SoC peripheral and the device will simply physically not exist on a platform that does not provide HAS_IOMEM. This is not really any different from making the driver selectable via COMPILE_TEST for any other platform. To hit the issue you'd have to instantiate a device driver instance for a device that physically does not exist. This will always result in a failure. Okay, you have convinced me. :) Thanks, //richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host
On 07/14/2014 10:30 AM, Christoph Hellwig wrote: On Mon, Jul 14, 2014 at 08:15:17AM +0200, Hannes Reinecke wrote: Limiting max_lun to 255 will make the driver to _not_ respond to LUNs higher than that; ie Well-known LUN won't work here. Also the SCSI stack will be using REPORT LUNS anyway since you're advertising SPC-2 compliance. So your driver runs into issues if Hyper-V would ever return more than 256 LUNs with the REPORT LUN command or if any of the LUNs has an addressing scheme other than '0x00'. I would suggest to raise this to the technical limit (ie the largest LUN which the _protocol_ supports) and let REPORT LUNS deal with the actual LUNs. I suspect hypverv doesn't support anything more. For now I'd be inclined to just put it in ASAP and if your suggestion works out fix it up later, although I'll wait a bit for more review feedback. Okay, that's fine by me. Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
On Sun, Jul 13, 2014 at 12:36:47PM -0700, Greg KH wrote: On Sun, Jul 13, 2014 at 09:11:18PM +0200, Peter Senna Tschudin wrote: This patch cleanup coding style issues reported by checkpatch. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V1: - Sent all patches in a series Why did you forget the other thing that I asked you to change? I can't take these as-is, sorry, please go back and re-read what I wrote... Actually I was trying to do what you asked me on this E-mail: -- // -- You just sent me 4 patches, all with the same subject (but at least 2 of them had the order in which to apply them in, which is nice.) Please redo these such that they have a unique subject, and I can tell which order to apply them in, as I really have no idea about the second two. -- // -- I'm sending V3 as a single patch. greg k-h From 69cd87aca39730c0578592d1296b738f7f223f29 Mon Sep 17 00:00:00 2001 From: Peter Senna Tschudin peter.se...@gmail.com Date: Mon, 14 Jul 2014 10:28:42 +0200 Subject: [PATCH V3] staging: vt6556: Cleanup coding style issues This patch cleanup coding style issues reported by checkpatch. This typedef, reported by checkpatch, was removed from card.h: typedef enum _CARD_PHY_TYPE { PHY_TYPE_AUTO = 0, PHY_TYPE_11B, PHY_TYPE_11G, PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; The following typedefs were removed, but enums were kept at device.h: - typedef enum __device_msg_level - typedef enum __DEVICE_NDIS_STATUS Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Changes from V2: - Single patch instead of a series Made against staging-next. drivers/staging/vt6656/baseband.c | 28 + drivers/staging/vt6656/card.c | 19 +++--- drivers/staging/vt6656/card.h | 13 + drivers/staging/vt6656/channel.c | 5 +- drivers/staging/vt6656/device.h | 27 + drivers/staging/vt6656/main_usb.c | 118 +- 6 files changed, 97 insertions(+), 113 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index c1675d5..040b232 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -26,9 +26,10 @@ * Date: Jun. 5, 2002 * * Functions: - * vnt_get_frame_time- Calculate data frame transmitting time - * vnt_get_phy_field - Calculate PhyLength, PhyService and Phy Signal parameter for baseband Tx - * BBbVT3184Init - VIA VT3184 baseband chip init code + * vnt_get_frame_time - Calculate data frame transmitting time + * vnt_get_phy_field - Calculate PhyLength, PhyService and Phy + * Signal parameter for baseband Tx + * BBbVT3184Init - VIA VT3184 baseband chip init code * * Revision History: * @@ -86,7 +87,7 @@ static u8 vnt_vt3184_al2230[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */ }; -//{{RobertYu:20060515, new BB setting for VT3226D0 +/* {{RobertYu:20060515, new BB setting for VT3226D0 */ static u8 vnt_vt3184_vt3226d0[] = { 0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */ @@ -122,8 +123,9 @@ static u8 vnt_vt3184_vt3226d0[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */ }; -static const u16 awcFrameTime[MAX_RATE] = -{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; +static const u16 awcFrameTime[MAX_RATE] = { + 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216 +}; /* * Description: Calculate data frame transmitting time @@ -191,9 +193,9 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, * tx_rate - Tx Rate * Out: * struct vnt_phy_field *phy - * - pointer to Phy Length field - * - pointer to Phy Service field - * - pointer to Phy Signal field + * - pointer to Phy Length field + * - pointer to Phy Service field + * - pointer to Phy Signal field * * Return Value: none * @@ -450,8 +452,9 @@ int BBbVT3184Init(struct vnt_private *priv) priv-ldBmThreshold[2] = 0; priv-ldBmThreshold[3] = 0; /* Fix VT3226 DFC system timing issue */ - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); - } else if ((priv-byRFType == RF_VT3342A0)) { + vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, + SOFTPWRCTL_RFLEOPT); + } else if (priv-byRFType == RF_VT3342A0) { priv-byBBRxConf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); addr = vnt_vt3184_vt3226d0; @@ -467,7 +470,8 @@ int BBbVT3184Init(struct vnt_private *priv) priv-ldBmThreshold[2] = 0;
Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host
On 07/14/2014 11:00 AM, Christoph Hellwig wrote: On Mon, Jul 14, 2014 at 10:57:53AM +0200, Hannes Reinecke wrote: Okay, that's fine by me. Should I take this as a reviewed-by tag? Yes, please do. Cheers, Hannes -- Dr. Hannes Reinecke zSeries Storage h...@suse.de +49 911 74053 688 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V3 1/7] Drivers: scsi: storvsc: Change the limits to reflect the values on the host
On Mon, Jul 14, 2014 at 10:57:53AM +0200, Hannes Reinecke wrote: Okay, that's fine by me. Should I take this as a reviewed-by tag? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: comedi: addi_apci_1564: driver no longer needs to include addi_common.h
On 2014-07-12 23:42, Chase Southwood wrote: This driver no longer depends on anything in addi_common.h, save for a few headers that it was including indirectly. Remove the include of addi_common.h and add the includes of linux/interrupt.h and linux/sched.h directly. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- drivers/staging/comedi/drivers/addi_apci_1564.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Ian Abbott abbo...@mev.co.uk -- -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] drivers: Let several drivers depends on HAS_IOMEM for 'devm_ioremap_resource'
在 2014年7月14日,下午4:57,Richard Weinberger rich...@nod.at 写道: Am 14.07.2014 10:48, schrieb Lars-Peter Clausen: On 07/14/2014 10:31 AM, Richard Weinberger wrote: Am 13.07.2014 22:17, schrieb Greg Kroah-Hartman: On Sun, Jul 13, 2014 at 09:33:38PM +0200, Richard Weinberger wrote: Maybe we could add COMPILE_TEST to the version string too? Just to detect such kernels fast in user bug reports... What kind of bug report are you going to get? User manages to enable CONFIG_FOO by selecting COMPILE_TEST and complains that it does not work. :) These drivers are typically drivers for some SoC peripheral and the device will simply physically not exist on a platform that does not provide HAS_IOMEM. This is not really any different from making the driver selectable via COMPILE_TEST for any other platform. To hit the issue you'd have to instantiate a device driver instance for a device that physically does not exist. This will always result in a failure. Okay, you have convinced me. :) OK, thank all of you, and I shall send the related patch for it. I will try to finish it within this week. Thanks. — Chen Gang Open, share, and attitude like air, water, and life which God blessed. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] staging: comedi: addi_apci_1564: driver no longer needs to include addi_common.h
On 2014-07-14 10:15, Ian Abbott wrote: On 2014-07-12 23:42, Chase Southwood wrote: This driver no longer depends on anything in addi_common.h, save for a few headers that it was including indirectly. Remove the include of addi_common.h and add the includes of linux/interrupt.h and linux/sched.h directly. Signed-off-by: Chase Southwood chase.southw...@gmail.com Cc: Ian Abbott abbo...@mev.co.uk Cc: H Hartley Sweeten hswee...@visionengravers.com --- drivers/staging/comedi/drivers/addi_apci_1564.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) Signed-off-by: Ian Abbott abbo...@mev.co.uk I meant 'Reviewed-by', but whatever! -- -=( Ian Abbott @ MEV Ltd.E-mail: abbo...@mev.co.uk)=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8821ae: fix coding style issue in cam.c
This is a patch to the cam.c file that fix a coding style error (do not use C99 // comments) Signed-off-by: Joerg C. Meyer jo...@meyer.homedns.org --- drivers/staging/rtl8821ae/cam.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8821ae/cam.c b/drivers/staging/rtl8821ae/cam.c index 3bc6b3d..9c0cd1e 100644 --- a/drivers/staging/rtl8821ae/cam.c +++ b/drivers/staging/rtl8821ae/cam.c @@ -152,7 +152,7 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, return 1; } -//EXPORT_SYMBOL(rtl_cam_add_one_entry); +/* EXPORT_SYMBOL(rtl_cam_add_one_entry); */ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, u32 ul_key_id) @@ -176,7 +176,7 @@ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, return 0; } -//EXPORT_SYMBOL(rtl_cam_delete_one_entry); +/* EXPORT_SYMBOL(rtl_cam_delete_one_entry); */ void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) { @@ -186,7 +186,7 @@ void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) ul_command = BIT(31) | BIT(30); rtl_write_dword(rtlpriv, rtlpriv-cfg-maps[RWCAM], ul_command); } -//EXPORT_SYMBOL(rtl_cam_reset_all_entry); +/* EXPORT_SYMBOL(rtl_cam_reset_all_entry); */ void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) { @@ -227,7 +227,7 @@ void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) RT_TRACE(COMP_SEC, DBG_DMESG, (rtl_cam_mark_invalid(): WRITE A0: %x \n, ul_command)); } -//EXPORT_SYMBOL(rtl_cam_mark_invalid); +/* EXPORT_SYMBOL(rtl_cam_mark_invalid); */ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) { @@ -281,7 +281,7 @@ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) } } -//EXPORT_SYMBOL(rtl_cam_empty_entry); +/* EXPORT_SYMBOL(rtl_cam_empty_entry); */ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -316,7 +316,7 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return TOTAL_CAM_ENTRY; } -//EXPORT_SYMBOL(rtl_cam_get_free_entry); +/* EXPORT_SYMBOL(rtl_cam_get_free_entry); */ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -349,4 +349,4 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return; } -//EXPORT_SYMBOL(rtl_cam_del_entry); +/* EXPORT_SYMBOL(rtl_cam_del_entry); */ -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Anybody working on ced1401?
On 14/07/14 11:28, Luca Ellero wrote: On 13/07/2014 18:46, Greg KH wrote: On Fri, Jun 27, 2014 at 05:11:45PM +0200, Luca Ellero wrote: Hi Greg, On 27/06/2014 16:55, Greg KH wrote: On Fri, Jun 27, 2014 at 03:04:43PM +0200, Luca Ellero wrote: Il 26/06/2014 21:23, Greg KH ha scritto: On Thu, Jun 26, 2014 at 09:36:17AM +0200, Alois Schloegl wrote: On 2014-06-18 13:33, Kristina Martšenko wrote: Hi Alois, I'm helping Greg do a bit of cleanup in the staging tree. I noticed that nobody seems to have worked towards moving ced1401 out of staging in over a year. Are there any plans to clean it up and move it out soon? Because otherwise we're going to have to delete the driver, as we don't want staging to become a permanent place for unfinished code. Thanks, Kristina Hi Kristina, thanks for the notice. Please, give me some time for checking here how we want to go forward with this. What do you mean by this? You all have had a lot of time, with no real progress at all? How about we delete the driver and if you decide to continue to work on it, we can revert that deletion and go from there? thanks, greg k-h Hi, I have a hundred patches for this driver ready to send. Why have you not sent them previously? What is preventing you to send them? Because it's only for a few weeks that I've been working on them. They basically convert all camelCase and Hungarian notation names to Linux convention and fix some checkpatch errors (no logic is modified). Do you have this hardware to test the code with? Do you want to work on getting this driver merged out of the staging tree? I used to have one CED1401, but unfortunately I don't have it any more. Anyway if Alois (or someone else) can test the patches it would be great. I can do a bit more work to get this driver out of staging. As you don't have the hardware anymore, does it make much sense to keep working on the driver? I'd recommend just deleting it, if someone shows up with the hardware later, we can always revert it. Hi Greg, I agree. Without hardware, it's very hard to go ahead. I sent the patches in the hope that someone can test them. But if no one is interested, I have no objection in removing the driver. regards Luca Thanks, Luca. Since no one with the hardware seems interested right now, I'm going to go ahead and remove the driver. Kristina ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] drivers: staging: lustre: Use 'force_die' instead of 'die' to avoid compiling issue
Some of architectures have already defined 'die' as macro, so can not use it as declaration or definition in other modules, or it will cause compiling issue. So use more precise name 'force_die' (like 'wrap_bulk') instead of. And the related error (with allmodconfig under score): CC [M] drivers/staging/lustre/lustre/ptlrpc/sec.o drivers/staging/lustre/lustre/ptlrpc/sec.c: In function 'sptlrpc_cli_ctx_expire': drivers/staging/lustre/lustre/ptlrpc/sec.c:309:13: error: 'struct ptlrpc_ctx_ops' has no member named '__die' ctx-cc_ops-die(ctx, 0); ^ drivers/staging/lustre/lustre/ptlrpc/sec.c: In function 'ctx_refresh_timeout': drivers/staging/lustre/lustre/ptlrpc/sec.c:594:26: error: 'struct ptlrpc_ctx_ops' has no member named '__die' req-rq_cli_ctx-cc_ops-die(req-rq_cli_ctx, 0); ^ make[5]: *** [drivers/staging/lustre/lustre/ptlrpc/sec.o] Error 1 make[4]: *** [drivers/staging/lustre/lustre/ptlrpc] Error 2 make[3]: *** [drivers/staging/lustre/lustre] Error 2 make[2]: *** [drivers/staging/lustre] Error 2 make[1]: *** [drivers/staging] Error 2 make: *** [drivers] Error 2 Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index bf3ee39..1b8ec11 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -387,7 +387,7 @@ struct ptlrpc_ctx_ops { /** * Force the \a ctx to die. */ - void(*die) (struct ptlrpc_cli_ctx *ctx, + void(*force_die) (struct ptlrpc_cli_ctx *ctx, int grace); int (*display) (struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 28ac824..bb5b4b6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -305,8 +305,8 @@ EXPORT_SYMBOL(sptlrpc_cli_ctx_put); */ void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx) { - LASSERT(ctx-cc_ops-die); - ctx-cc_ops-die(ctx, 0); + LASSERT(ctx-cc_ops-force_die); + ctx-cc_ops-force_die(ctx, 0); } EXPORT_SYMBOL(sptlrpc_cli_ctx_expire); @@ -591,7 +591,7 @@ int ctx_refresh_timeout(void *data) * later than the context refresh expire time. */ if (rc == 0) - req-rq_cli_ctx-cc_ops-die(req-rq_cli_ctx, 0); + req-rq_cli_ctx-cc_ops-force_die(req-rq_cli_ctx, 0); return rc; } -- 1.7.11.7 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] drivers: staging: lustre: Use 'force_die' instead of 'die' to avoid compiling issue
For drivers/staging/lustre/lustre/include/lustre_sec.h:391: - staging tree: use '\t ' between 'die' and '('. - linux-next tree: use ' ' between 'die' and '('. So the patch made under linux-next tree, can not apply to staging-next or staging tree. Thanks. On 07/14/2014 07:59 PM, Chen Gang wrote: Some of architectures have already defined 'die' as macro, so can not use it as declaration or definition in other modules, or it will cause compiling issue. So use more precise name 'force_die' (like 'wrap_bulk') instead of. And the related error (with allmodconfig under score): CC [M] drivers/staging/lustre/lustre/ptlrpc/sec.o drivers/staging/lustre/lustre/ptlrpc/sec.c: In function 'sptlrpc_cli_ctx_expire': drivers/staging/lustre/lustre/ptlrpc/sec.c:309:13: error: 'struct ptlrpc_ctx_ops' has no member named '__die' ctx-cc_ops-die(ctx, 0); ^ drivers/staging/lustre/lustre/ptlrpc/sec.c: In function 'ctx_refresh_timeout': drivers/staging/lustre/lustre/ptlrpc/sec.c:594:26: error: 'struct ptlrpc_ctx_ops' has no member named '__die' req-rq_cli_ctx-cc_ops-die(req-rq_cli_ctx, 0); ^ make[5]: *** [drivers/staging/lustre/lustre/ptlrpc/sec.o] Error 1 make[4]: *** [drivers/staging/lustre/lustre/ptlrpc] Error 2 make[3]: *** [drivers/staging/lustre/lustre] Error 2 make[2]: *** [drivers/staging/lustre] Error 2 make[1]: *** [drivers/staging] Error 2 make: *** [drivers] Error 2 Signed-off-by: Chen Gang gang.chen.5...@gmail.com --- drivers/staging/lustre/lustre/include/lustre_sec.h | 2 +- drivers/staging/lustre/lustre/ptlrpc/sec.c | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre_sec.h b/drivers/staging/lustre/lustre/include/lustre_sec.h index bf3ee39..1b8ec11 100644 --- a/drivers/staging/lustre/lustre/include/lustre_sec.h +++ b/drivers/staging/lustre/lustre/include/lustre_sec.h @@ -387,7 +387,7 @@ struct ptlrpc_ctx_ops { /** * Force the \a ctx to die. */ - void(*die) (struct ptlrpc_cli_ctx *ctx, + void(*force_die) (struct ptlrpc_cli_ctx *ctx, int grace); int (*display) (struct ptlrpc_cli_ctx *ctx, char *buf, int bufsize); diff --git a/drivers/staging/lustre/lustre/ptlrpc/sec.c b/drivers/staging/lustre/lustre/ptlrpc/sec.c index 28ac824..bb5b4b6 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/sec.c +++ b/drivers/staging/lustre/lustre/ptlrpc/sec.c @@ -305,8 +305,8 @@ EXPORT_SYMBOL(sptlrpc_cli_ctx_put); */ void sptlrpc_cli_ctx_expire(struct ptlrpc_cli_ctx *ctx) { - LASSERT(ctx-cc_ops-die); - ctx-cc_ops-die(ctx, 0); + LASSERT(ctx-cc_ops-force_die); + ctx-cc_ops-force_die(ctx, 0); } EXPORT_SYMBOL(sptlrpc_cli_ctx_expire); @@ -591,7 +591,7 @@ int ctx_refresh_timeout(void *data) * later than the context refresh expire time. */ if (rc == 0) - req-rq_cli_ctx-cc_ops-die(req-rq_cli_ctx, 0); + req-rq_cli_ctx-cc_ops-force_die(req-rq_cli_ctx, 0); return rc; } -- Chen Gang Open, share, and attitude like air, water, and life which God blessed ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
On Mon, Jul 14, 2014 at 10:59:32AM +0200, Peter Senna Tschudin wrote: On Sun, Jul 13, 2014 at 12:36:47PM -0700, Greg KH wrote: On Sun, Jul 13, 2014 at 09:11:18PM +0200, Peter Senna Tschudin wrote: This patch cleanup coding style issues reported by checkpatch. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V1: - Sent all patches in a series Why did you forget the other thing that I asked you to change? I can't take these as-is, sorry, please go back and re-read what I wrote... Actually I was trying to do what you asked me on this E-mail: -- // -- You just sent me 4 patches, all with the same subject (but at least 2 of them had the order in which to apply them in, which is nice.) Please redo these such that they have a unique subject, and I can tell which order to apply them in, as I really have no idea about the second two. -- // -- I'm sending V3 as a single patch. That's going to get rejected as well :( You did put them in a nice order, but you had the same subject text for each patch, which I told you not to do, right? {sigh} greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8821ae: fix coding style issue in cam.c
On Mon, Jul 14, 2014 at 11:42:33AM +0200, Joerg C. Meyer wrote: This is a patch to the cam.c file that fix a coding style error (do not use C99 // comments) Signed-off-by: Joerg C. Meyer jo...@meyer.homedns.org Minor nit, you need a blank line between these two lines... --- drivers/staging/rtl8821ae/cam.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8821ae/cam.c b/drivers/staging/rtl8821ae/cam.c index 3bc6b3d..9c0cd1e 100644 --- a/drivers/staging/rtl8821ae/cam.c +++ b/drivers/staging/rtl8821ae/cam.c @@ -152,7 +152,7 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, return 1; } -//EXPORT_SYMBOL(rtl_cam_add_one_entry); +/* EXPORT_SYMBOL(rtl_cam_add_one_entry); */ Your patch is correct, but how about just deleting these lines instead? They aren't needed, so please remove them. Can you do that and resend? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
On Mon, Jul 14, 2014 at 2:58 PM, Greg KH gre...@linuxfoundation.org wrote: On Mon, Jul 14, 2014 at 10:59:32AM +0200, Peter Senna Tschudin wrote: On Sun, Jul 13, 2014 at 12:36:47PM -0700, Greg KH wrote: On Sun, Jul 13, 2014 at 09:11:18PM +0200, Peter Senna Tschudin wrote: This patch cleanup coding style issues reported by checkpatch. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V1: - Sent all patches in a series Why did you forget the other thing that I asked you to change? I can't take these as-is, sorry, please go back and re-read what I wrote... Actually I was trying to do what you asked me on this E-mail: -- // -- You just sent me 4 patches, all with the same subject (but at least 2 of them had the order in which to apply them in, which is nice.) Please redo these such that they have a unique subject, and I can tell which order to apply them in, as I really have no idea about the second two. -- // -- I'm sending V3 as a single patch. That's going to get rejected as well :( You did put them in a nice order, but you had the same subject text for each patch, which I told you not to do, right? {sigh} The noise was caused by my poor English language skills. When you wrote: Please redo these such that they have a unique subject, and I can tell which order to apply them in, as I really have no idea about the second two. I understood: 1 - redo these patches 2 - such as they have a unique subject 3 - in a way Greg can tell in which order to apply them I just understood what you wanted today. Sorry for that. But, there is a plain text attachment on my previous E-mail with the V3 of the patch set. The V3 is a single patch instead of 4 patches, is that ok? Should I resend in a new thread? greg k-h -- Peter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
Since you're going to redo this patch anyway, I may as well give you the normal feedback for these kinds of patches. From 69cd87aca39730c0578592d1296b738f7f223f29 Mon Sep 17 00:00:00 2001 From: Peter Senna Tschudin peter.se...@gmail.com Date: Mon, 14 Jul 2014 10:28:42 +0200 Subject: [PATCH V3] staging: vt6556: Cleanup coding style issues This patch cleanup coding style issues reported by checkpatch. This typedef, reported by checkpatch, was removed from card.h: typedef enum _CARD_PHY_TYPE { PHY_TYPE_AUTO = 0, PHY_TYPE_11B, PHY_TYPE_11G, PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; The following typedefs were removed, but enums were kept at device.h: - typedef enum __device_msg_level - typedef enum __DEVICE_NDIS_STATUS Break this kind of patch into patches which fix one type of mistake per patch: patch 1: fix whitespace stuff patch 2: remove useless returns patch 3: remove typedefs etc. -//{{RobertYu:20060515, new BB setting for VT3226D0 +/* {{RobertYu:20060515, new BB setting for VT3226D0 */ Just delete these, because we have version control. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8821ae: fix comment coding style issue in cam.c
This is a patch to the cam.c file that removes some obsolete C99 style comments Signed-off-by: Joerg C. Meyer jo...@meyer.homedns.org --- drivers/staging/rtl8821ae/cam.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8821ae/cam.c b/drivers/staging/rtl8821ae/cam.c index 3bc6b3d..6185ea4 100644 --- a/drivers/staging/rtl8821ae/cam.c +++ b/drivers/staging/rtl8821ae/cam.c @@ -152,7 +152,6 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, return 1; } -//EXPORT_SYMBOL(rtl_cam_add_one_entry); int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, u32 ul_key_id) @@ -176,7 +175,6 @@ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, return 0; } -//EXPORT_SYMBOL(rtl_cam_delete_one_entry); void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) { @@ -186,7 +184,6 @@ void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) ul_command = BIT(31) | BIT(30); rtl_write_dword(rtlpriv, rtlpriv-cfg-maps[RWCAM], ul_command); } -//EXPORT_SYMBOL(rtl_cam_reset_all_entry); void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) { @@ -227,7 +224,6 @@ void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) RT_TRACE(COMP_SEC, DBG_DMESG, (rtl_cam_mark_invalid(): WRITE A0: %x \n, ul_command)); } -//EXPORT_SYMBOL(rtl_cam_mark_invalid); void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) { @@ -281,7 +277,6 @@ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) } } -//EXPORT_SYMBOL(rtl_cam_empty_entry); u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -316,7 +311,6 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return TOTAL_CAM_ENTRY; } -//EXPORT_SYMBOL(rtl_cam_get_free_entry); void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -349,4 +343,3 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return; } -//EXPORT_SYMBOL(rtl_cam_del_entry); -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8821ae: fix comment coding style issue in cam.c
On Mon, Jul 14, 2014 at 04:09:26PM +0200, Joerg C. Meyer wrote: This is a patch to the cam.c file that removes some obsolete C99 style comments Signed-off-by: Joerg C. Meyer jo...@meyer.homedns.org 4 copies of the same patch? Anyway, this text doesn't match what the patch actually does (deleted unneeded lines). 3 time's a charm? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8821ae: delete unneeded lines in cam.c
This is a patch to the cam.c file that removes some unneeded lines of commented-out code Signed-off-by: Joerg C. Meyer jo...@meyer.homedns.org --- drivers/staging/rtl8821ae/cam.c | 7 --- 1 file changed, 7 deletions(-) diff --git a/drivers/staging/rtl8821ae/cam.c b/drivers/staging/rtl8821ae/cam.c index 3bc6b3d..6185ea4 100644 --- a/drivers/staging/rtl8821ae/cam.c +++ b/drivers/staging/rtl8821ae/cam.c @@ -152,7 +152,6 @@ u8 rtl_cam_add_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, return 1; } -//EXPORT_SYMBOL(rtl_cam_add_one_entry); int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, u8 *mac_addr, u32 ul_key_id) @@ -176,7 +175,6 @@ int rtl_cam_delete_one_entry(struct ieee80211_hw *hw, return 0; } -//EXPORT_SYMBOL(rtl_cam_delete_one_entry); void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) { @@ -186,7 +184,6 @@ void rtl_cam_reset_all_entry(struct ieee80211_hw *hw) ul_command = BIT(31) | BIT(30); rtl_write_dword(rtlpriv, rtlpriv-cfg-maps[RWCAM], ul_command); } -//EXPORT_SYMBOL(rtl_cam_reset_all_entry); void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) { @@ -227,7 +224,6 @@ void rtl_cam_mark_invalid(struct ieee80211_hw *hw, u8 uc_index) RT_TRACE(COMP_SEC, DBG_DMESG, (rtl_cam_mark_invalid(): WRITE A0: %x \n, ul_command)); } -//EXPORT_SYMBOL(rtl_cam_mark_invalid); void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) { @@ -281,7 +277,6 @@ void rtl_cam_empty_entry(struct ieee80211_hw *hw, u8 uc_index) } } -//EXPORT_SYMBOL(rtl_cam_empty_entry); u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -316,7 +311,6 @@ u8 rtl_cam_get_free_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return TOTAL_CAM_ENTRY; } -//EXPORT_SYMBOL(rtl_cam_get_free_entry); void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) { @@ -349,4 +343,3 @@ void rtl_cam_del_entry(struct ieee80211_hw *hw, u8 *sta_addr) } return; } -//EXPORT_SYMBOL(rtl_cam_del_entry); -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: unisys: added virtpci info entry
On 07/11/2014 08:09 PM, Greg KH wrote: [snip] + if (!vbuf) + return -ENOMEM; + + str_pos += scnprintf(vbuf + str_pos, len - str_pos, +Virtual PCI Bus devices\n); Why the leading ' '? It's the formatting the original author chose to output the information. So that it would look something like this: Virtual PCI Bus devices INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH Virtual PCI devices INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH Instead of this: Virtual PCI Bus devices INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH Virtual PCI devices INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH INFOFOOBLAHBLAHBLAH [snip] greg k-h Thanks for the comments and suggestions. I should be sending the next patch shortly :) Cheers, Erik Arfvidson ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 2/5] staging:iio:hmc5843: Split hmc5843.c to multiple files
On 07/08/2014 03:39 PM, Josef Gajdusek wrote: [...] diff --git a/drivers/staging/iio/magnetometer/Kconfig b/drivers/staging/iio/magnetometer/Kconfig index ad88d61..28c2612 100644 --- a/drivers/staging/iio/magnetometer/Kconfig +++ b/drivers/staging/iio/magnetometer/Kconfig @@ -5,15 +5,23 @@ menu Magnetometer sensors config SENSORS_HMC5843 tristate Honeywell HMC5843/5883/5883L 3-Axis Magnetometer - depends on I2C + depends on (I2C || SPI_MASTER) select IIO_BUFFER select IIO_TRIGGERED_BUFFER - select REGMAP_I2C + select SENSORS_HMC5843_I2C if (I2C) This approach doesn't work to well and will cause randconfig build failures. If SPI_MASTER is 'y' and I2C is 'm' you'll be able to select this driver as built-in, which in turn will also select SENSORS_HMC5843_I2C as built-in, which means you'll get unresolved symbols during linking since core I2C support is built as a module. A better approach is to have a user-selectable symbol per bus and a non-user-selectable symbol for the core infrastructure of the driver. e.g. config SENSORS_HMC5843 tristate select IIO_BUFFER ... config SENSORS_HMC5843_I2C tristate Honeywell HMC5843/5883/5883L 3-Axis Magnetometer (I2C) select SENSORS_HMC5843 select REGMAP_I2C config SENSORS_HMC5843_SPI tristate Honeywell HMC5843/5883/5883L 3-Axis Magnetometer (SPI) select SENSORS_HMC5843 select REGMAP_SPI +struct regmap_config hmc5843_i2c_regmap_config = { static + .reg_bits = 8, + .val_bits = 8, + + .rd_table = hmc5843_readable_table, + .wr_table = hmc5843_writable_table, + .volatile_table = hmc5843_volatile_table, + + .cache_type = REGCACHE_RBTREE, +}; +static int hmc5843_i2c_probe(struct i2c_client *client, + const struct i2c_device_id *id) +{ + struct hmc5843_data *data; + struct iio_dev *indio_dev; + + indio_dev = devm_iio_device_alloc(client-dev, sizeof(*data)); + if (indio_dev == NULL) + return -ENOMEM; + + i2c_set_clientdata(client, indio_dev); + + data = iio_priv(indio_dev); + data-dev = client-dev; + data-regmap = devm_regmap_init_i2c(client, hmc5843_i2c_regmap_config); + + indio_dev-name = id-name; + indio_dev-dev.parent = client-dev; + + return hmc5843_common_probe(indio_dev, id-driver_data); +} If you do the allocation of the IIO device in the common function this can be simplified a bit. E.g. static int hmc5843_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { return hmc5853_common_probe(client-dev, devm_regmap_init_i2c(client, mc5843_i2c_regmap_config), id-driver_data); } +#ifdef CONFIG_PM_SLEEP +static int hmc5843_i2c_suspend(struct device *dev) +{ + return hmc5843_common_suspend(i2c_get_clientdata(to_i2c_client(dev))); +} + +static int hmc5843_i2c_resume(struct device *dev) +{ + return hmc5843_common_resume(i2c_get_clientdata(to_i2c_client(dev))); +} + +static SIMPLE_DEV_PM_OPS(hmc5843_pm_ops, + hmc5843_i2c_suspend, hmc5843_i2c_resume); +#define HMC5843_PM_OPS (hmc5843_pm_ops) +#else +#define HMC5843_PM_OPS NULL +#endif Those ops will be the same for both SPI and I2C. i2c_get_clientdata(to_i2c_client(dev)) is the same as dev_get_drvdata(dev), so this can go into the core driver. Also as a hint for future patches, if you rename a file use 'git-format-patch -M', this will make the patch a bit more legible. - Lars ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
re: staging: r8188eu: Add files for new driver - part 19
Hello Larry Finger, The patch 5adef66acf73: staging: r8188eu: Add files for new driver - part 19 from Aug 21, 2013, leads to the following static checker warning: drivers/staging/rtl8188eu/os_dep/rtw_android.c:262 rtw_android_priv_cmd() error: snprintf() is printing too much. drivers/staging/rtl8188eu/os_dep/rtw_android.c 260 default: 261 DBG_88E(Unknown PRIVATE command %s - ignored\n, command); 262 snprintf(command, 3, OK); 263 bytes_written = strlen(OK); The size of the command buf is determined by the user so it's not necessarily large enough to hold the OK string. My first instinct is to just delete this code, but I wonder what would break if just returned -ENOTTY or whatever? TODO-list: 2014-07-14: r8188eu: fix memory corruption in rtw_android_priv_cmd() 264 } 265 266 response: 267 if (bytes_written = 0) { 268 if ((bytes_written == 0) (priv_cmd.total_len 0)) 269 command[0] = '\0'; 270 if (bytes_written = priv_cmd.total_len) { 271 DBG_88E(%s: bytes_written = %d\n, __func__, 272 bytes_written); 273 bytes_written = priv_cmd.total_len; 274 } else { 275 bytes_written++; 276 } 277 priv_cmd.used_len = bytes_written; 278 if (copy_to_user((char __user *)priv_cmd.buf, command, 279 bytes_written)) { 280 DBG_88E(%s: failed to copy data to user buffer\n, 281 __func__); 282 ret = -EFAULT; 283 } 284 } else { 285 ret = bytes_written; 286 } 287 exit: 288 kfree(command); 289 return ret; 290 } regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
note I'm not trying to push my changes over the rules. I'm trying to understand the problem, to avoid creating similar noise in the future. /note Now I understand that the problem with the series of 4 patches is that the subject is the same on the 4 patches. Having the same subject in 4 patches is not good. I got this one. But I have no clue why joining 4 cleanup patches into 1 is bad. The patches are all for the same driver, are all silencing checkpatch warnings, and even the typedef stuff was reported by checkpatch. The commit message of the single patch describes it all. If the subject of the series is the problem, why not make a single patch instead of a series of similar patches? It made sense from my perspective. So what is the problem in re-submit 4 similar patches as a single patch? On Mon, Jul 14, 2014 at 4:12 PM, Dan Carpenter dan.carpen...@oracle.com wrote: Since you're going to redo this patch anyway, I may as well give you the normal feedback for these kinds of patches. From 69cd87aca39730c0578592d1296b738f7f223f29 Mon Sep 17 00:00:00 2001 From: Peter Senna Tschudin peter.se...@gmail.com Date: Mon, 14 Jul 2014 10:28:42 +0200 Subject: [PATCH V3] staging: vt6556: Cleanup coding style issues This patch cleanup coding style issues reported by checkpatch. This typedef, reported by checkpatch, was removed from card.h: typedef enum _CARD_PHY_TYPE { PHY_TYPE_AUTO = 0, PHY_TYPE_11B, PHY_TYPE_11G, PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; The following typedefs were removed, but enums were kept at device.h: - typedef enum __device_msg_level - typedef enum __DEVICE_NDIS_STATUS Break this kind of patch into patches which fix one type of mistake per patch: patch 1: fix whitespace stuff patch 2: remove useless returns patch 3: remove typedefs etc. -//{{RobertYu:20060515, new BB setting for VT3226D0 +/* {{RobertYu:20060515, new BB setting for VT3226D0 */ Just delete these, because we have version control. regards, dan carpenter -- Peter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
On Mon, Jul 14, 2014 at 07:01:37PM +0200, Peter Senna Tschudin wrote: note I'm not trying to push my changes over the rules. I'm trying to understand the problem, to avoid creating similar noise in the future. /note Now I understand that the problem with the series of 4 patches is that the subject is the same on the 4 patches. Having the same subject in 4 patches is not good. I got this one. But I have no clue why joining 4 cleanup patches into 1 is bad. The patches are all for the same driver, are all silencing checkpatch warnings, and even the typedef stuff was reported by checkpatch. The commit message of the single patch describes it all. If the subject of the series is the problem, why not make a single patch instead of a series of similar patches? It made sense from my perspective. So what is the problem in re-submit 4 similar patches as a single patch? The one thing per patch rule is a bit ambiguous, but normally we auto reject patches which fix every checkpatch warning in somefile_foo.c and sugest that they instead be broken into one type of fix per patch. Breaking it up like this is maybe not always beautiful but it's simple to explain to newbies and generally easier to review. If there are very few warnings in the file then fix everything is ok. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V2 1/4] staging: vt6556: Cleanup coding style issues
On Mon, Jul 14, 2014 at 07:01:37PM +0200, Peter Senna Tschudin wrote: note I'm not trying to push my changes over the rules. I'm trying to understand the problem, to avoid creating similar noise in the future. /note Now I understand that the problem with the series of 4 patches is that the subject is the same on the 4 patches. Having the same subject in 4 patches is not good. I got this one. But I have no clue why joining 4 cleanup patches into 1 is bad. The patches are all for the same driver, are all silencing checkpatch warnings, and even the typedef stuff was reported by checkpatch. The commit message of the single patch describes it all. If the subject of the series is the problem, why not make a single patch instead of a series of similar patches? It made sense from my perspective. So what is the problem in re-submit 4 similar patches as a single patch? Because it is _much_ harder to review a patch that way. I get a few hundred patches a week to review. If you only do one thing per patch, it is trivial to review, and you don't have to pick through a patch to determine if all of it is correct based on a larger patch, that does multiple things. Also, the rule for a kernel patch is do only one thing. If you do: - remove typedef - fix space layout for a single file, that really is 2 different things, yet you could claim they are both coding style cleanups. Reviewing both of these at the same time, together, makes it much harder to do. Remember, for the kernel, we waste individual developer's time, at the expense of reviewer's time, as we have far more developers than reviewers. Hope this helps explain things more. greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: octeon: fix coding style
This patch fixes checkpatch.pl warning. Add blank line after declaration. Signed-off-by: Rahul Bedarkar rahulbedarka...@gmail.com --- drivers/staging/octeon/ethernet-xaui.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/octeon/ethernet-xaui.c b/drivers/staging/octeon/ethernet-xaui.c index 419f8c3..a093dfb 100644 --- a/drivers/staging/octeon/ethernet-xaui.c +++ b/drivers/staging/octeon/ethernet-xaui.c @@ -111,6 +111,7 @@ static void cvm_oct_xaui_poll(struct net_device *dev) int cvm_oct_xaui_init(struct net_device *dev) { struct octeon_ethernet *priv = netdev_priv(dev); + cvm_oct_common_init(dev); dev-netdev_ops-ndo_stop(dev); if (!octeon_is_simulation() priv-phydev == NULL) -- 1.8.3.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2 01/18] staging: comedi: ni_65xx: filter interval register is 32-bit
On Tuesday, July 08, 2014 4:37 PM, Greg KH wrote: On Thu, Jun 26, 2014 at 12:05:07PM -0700, H Hartley Sweeten wrote: According to the register programming manual, the filter interval register is 32-bit. Fix the writes to this register. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk --- drivers/staging/comedi/drivers/ni_65xx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) This patch fails to apply, are we out of sync? I've now taken all comedi patches, care to refresh against my tree when you get a chance and resend? Looks like a series got lost: [PATCH 0/4] staging: comedi: remove unnecessary COMEDI_MITE dependancies I will repost that one and [PATCH v2 00/18] staging: comedi: ni_65xx: cleanup driver in a bit. Thanks, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: XVME 6300 with TSI148 bridge on 64 bit Debian (Linux 3.2.57) vme_user issue
Hi all, I have updated my Linux Kernel to the latest. I am on Debian 64bit 3.15.5. I issue the following Kernel command line, and the vme_user module seems to load correctly, however the vme bus is neither mounted on /dev nor /proc. I was earlier using a 3.2 debian 32bit and managed to mount the vme bus by following the exact same procedure of rebuilding the kernel with vme_user module. Any help is appreciated. Here is what I see on dmesg. [0.00] Kernel command line: BOOT_IMAGE=/boot/vmlinuz-3.15.5-vme root=UUID=4cdc2e84-9fbc-471c-9eb4-fde8f0b1ce96 ro vme_user.bus=0 vme_tsi148.err_chk=1 quiet [1.754278] vme_user: VME User Space Access Driver [1.754695] vme_tsi148 :04:04.0: Board is the VME system controller [1.754700] vme_tsi148 :04:04.0: VME geographical address is 0 [1.754704] vme_tsi148 :04:04.0: VME Write and flush and error check is enabled [1.754942] vme_tsi148 :04:04.0: CR/CSR Offset: 0 [1.754948] vme_tsi148 :04:04.0: Enabling CR/CSR space Cheers! On Thu, Jul 3, 2014 at 8:18 AM, Maurice Moss eightplusc...@gmail.com wrote: Martyn, OK. I feel like I am not clear. The kernel command line has a space, but the line here in the email doesn't (I don't know how that happened). I am still stuck with the same issue. Sorry for all the confusion On Thu, Jul 3, 2014 at 8:15 AM, Maurice Moss eightplusc...@gmail.com wrote: Yes, copy and paste issue, I had double checked that right after I sent you the mail. Sorry!! On Thu, Jul 3, 2014 at 3:47 AM, Martyn Welch martyn.we...@ge.com wrote: On 03/07/14 00:47, Maurice Moss wrote: I upgraded to linux kernel 3.14.9 (on Fedora). Re-compiled the kernel with the vme support etc. I now get the below in my log, and don't see any vme related files in /dev !! [0.00] Kernel command line: BOOT_IMAGE=/vmlinuz-3.14.9 root=UUID=aee6e594-4be8-46d4-abe6-7c054ef239b0 ro vconsole.font=latarcyrheb-sun16 vme_user.bus=0vme_tsi148.err_chk=1 rhgb quiet Unless this is a copy and paste issue, you seem to be missing a space between vme_user.bus=0 and vme_tsi148.err_chk=1. Martyn -- Martyn Welch (Lead Software Engineer) | Registered in England and Wales GE Intelligent Platforms | (3828642) at 100 Barbirolli Square T +44(0)1327322748 | Manchester, M2 3AB E martyn.we...@ge.com | VAT:GB 927559189 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: comedi: 8255_pci: remove include of mite.h
The mite.h header is included only to pickup the MITE_IODWBSR and WENAB defines needed to set the data window (PCI BAR 1) when initializing the PCI MITE ASIC on the National Instruments boards supported by this driver. Remove the include of mite.h by adding the two defines locally in this driver. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/8255_pci.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 46a385c..be4c95e 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -56,7 +56,6 @@ Configuration Options: not applicable, uses PCI auto config #include ../comedidev.h #include 8255.h -#include mite.h enum pci_8255_boardid { BOARD_ADLINK_PCI7224, @@ -172,6 +171,10 @@ struct pci_8255_private { void __iomem *mmio_base; }; +/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ +#define WENAB (1 7) /* window enable */ + static int pci_8255_mite_init(struct pci_dev *pcidev) { void __iomem *mite_base; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging: comedi: remove unnecessary COMEDI_MITE dependancies
The mite module provides the DMA interface for the PCI MITE ASIC used on many National Instruments (NI) DAQ boards. Many of the comedi NI drivers do not support DMA and only depend on the mite driver in order to initialze the MITE ASIC. Add the code to initialization of the MITE ASIC to these drivers and remove the unnecessary dependancies. H Hartley Sweeten (4): staging: comedi: 8255_pci: remove include of mite.h staging: comedi: ni_labpc_pci: remove COMEDI_MITE and HAS_DMA dependancy staging: comedi: ni_65xx: remove COMEDI_MITE and HAS_DMA dependancy staging: comedi: ni_670x: remove COMEDI_MITE and HAS_DMA dependancy drivers/staging/comedi/Kconfig| 6 -- drivers/staging/comedi/drivers/8255_pci.c | 5 +- drivers/staging/comedi/drivers/ni_65xx.c | 127 -- drivers/staging/comedi/drivers/ni_670x.c | 59 +++- drivers/staging/comedi/drivers/ni_labpc.h | 1 - drivers/staging/comedi/drivers/ni_labpc_pci.c | 48 +++--- 6 files changed, 137 insertions(+), 109 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: comedi: ni_670x: remove COMEDI_MITE and HAS_DMA dependancy
The mite module provides the DMA interface for the PCI MITE ASIC used on many National Instruments DAQ boards. This driver does not use DMA and only depends on the mite module to initialize the MITE ASIC. Handle the initialization localy and remove the unnecessary dependancies. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/Kconfig | 2 -- drivers/staging/comedi/drivers/ni_670x.c | 59 2 files changed, 38 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8304c39..341fc07 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1037,8 +1037,6 @@ config COMEDI_NI_660X config COMEDI_NI_670X tristate NI 670x PCI card support - depends on HAS_DMA - select COMEDI_MITE ---help--- Enable support for National Instruments PCI-6703 and PCI-6704 diff --git a/drivers/staging/comedi/drivers/ni_670x.c b/drivers/staging/comedi/drivers/ni_670x.c index b487f8d..709119c 100644 --- a/drivers/staging/comedi/drivers/ni_670x.c +++ b/drivers/staging/comedi/drivers/ni_670x.c @@ -42,8 +42,6 @@ Commands are not supported. #include ../comedidev.h -#include mite.h - #define AO_VALUE_OFFSET0x00 #defineAO_CHAN_OFFSET 0x0c #defineAO_STATUS_OFFSET0x10 @@ -82,8 +80,7 @@ static const struct ni_670x_board ni_670x_boards[] = { }; struct ni_670x_private { - - struct mite_struct *mite; + void __iomem *mmio; int boardtype; int dio; unsigned int ao_readback[32]; @@ -111,9 +108,9 @@ static int ni_670x_ao_winsn(struct comedi_device *dev, for (i = 0; i insn-n; i++) { /* First write in channel register which channel to use */ writel(((chan 15) 1) | ((chan 16) 4), - devpriv-mite-daq_io_addr + AO_CHAN_OFFSET); + devpriv-mmio + AO_CHAN_OFFSET); /* write channel value */ - writel(data[i], devpriv-mite-daq_io_addr + AO_VALUE_OFFSET); + writel(data[i], devpriv-mmio + AO_VALUE_OFFSET); devpriv-ao_readback[chan] = data[i]; } @@ -140,8 +137,7 @@ static int ni_670x_dio_insn_bits(struct comedi_device *dev, unsigned int *data) { struct ni_670x_private *devpriv = dev-private; - void __iomem *io_addr = devpriv-mite-daq_io_addr + - DIO_PORT0_DATA_OFFSET; + void __iomem *io_addr = devpriv-mmio + DIO_PORT0_DATA_OFFSET; if (comedi_dio_update_state(s, data)) writel(s-state, io_addr); @@ -163,11 +159,34 @@ static int ni_670x_dio_insn_config(struct comedi_device *dev, if (ret) return ret; - writel(s-io_bits, devpriv-mite-daq_io_addr + DIO_PORT0_DIR_OFFSET); + writel(s-io_bits, devpriv-mmio + DIO_PORT0_DIR_OFFSET); return insn-n; } +/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ +#define WENAB (1 7) /* window enable */ + +static int ni_670x_mite_init(struct pci_dev *pcidev) +{ + void __iomem *mite_base; + u32 main_phys_addr; + + /* ioremap the MITE registers (BAR 0) temporarily */ + mite_base = pci_ioremap_bar(pcidev, 0); + if (!mite_base) + return -ENOMEM; + + /* set data window to main registers (BAR 1) */ + main_phys_addr = pci_resource_start(pcidev, 1); + writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR); + + /* finished with MITE registers */ + iounmap(mite_base); + return 0; +} + static int ni_670x_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -193,15 +212,13 @@ static int ni_670x_auto_attach(struct comedi_device *dev, if (!devpriv) return -ENOMEM; - devpriv-mite = mite_alloc(pcidev); - if (!devpriv-mite) - return -ENOMEM; - - ret = mite_setup(devpriv-mite); - if (ret 0) { - dev_warn(dev-class_dev, error setting up mite\n); + ret = ni_670x_mite_init(pcidev); + if (ret) return ret; - } + + devpriv-mmio = pci_ioremap_bar(pcidev, 1); + if (!devpriv-mmio) + return -ENOMEM; ret = comedi_alloc_subdevices(dev, 2); if (ret) @@ -242,9 +259,9 @@ static int ni_670x_auto_attach(struct comedi_device *dev, s-insn_config = ni_670x_dio_insn_config; /* Config of misc registers */ - writel(0x10, devpriv-mite-daq_io_addr + MISC_CONTROL_OFFSET); + writel(0x10, devpriv-mmio + MISC_CONTROL_OFFSET); /*
[PATCH 3/4] staging: comedi: ni_65xx: remove COMEDI_MITE and HAS_DMA dependancy
The mite module provides the DMA interface for the PCI MITE ASIC used on many National Instruments DAQ boards. This driver does not use DMA and only depends on the mite module to initialize the MITE ASIC. Handle the initialization localy and remove the unnecessary dependancies. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/Kconfig | 2 - drivers/staging/comedi/drivers/ni_65xx.c | 127 +++ 2 files changed, 60 insertions(+), 69 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 0c079d2..8304c39 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1014,8 +1014,6 @@ config COMEDI_NI_6527 config COMEDI_NI_65XX tristate NI 65xx static dio PCI card support - depends on HAS_DMA - select COMEDI_MITE ---help--- Enable support for National Instruments 65xx static dio boards. Supported devices: National Instruments PCI-6509 (ni_65xx), diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 59f592e..d6c1140 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -50,7 +50,6 @@ except maybe the 6514. #include ../comedidev.h #include comedi_fc.h -#include mite.h #define NI6514_DIO_SIZE 4096 #define NI6514_MITE_SIZE 4096 @@ -261,7 +260,7 @@ static inline unsigned ni_65xx_total_num_ports(const struct ni_65xx_board } struct ni_65xx_private { - struct mite_struct *mite; + void __iomem *mmio; unsigned int filter_interval; unsigned short filter_enable[NI_65XX_MAX_NUM_PORTS]; unsigned short output_bits[NI_65XX_MAX_NUM_PORTS]; @@ -300,9 +299,7 @@ static int ni_65xx_config_filter(struct comedi_device *dev, data[1] = interval * filter_resolution_ns; if (interval != devpriv-filter_interval) { - writeb(interval, - devpriv-mite-daq_io_addr + - Filter_Interval); + writeb(interval, devpriv-mmio + Filter_Interval); devpriv-filter_interval = interval; } @@ -314,7 +311,7 @@ static int ni_65xx_config_filter(struct comedi_device *dev, } writeb(devpriv-filter_enable[port], - devpriv-mite-daq_io_addr + Filter_Enable(port)); + devpriv-mmio + Filter_Enable(port)); return 2; } @@ -338,14 +335,14 @@ static int ni_65xx_dio_insn_config(struct comedi_device *dev, if (s-type != COMEDI_SUBD_DIO) return -EINVAL; devpriv-dio_direction[port] = COMEDI_OUTPUT; - writeb(0, devpriv-mite-daq_io_addr + Port_Select(port)); + writeb(0, devpriv-mmio + Port_Select(port)); return 1; break; case INSN_CONFIG_DIO_INPUT: if (s-type != COMEDI_SUBD_DIO) return -EINVAL; devpriv-dio_direction[port] = COMEDI_INPUT; - writeb(1, devpriv-mite-daq_io_addr + Port_Select(port)); + writeb(1, devpriv-mmio + Port_Select(port)); return 1; break; case INSN_CONFIG_DIO_QUERY: @@ -400,12 +397,9 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, bits = devpriv-output_bits[port]; if (board-invert_outputs) bits = ~bits; - writeb(bits, - devpriv-mite-daq_io_addr + - Port_Data(port)); + writeb(bits, devpriv-mmio + Port_Data(port)); } - port_read_bits = - readb(devpriv-mite-daq_io_addr + Port_Data(port)); + port_read_bits = readb(devpriv-mmio + Port_Data(port)); if (s-type == COMEDI_SUBD_DO board-invert_outputs) { /* Outputs inverted, so invert value read back from * DO subdevice. (Does not apply to boards with DIO @@ -430,14 +424,13 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) struct comedi_subdevice *s = dev-read_subdev; unsigned int status; - status = readb(devpriv-mite-daq_io_addr + Change_Status); + status = readb(devpriv-mmio + Change_Status); if ((status MasterInterruptStatus) == 0) return IRQ_NONE; if ((status EdgeStatus) == 0) return IRQ_NONE; - writeb(ClrEdge | ClrOverflow, - devpriv-mite-daq_io_addr + Clear_Register); + writeb(ClrEdge | ClrOverflow, devpriv-mmio + Clear_Register); comedi_buf_put(s, 0);
[PATCH 2/4] staging: comedi: ni_labpc_pci: remove COMEDI_MITE and HAS_DMA dependancy
The mite module provides the DMA interface for the PCI MITE ASIC used on many National Instruments DAQ boards. This driver does not use DMA and only depends on the mite module to initialize the MITE ASIC. Handle the initialization localy and remove the unnecessary dependancies. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/Kconfig| 2 -- drivers/staging/comedi/drivers/ni_labpc.h | 1 - drivers/staging/comedi/drivers/ni_labpc_pci.c | 48 +++ 3 files changed, 35 insertions(+), 16 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 8d992a8..0c079d2 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1049,9 +1049,7 @@ config COMEDI_NI_670X config COMEDI_NI_LABPC_PCI tristate NI Lab-PC PCI-1200 support - depends on HAS_DMA select COMEDI_NI_LABPC - select COMEDI_MITE ---help--- Enable support for National Instruments Lab-PC PCI-1200. diff --git a/drivers/staging/comedi/drivers/ni_labpc.h b/drivers/staging/comedi/drivers/ni_labpc.h index 486589f..0fb4311 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.h +++ b/drivers/staging/comedi/drivers/ni_labpc.h @@ -36,7 +36,6 @@ struct labpc_boardinfo { }; struct labpc_private { - struct mite_struct *mite; /* for mite chip on pci-1200 */ /* number of data points left to be taken */ unsigned long long count; /* software copy of analog output values */ diff --git a/drivers/staging/comedi/drivers/ni_labpc_pci.c b/drivers/staging/comedi/drivers/ni_labpc_pci.c index 358c4af..5b59be3 100644 --- a/drivers/staging/comedi/drivers/ni_labpc_pci.c +++ b/drivers/staging/comedi/drivers/ni_labpc_pci.c @@ -35,7 +35,6 @@ #include ../comedidev.h -#include mite.h #include ni_labpc.h enum labpc_pci_boardid { @@ -53,12 +52,36 @@ static const struct labpc_boardinfo labpc_pci_boards[] = { }, }; +/* ripped from mite.h and mite_setup2() to avoid mite dependancy */ +#define MITE_IODWBSR 0xc0 /* IO Device Window Base Size Register */ +#define WENAB (1 7) /* window enable */ + +static int labpc_pci_mite_init(struct pci_dev *pcidev) +{ + void __iomem *mite_base; + u32 main_phys_addr; + + /* ioremap the MITE registers (BAR 0) temporarily */ + mite_base = pci_ioremap_bar(pcidev, 0); + if (!mite_base) + return -ENOMEM; + + /* set data window to main registers (BAR 1) */ + main_phys_addr = pci_resource_start(pcidev, 1); + writel(main_phys_addr | WENAB, mite_base + MITE_IODWBSR); + + /* finished with MITE registers */ + iounmap(mite_base); + return 0; +} + static int labpc_pci_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct labpc_boardinfo *board = NULL; struct labpc_private *devpriv; + void __iomem *mmio; int ret; if (context ARRAY_SIZE(labpc_pci_boards)) @@ -72,27 +95,26 @@ static int labpc_pci_auto_attach(struct comedi_device *dev, if (ret) return ret; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) + ret = labpc_pci_mite_init(pcidev); + if (ret) + return ret; + + mmio = pci_ioremap_bar(pcidev, 1); + if (!mmio) return -ENOMEM; + dev-iobase = (unsigned long)mmio; - devpriv-mite = mite_alloc(pcidev); - if (!devpriv-mite) + devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); + if (!devpriv) return -ENOMEM; - ret = mite_setup(devpriv-mite); - if (ret 0) - return ret; - dev-iobase = (unsigned long)devpriv-mite-daq_io_addr; return labpc_common_attach(dev, pcidev-irq, IRQF_SHARED); } static void labpc_pci_detach(struct comedi_device *dev) { - struct labpc_private *devpriv = dev-private; - - if (devpriv) - mite_detach(devpriv-mite); + if (dev-iobase) + iounmap((void __iomem *)dev-iobase); if (dev-irq) free_irq(dev-irq, dev); comedi_pci_disable(dev); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 11/18] staging: comedi: ni_65xx: tidy up the comedi_driver declaration
For aesthetics, add some whitespace to the comedi_driver declaration. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 07d5949..6c194fc 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -714,10 +714,10 @@ static void ni_65xx_detach(struct comedi_device *dev) } static struct comedi_driver ni_65xx_driver = { - .driver_name = ni_65xx, - .module = THIS_MODULE, - .auto_attach = ni_65xx_auto_attach, - .detach = ni_65xx_detach, + .driver_name= ni_65xx, + .module = THIS_MODULE, + .auto_attach= ni_65xx_auto_attach, + .detach = ni_65xx_detach, }; static int ni_65xx_pci_probe(struct pci_dev *dev, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 14/18] staging: comedi: ni_65xx: tidy ni_65xx_intr_insn_bits() declaration
For aesthetics, tidy up the whitespace of this function declarations to follow the form in the rest of the driver. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index e547c2f..46d4ebc 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -511,7 +511,8 @@ static int ni_65xx_intr_cancel(struct comedi_device *dev, static int ni_65xx_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { data[1] = 0; return insn-n; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 00/18] staging: comedi: ni_65xx: cleanup driver
This series cleans up the comedi ni_65xx driver. v2: drop the patch that removed the 'invert_outputs' from the boardinfo reorder the series a bit to handle the 'invert_outputs' correctly Depends on: [PATCH 0/4] staging: comedi: remove unnecessary COMEDI_MITE dependancies H Hartley Sweeten (18): staging: comedi: ni_65xx: filter interval register is 32-bit staging: comedi: ni_65xx: cleanup non-recurring register map defines staging: comedi: ni_65xx: cleanup recurring register map staging: comedi: ni_65xx: cleanup INSN_CONFIG_FILTER handling staging: comedi: ni_65xx: remove 'dio_direction' from private data staging: comedi: ni_65xx: remove the need for the subdevice private data staging: comedi: ni_65xx: hook up command support only if irq is available staging: comedi: ni_65xx: fix ni_65xx_intr_insn_config() staging: comedi: ni_65xx: tidy up the port-chan conversions staging: comedi: ni_65xx: tidy up the subdevice initialization staging: comedi: ni_65xx: tidy up the comedi_driver declaration staging: comedi: ni_65xx: clean up multi-line comments staging: comedi: ni_65xx: update the MODULE_DESCRIPTION staging: comedi: ni_65xx: tidy ni_65xx_intr_insn_bits() declaration staging: comedi: ni_65xx: remove 'output_bits' from private data staging: comedi: ni_65xx: use the subdevice 'io_bits' to handle the 'invert_outputs' staging: comedi: ni_65xx: fix digital output reset during attach staging: comedi: ni_65xx: factor input filter disable out of (*auto_attach) drivers/staging/comedi/drivers/ni_65xx.c | 624 --- 1 file changed, 325 insertions(+), 299 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 17/18] staging: comedi: ni_65xx: fix digital output reset during attach
During the attach of this driver, the digital output ports are all initialized to a known state. Some of the boards supported by this driver have output ports that are inverted from the comedi view of the output state. For these boards the values written to the ports needs to be inverted. Currently, only bit 0 of each port is inverted when the boardinfo indicates that the outputs are inverted. This results in channels 0, 8, 16, etc. being set to '0' and all other channels being set to '1'. If the boardinfo does not indicate that the outputs are inverted, all the channels are set to '0'. This initialization is unnecessary for the input only ports. The input/output ports also do not need to be initialized since they are configured as inputs during the attach. Move the output port initialization so it occurs when the digital output subdevice is setup. Use the 's-io_bits' value to initialize the ports so that the correct inverted/non-inverted state is used for the comedi '0' value. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 14 -- 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 3e25e4e..a0deb01 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -659,6 +659,13 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, /* use the io_bits to handle the inverted outputs */ s-io_bits = (board-invert_outputs) ? 0xff : 0x00; + + /* reset all output ports to comedi '0' */ + for (i = 0; i board-num_do_ports; ++i) { + writeb(s-io_bits, /* inverted if necessary */ + devpriv-mmio + + NI_65XX_IO_DATA_REG(board-num_di_ports + i)); + } } else { s-type = COMEDI_SUBD_UNUSED; } @@ -702,13 +709,8 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, s-cancel = ni_65xx_intr_cancel; } - for (i = 0; i ni_65xx_total_num_ports(board); ++i) { + for (i = 0; i ni_65xx_total_num_ports(board); ++i) writeb(0x00, devpriv-mmio + NI_65XX_FILTER_ENA(i)); - if (board-invert_outputs) - writeb(0x01, devpriv-mmio + NI_65XX_IO_DATA_REG(i)); - else - writeb(0x00, devpriv-mmio + NI_65XX_IO_DATA_REG(i)); - } /* Set filter interval to 0 (32bit reg) */ writel(0x, devpriv-mmio + NI_65XX_FILTER_REG); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 16/18] staging: comedi: ni_65xx: use the subdevice 'io_bits' to handle the 'invert_outputs'
Some of the boards supported by this driver have output ports that are inverted from the comedi view of the output state. For these boards the read values from the output ports needs to be inverted before being modified and inverted again before being written back in the (*insn_bits) operation. Currently the subdevice type and the boardinfo is checked in the (*insn_bits) to determine if the inverted outputs need to be handled. Since thise driver does not use the subdevice 'io_bits', simplify the driver a bit by initializing the 'io_bits' during the attach to handle the inversion. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index a6d5fde..3e25e4e 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -362,19 +362,13 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct ni_65xx_board *board = comedi_board(dev); struct ni_65xx_private *devpriv = dev-private; unsigned long base_port = (unsigned long)s-private; unsigned int base_chan = CR_CHAN(insn-chanspec); int last_port_offset = NI_65XX_CHAN_TO_PORT(s-n_chan - 1); - unsigned invert = 0x00; unsigned read_bits = 0; int port_offset; - /* handle inverted outputs if necessary */ - if (s-type == COMEDI_SUBD_DO board-invert_outputs) - invert = 0xff; - for (port_offset = NI_65XX_CHAN_TO_PORT(base_chan); port_offset = last_port_offset; port_offset++) { unsigned port = base_port + port_offset; @@ -399,16 +393,16 @@ static int ni_65xx_dio_insn_bits(struct comedi_device *dev, /* update the outputs */ if (port_mask) { bits = readb(devpriv-mmio + NI_65XX_IO_DATA_REG(port)); - bits ^= invert; + bits ^= s-io_bits; /* invert if necessary */ bits = ~port_mask; bits |= (port_data port_mask); - bits ^= invert; + bits ^= s-io_bits; /* invert back */ writeb(bits, devpriv-mmio + NI_65XX_IO_DATA_REG(port)); } /* read back the actual state */ bits = readb(devpriv-mmio + NI_65XX_IO_DATA_REG(port)); - bits ^= invert; + bits ^= s-io_bits; /* invert if necessary */ if (bitshift 0) bits = bitshift; else @@ -662,6 +656,9 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, /* the output ports always start after the input ports */ s-private = (void *)(unsigned long)board-num_di_ports; + + /* use the io_bits to handle the inverted outputs */ + s-io_bits = (board-invert_outputs) ? 0xff : 0x00; } else { s-type = COMEDI_SUBD_UNUSED; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 02/18] staging: comedi: ni_65xx: cleanup non-recurring register map defines
Rename the CamelCase defines used for the non-recurring registers. Define all the non-recurring registers and bits. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 99 1 file changed, 62 insertions(+), 37 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 292355b..42d2c24 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -51,8 +51,50 @@ except maybe the 6514. #include comedi_fc.h -#define NI6514_DIO_SIZE 4096 -#define NI6514_MITE_SIZE 4096 +/* + * PCI BAR1 Register Map + */ + +/* Non-recurring Registers (8-bit except where noted) */ +#define NI_65XX_ID_REG 0x00 +#define NI_65XX_CLR_REG0x01 +#define NI_65XX_CLR_WDOG_INT (1 6) +#define NI_65XX_CLR_WDOG_PING (1 5) +#define NI_65XX_CLR_WDOG_EXP (1 4) +#define NI_65XX_CLR_EDGE_INT (1 3) +#define NI_65XX_CLR_OVERFLOW_INT (1 2) +#define NI_65XX_STATUS_REG 0x02 +#define NI_65XX_STATUS_WDOG_INT(1 5) +#define NI_65XX_STATUS_FALL_EDGE (1 4) +#define NI_65XX_STATUS_RISE_EDGE (1 3) +#define NI_65XX_STATUS_INT (1 2) +#define NI_65XX_STATUS_OVERFLOW_INT(1 1) +#define NI_65XX_STATUS_EDGE_INT(1 0) +#define NI_65XX_CTRL_REG 0x03 +#define NI_65XX_CTRL_WDOG_ENA (1 5) +#define NI_65XX_CTRL_FALL_EDGE_ENA (1 4) +#define NI_65XX_CTRL_RISE_EDGE_ENA (1 3) +#define NI_65XX_CTRL_INT_ENA (1 2) +#define NI_65XX_CTRL_OVERFLOW_ENA (1 1) +#define NI_65XX_CTRL_EDGE_ENA (1 0) +#define NI_65XX_REV_REG0x04 /* 32-bit */ +#define NI_65XX_FILTER_REG 0x08 /* 32-bit */ +#define NI_65XX_RTSI_ROUTE_REG 0x0c /* 16-bit */ +#define NI_65XX_RTSI_EDGE_REG 0x0e /* 16-bit */ +#define NI_65XX_RTSI_WDOG_REG 0x10 /* 16-bit */ +#define NI_65XX_RTSI_TRIG_REG 0x12 /* 16-bit */ +#define NI_65XX_AUTO_CLK_SEL_REG 0x14 /* PXI-6528 only */ +#define NI_65XX_AUTO_CLK_SEL_STATUS(1 1) +#define NI_65XX_AUTO_CLK_SEL_DISABLE (1 0) +#define NI_65XX_WDOG_CTRL_REG 0x15 +#define NI_65XX_WDOG_CTRL_ENA (1 0) +#define NI_65XX_RTSI_CFG_REG 0x16 +#define NI_65XX_RTSI_CFG_RISE_SENSE(1 2) +#define NI_65XX_RTSI_CFG_FALL_SENSE(1 1) +#define NI_65XX_RTSI_CFG_SYNC_DETECT (1 0) +#define NI_65XX_WDOG_STATUS_REG0x17 +#define NI_65XX_WDOG_STATUS_EXP(1 0) +#define NI_65XX_WDOG_INTERVAL_REG 0x18 /* 32-bit */ #define NI_65XX_MAX_NUM_PORTS 12 static const unsigned ni_65xx_channels_per_port = 8; @@ -83,26 +125,6 @@ static inline unsigned Filter_Enable(unsigned port) return 0x44 + port * ni_65xx_port_offset; } -#define ID_Register0x00 - -#define Clear_Register 0x01 -#define ClrEdge0x08 -#define ClrOverflow0x04 - -#define Filter_Interval0x08 - -#define Change_Status 0x02 -#define MasterInterruptStatus 0x04 -#define Overflow 0x02 -#define EdgeStatus 0x01 - -#define Master_Interrupt_Control 0x03 -#define FallingEdgeIntEnable 0x10 -#define RisingEdgeIntEnable0x08 -#define MasterInterruptEnable 0x04 -#define OverflowIntEnable 0x02 -#define EdgeIntEnable 0x01 - enum ni_65xx_boardid { BOARD_PCI6509, BOARD_PXI6509, @@ -299,7 +321,7 @@ static int ni_65xx_config_filter(struct comedi_device *dev, data[1] = interval * filter_resolution_ns; if (interval != devpriv-filter_interval) { - writel(interval, devpriv-mmio + Filter_Interval); + writel(interval, devpriv-mmio + NI_65XX_FILTER_REG); devpriv-filter_interval = interval; } @@ -424,13 +446,14 @@ static irqreturn_t ni_65xx_interrupt(int irq, void *d) struct comedi_subdevice *s = dev-read_subdev; unsigned int status; - status = readb(devpriv-mmio + Change_Status); - if ((status MasterInterruptStatus) == 0) + status = readb(devpriv-mmio + NI_65XX_STATUS_REG); + if ((status NI_65XX_STATUS_INT) == 0) return IRQ_NONE; - if ((status EdgeStatus) == 0) + if ((status NI_65XX_STATUS_EDGE_INT) == 0) return IRQ_NONE; - writeb(ClrEdge | ClrOverflow, devpriv-mmio + Clear_Register); + writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT, + devpriv-mmio + NI_65XX_CLR_REG);
[PATCH v2 18/18] staging: comedi: ni_65xx: factor input filter disable out of (*auto_attach)
For aesthetics, factor the code that disables the input filters out of ni_65xx_auto_attach(). Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 31 --- 1 file changed, 20 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index a0deb01..cad2c28 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -278,16 +278,29 @@ static const struct ni_65xx_board ni_65xx_boards[] = { }, }; -static inline unsigned ni_65xx_total_num_ports(const struct ni_65xx_board - *board) -{ - return board-num_dio_ports + board-num_di_ports + board-num_do_ports; -} - struct ni_65xx_private { void __iomem *mmio; }; +static void ni_65xx_disable_input_filters(struct comedi_device *dev) +{ + const struct ni_65xx_board *board = comedi_board(dev); + struct ni_65xx_private *devpriv = dev-private; + unsigned num_ports; + int i; + + num_ports = board-num_dio_ports + + board-num_di_ports + + board-num_do_ports; + + /* disable input filtering on all ports */ + for (i = 0; i num_ports; ++i) + writeb(0x00, devpriv-mmio + NI_65XX_FILTER_ENA(i)); + + /* set filter interval to 0 (32bit reg) */ + writel(0x, devpriv-mmio + NI_65XX_FILTER_REG); +} + static int ni_65xx_dio_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -709,11 +722,7 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, s-cancel = ni_65xx_intr_cancel; } - for (i = 0; i ni_65xx_total_num_ports(board); ++i) - writeb(0x00, devpriv-mmio + NI_65XX_FILTER_ENA(i)); - - /* Set filter interval to 0 (32bit reg) */ - writel(0x, devpriv-mmio + NI_65XX_FILTER_REG); + ni_65xx_disable_input_filters(dev); return 0; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 07/18] staging: comedi: ni_65xx: hook up command support only if irq is available
Subdevice 3 is used in this driver to provide edge detection of the input channels. Move the reset/disable of the interrupts and the request_irq() so that when subdevice 3 is setup we can conditionally hookup the async command support only if the irq is available. Also, remove the noise when the irq is not available. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 49 +--- 1 file changed, 26 insertions(+), 23 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 7e562f1..517dbc6 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -582,7 +582,17 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, if (!devpriv-mmio) return -ENOMEM; - dev-irq = pcidev-irq; + writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT, + devpriv-mmio + NI_65XX_CLR_REG); + writeb(0x00, devpriv-mmio + NI_65XX_CTRL_REG); + + if (pcidev-irq) { + ret = request_irq(pcidev-irq, ni_65xx_interrupt, IRQF_SHARED, + dev-board_name, dev); + if (ret == 0) + dev-irq = pcidev-irq; + } + dev_info(dev-class_dev, board: %s, ID=0x%02x, dev-board_name, readb(devpriv-mmio + NI_65XX_ID_REG)); @@ -647,18 +657,21 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, } s = dev-subdevices[3]; - dev-read_subdev = s; - s-type = COMEDI_SUBD_DI; - s-subdev_flags = SDF_READABLE | SDF_CMD_READ; - s-n_chan = 1; - s-range_table = range_unknown; - s-maxdata = 1; - s-len_chanlist = 1; - s-do_cmdtest = ni_65xx_intr_cmdtest; - s-do_cmd = ni_65xx_intr_cmd; - s-cancel = ni_65xx_intr_cancel; - s-insn_bits = ni_65xx_intr_insn_bits; - s-insn_config = ni_65xx_intr_insn_config; + s-type = COMEDI_SUBD_DI; + s-subdev_flags = SDF_READABLE; + s-n_chan = 1; + s-maxdata = 1; + s-range_table = range_digital; + s-insn_bits= ni_65xx_intr_insn_bits; + if (dev-irq) { + dev-read_subdev = s; + s-subdev_flags |= SDF_CMD_READ; + s-len_chanlist = 1; + s-insn_config = ni_65xx_intr_insn_config; + s-do_cmdtest = ni_65xx_intr_cmdtest; + s-do_cmd = ni_65xx_intr_cmd; + s-cancel = ni_65xx_intr_cancel; + } for (i = 0; i ni_65xx_total_num_ports(board); ++i) { writeb(0x00, devpriv-mmio + NI_65XX_FILTER_ENA(i)); @@ -667,20 +680,10 @@ static int ni_65xx_auto_attach(struct comedi_device *dev, else writeb(0x00, devpriv-mmio + NI_65XX_IO_DATA_REG(i)); } - writeb(NI_65XX_CLR_EDGE_INT | NI_65XX_CLR_OVERFLOW_INT, - devpriv-mmio + NI_65XX_CLR_REG); - writeb(0x00, devpriv-mmio + NI_65XX_CTRL_REG); /* Set filter interval to 0 (32bit reg) */ writel(0x, devpriv-mmio + NI_65XX_FILTER_REG); - ret = request_irq(dev-irq, ni_65xx_interrupt, IRQF_SHARED, - ni_65xx, dev); - if (ret 0) { - dev-irq = 0; - dev_warn(dev-class_dev, irq not available\n); - } - return 0; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 13/18] staging: comedi: ni_65xx: update the MODULE_DESCRIPTION
Update the MODULE_DESCRIPTION to better describe the driver. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 3b56359..e547c2f 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -781,5 +781,5 @@ static struct pci_driver ni_65xx_pci_driver = { module_comedi_pci_driver(ni_65xx_driver, ni_65xx_pci_driver); MODULE_AUTHOR(Comedi http://www.comedi.org;); -MODULE_DESCRIPTION(Comedi low-level driver); +MODULE_DESCRIPTION(Comedi driver for NI PCI-65xx static dio boards); MODULE_LICENSE(GPL); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 08/18] staging: comedi: ni_65xx: fix ni_65xx_intr_insn_config()
Refactor this function to follow the standard (*insn_config) form. Add a sanity check of the number of data parameters (insn-n). Currently the core does not check INSN_CONFIG_CHANGE_NOTIFY. Fix the writes to the rise/fall edge enable registers. The macro expects a port value not the port offset value. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 45 +++- 1 file changed, 32 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 517dbc6..742d3cd 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -508,22 +508,41 @@ static int ni_65xx_intr_insn_config(struct comedi_device *dev, { struct ni_65xx_private *devpriv = dev-private; - if (insn-n 1) - return -EINVAL; - if (data[0] != INSN_CONFIG_CHANGE_NOTIFY) - return -EINVAL; + switch (data[0]) { + case INSN_CONFIG_CHANGE_NOTIFY: + /* add instruction to check_insn_config_length() */ + if (insn-n != 3) + return -EINVAL; - writeb(data[1], devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(0)); - writeb(data[1] 8, devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(0x10)); - writeb(data[1] 16, devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(0x20)); - writeb(data[1] 24, devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(0x30)); + /* +* This only works for the first 4 ports (32 channels)! +*/ - writeb(data[2], devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(0)); - writeb(data[2] 8, devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(0x10)); - writeb(data[2] 16, devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(0x20)); - writeb(data[2] 24, devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(0x30)); + /* set the channels to monitor for rising edges */ + writeb(data[1] 0xff, + devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(0)); + writeb((data[1] 8) 0xff, + devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(1)); + writeb((data[1] 16) 0xff, + devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(2)); + writeb((data[1] 24) 0xff, + devpriv-mmio + NI_65XX_RISE_EDGE_ENA_REG(3)); + + /* set the channels to monitor for falling edges */ + writeb(data[2] 0xff, + devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(0)); + writeb((data[2] 8) 0xff, + devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(1)); + writeb((data[2] 16) 0xff, + devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(2)); + writeb((data[2] 24) 0xff, + devpriv-mmio + NI_65XX_FALL_EDGE_ENA_REG(3)); + break; + default: + return -EINVAL; + } - return 2; + return insn-n; } /* ripped from mite.h and mite_setup2() to avoid mite dependancy */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 12/18] staging: comedi: ni_65xx: clean up multi-line comments
Clean up the multi-line comments at the beginning of the file so they follow the kernel CodingStyle. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Reviewed-by: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_65xx.c | 95 +++- 1 file changed, 57 insertions(+), 38 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_65xx.c b/drivers/staging/comedi/drivers/ni_65xx.c index 6c194fc..3b56359 100644 --- a/drivers/staging/comedi/drivers/ni_65xx.c +++ b/drivers/staging/comedi/drivers/ni_65xx.c @@ -1,46 +1,65 @@ /* -comedi/drivers/ni_6514.c -driver for National Instruments PCI-6514 - -Copyright (C) 2006 Jon Grierson j...@renko.co.uk -Copyright (C) 2006 Frank Mori Hess fmh...@users.sourceforge.net - -COMEDI - Linux Control and Measurement Device Interface -Copyright (C) 1999,2002,2003 David A. Schleef d...@schleef.org - -This program 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 2 of the License, or -(at your option) any later version. + * ni_65xx.c + * Comedi driver for National Instruments PCI-65xx static dio boards + * + * Copyright (C) 2006 Jon Grierson j...@renko.co.uk + * Copyright (C) 2006 Frank Mori Hess fmh...@users.sourceforge.net + * + * COMEDI - Linux Control and Measurement Device Interface + * Copyright (C) 1999,2002,2003 David A. Schleef d...@schleef.org + * + * This program 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 2 of the License, or + * (at your option) any later version. + * + * This program 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. + */ -This program 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. -*/ /* -Driver: ni_65xx -Description: National Instruments 65xx static dio boards -Author: Jon Grierson j...@renko.co.uk, - Frank Mori Hess fmh...@users.sourceforge.net -Status: testing -Devices: [National Instruments] PCI-6509 (ni_65xx), PXI-6509, PCI-6510, - PCI-6511, PXI-6511, PCI-6512, PXI-6512, PCI-6513, PXI-6513, PCI-6514, - PXI-6514, PCI-6515, PXI-6515, PCI-6516, PCI-6517, PCI-6518, PCI-6519, - PCI-6520, PCI-6521, PXI-6521, PCI-6528, PXI-6528 -Updated: Wed Oct 18 08:59:11 EDT 2006 - -Based on the PCI-6527 driver by ds. -The interrupt subdevice (subdevice 3) is probably broken for all boards -except maybe the 6514. - -*/ + * Driver: ni_65xx + * Description: National Instruments 65xx static dio boards + * Author: Jon Grierson j...@renko.co.uk, + *Frank Mori Hess fmh...@users.sourceforge.net + * Status: testing + * Devices: (National Instruments) PCI-6509 [ni_65xx] + * (National Instruments) PXI-6509 [ni_65xx] + * (National Instruments) PCI-6510 [ni_65xx] + * (National Instruments) PCI-6511 [ni_65xx] + * (National Instruments) PXI-6511 [ni_65xx] + * (National Instruments) PCI-6512 [ni_65xx] + * (National Instruments) PXI-6512 [ni_65xx] + * (National Instruments) PCI-6513 [ni_65xx] + * (National Instruments) PXI-6513 [ni_65xx] + * (National Instruments) PCI-6514 [ni_65xx] + * (National Instruments) PXI-6514 [ni_65xx] + * (National Instruments) PCI-6515 [ni_65xx] + * (National Instruments) PXI-6515 [ni_65xx] + * (National Instruments) PCI-6516 [ni_65xx] + * (National Instruments) PCI-6517 [ni_65xx] + * (National Instruments) PCI-6518 [ni_65xx] + * (National Instruments) PCI-6519 [ni_65xx] + * (National Instruments) PCI-6520 [ni_65xx] + * (National Instruments) PCI-6521 [ni_65xx] + * (National Instruments) PXI-6521 [ni_65xx] + * (National Instruments) PCI-6528 [ni_65xx] + * (National Instruments) PXI-6528 [ni_65xx] + * Updated: Wed Oct 18 08:59:11 EDT 2006 + * + * Configuration Options: not applicable, uses PCI auto config + * + * Based on the PCI-6527 driver by ds. + * The interrupt subdevice (subdevice 3) is probably broken for all + * boards except maybe the 6514. + */ /* - Manuals (available from ftp://ftp.natinst.com/support/manuals) - - 370106b.pdf 6514 Register Level Programmer Manual - + * Manuals (available from ftp://ftp.natinst.com/support/manuals) + * + * 370106b.pdf 6514 Register Level Programmer Manual */ #include linux/module.h -- 1.9.3
[PATCH V4 6/6] staging: vt6556: Replace printk by pr_warn
This patch fixes a checkpatch warning by replacing printk by pr_warn. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/main_usb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index cc0281a..64c25e2 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -527,7 +527,7 @@ static void usb_device_reset(struct vnt_private *pDevice) status = usb_reset_device(pDevice-usb); if (status) -printk(usb_device_reset fail status=%d\n,status); + pr_warn(usb_device_reset fail status=%d\n, status); } static void device_free_int_bufs(struct vnt_private *priv) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V4 1/6] staging: vt6556: Cleanup trivial coding style issues
This patch cleans up the following checkpatch issues: - tabs instead of spaces on the beginning of a line - use correct /* */ comment style - put { and } on the correct places - line over 80 chars - indentation style for multi-line calls / comments - space after semicolon , - new line after declaration Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/baseband.c | 23 --- drivers/staging/vt6656/card.c | 13 + drivers/staging/vt6656/card.h | 6 ++-- drivers/staging/vt6656/channel.c | 5 ++-- drivers/staging/vt6656/device.h | 10 +++ drivers/staging/vt6656/main_usb.c | 59 --- 6 files changed, 61 insertions(+), 55 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index c1675d5..8678b41 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -26,9 +26,10 @@ * Date: Jun. 5, 2002 * * Functions: - * vnt_get_frame_time- Calculate data frame transmitting time - * vnt_get_phy_field - Calculate PhyLength, PhyService and Phy Signal parameter for baseband Tx - * BBbVT3184Init - VIA VT3184 baseband chip init code + * vnt_get_frame_time - Calculate data frame transmitting time + * vnt_get_phy_field - Calculate PhyLength, PhyService and Phy + * Signal parameter for baseband Tx + * BBbVT3184Init - VIA VT3184 baseband chip init code * * Revision History: * @@ -86,7 +87,7 @@ static u8 vnt_vt3184_al2230[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */ }; -//{{RobertYu:20060515, new BB setting for VT3226D0 +/* {{RobertYu:20060515, new BB setting for VT3226D0 */ static u8 vnt_vt3184_vt3226d0[] = { 0x31, 0x00, 0x00, 0x00, 0x00, 0x80, 0x00, 0x00, 0x70, 0x45, 0x2a, 0x76, 0x00, 0x00, 0x80, 0x00, /* 0x0f */ @@ -122,8 +123,9 @@ static u8 vnt_vt3184_vt3226d0[] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 /* 0xff */ }; -static const u16 awcFrameTime[MAX_RATE] = -{10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216}; +static const u16 awcFrameTime[MAX_RATE] = { + 10, 20, 55, 110, 24, 36, 48, 72, 96, 144, 192, 216 +}; /* * Description: Calculate data frame transmitting time @@ -191,9 +193,9 @@ unsigned int vnt_get_frame_time(u8 preamble_type, u8 pkt_type, * tx_rate - Tx Rate * Out: * struct vnt_phy_field *phy - * - pointer to Phy Length field - * - pointer to Phy Service field - * - pointer to Phy Signal field + * - pointer to Phy Length field + * - pointer to Phy Service field + * - pointer to Phy Signal field * * Return Value: none * @@ -467,7 +469,8 @@ int BBbVT3184Init(struct vnt_private *priv) priv-ldBmThreshold[2] = 0; priv-ldBmThreshold[3] = 0; /* Fix VT3226 DFC system timing issue */ - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); + vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, + SOFTPWRCTL_RFLEOPT); } else { return true; } diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index ea06b63..37cd96b 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -55,11 +55,12 @@ #include key.h #include usbpipe.h -//const u16 cwRXBCNTSFOff[MAX_RATE] = -//{17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; +/* const u16 cwRXBCNTSFOff[MAX_RATE] = + {17, 34, 96, 192, 34, 23, 17, 11, 8, 5, 4, 3}; */ -static const u16 cwRXBCNTSFOff[MAX_RATE] = -{192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3}; +static const u16 cwRXBCNTSFOff[MAX_RATE] = { + 192, 96, 34, 17, 34, 23, 17, 11, 8, 5, 4, 3 +}; /* * Description: Set NIC media channel @@ -477,7 +478,7 @@ void vnt_update_top_rates(struct vnt_private *priv) } priv-byTopCCKBasicRate = top_cck; - } +} int vnt_ofdm_min_rate(struct vnt_private *priv) { @@ -710,7 +711,7 @@ void vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf, data[7] = (u8)(tsf 56); vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT, - MESSAGE_REQUEST_TBTT, 0, 8, data); + MESSAGE_REQUEST_TBTT, 0, 8, data); dev_dbg(priv-usb-dev, %s TBTT: %8llx\n, __func__, tsf); diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 5b7cc5a..80fcd53 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -39,9 +39,9 @@ typedef enum _CARD_PHY_TYPE { PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; -#define CB_MAX_CHANNEL_24G 14 -#define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==42 */
[PATCH V4 4/6] staging: vt6556: Remove typedefs
This patch removes uneeded typedefs reported by chackpatch and removes one enum. The removed enum from card.h: typedef enum _CARD_PHY_TYPE { PHY_TYPE_AUTO = 0, PHY_TYPE_11B, PHY_TYPE_11G, PHY_TYPE_11A } CARD_PHY_TYPE, *PCARD_PHY_TYPE; The following typedefs were removed, but enums were kept at device.h: typedef enum __device_msg_level typedef enum __DEVICE_NDIS_STATUS Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/card.h | 7 --- drivers/staging/vt6656/device.h | 17 - 2 files changed, 8 insertions(+), 16 deletions(-) diff --git a/drivers/staging/vt6656/card.h b/drivers/staging/vt6656/card.h index 80fcd53..03fc167 100644 --- a/drivers/staging/vt6656/card.h +++ b/drivers/staging/vt6656/card.h @@ -32,13 +32,6 @@ /* init card type */ -typedef enum _CARD_PHY_TYPE { -PHY_TYPE_AUTO = 0, -PHY_TYPE_11B, -PHY_TYPE_11G, -PHY_TYPE_11A -} CARD_PHY_TYPE, *PCARD_PHY_TYPE; - #define CB_MAX_CHANNEL_24G 14 #define CB_MAX_CHANNEL_5G 42 /* add channel9(5045MHz), 41==42 */ #define CB_MAX_CHANNEL (CB_MAX_CHANNEL_24G + CB_MAX_CHANNEL_5G) diff --git a/drivers/staging/vt6656/device.h b/drivers/staging/vt6656/device.h index 50a6749..e3acf2f 100644 --- a/drivers/staging/vt6656/device.h +++ b/drivers/staging/vt6656/device.h @@ -187,13 +187,13 @@ #define DBG_PRT(l, p, args...) { if (l = msglevel) printk(p, ##args); } -typedef enum __device_msg_level { +enum { MSG_LEVEL_ERR = 0,/* Errors causing abnormal operation */ MSG_LEVEL_NOTICE = 1, /* Errors needing user notification */ MSG_LEVEL_INFO = 2, /* Normal message. */ MSG_LEVEL_VERBOSE = 3,/* Will report all trival errors. */ MSG_LEVEL_DEBUG = 4 /* Only for debug purpose. */ -} DEVICE_MSG_LEVEL, *PDEVICE_MSG_LEVEL; +}; #define DEVICE_INIT_COLD 0x0 /* cold init */ #define DEVICE_INIT_RESET 0x1 /* reset init or Dx to D0 power remain */ @@ -268,13 +268,12 @@ struct vnt_interrupt_buffer { /*++ NDIS related */ -typedef enum __DEVICE_NDIS_STATUS { -STATUS_SUCCESS = 0, -STATUS_FAILURE, -STATUS_RESOURCES, -STATUS_PENDING, -} DEVICE_NDIS_STATUS, *PDEVICE_NDIS_STATUS; - +enum { + STATUS_SUCCESS = 0, + STATUS_FAILURE, + STATUS_RESOURCES, + STATUS_PENDING, +}; /* flags for options */ #define DEVICE_FLAGS_UNPLUG 0x0001UL -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V4 5/6] staging: vt6556: Cleanup indentation on statements
Use tabs instead of spaces in a set of statements and fix lines over 80 chars. Reported by checkpatch. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/main_usb.c | 44 --- 1 file changed, 23 insertions(+), 21 deletions(-) diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 553a8e9..cc0281a 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -382,38 +382,40 @@ static int device_init_registers(struct vnt_private *pDevice) /* load vt3266 calibration parameters in EEPROM */ if (pDevice-byRFType == RF_VT3226D0) { if ((pDevice-abyEEPROM[EEP_OFS_MAJOR_VER] == 0x1) - (pDevice-abyEEPROM[EEP_OFS_MINOR_VER] = 0x4)) { + (pDevice-abyEEPROM[EEP_OFS_MINOR_VER] = 0x4)) { byCalibTXIQ = pDevice-abyEEPROM[EEP_OFS_CALIB_TX_IQ]; byCalibTXDC = pDevice-abyEEPROM[EEP_OFS_CALIB_TX_DC]; byCalibRXIQ = pDevice-abyEEPROM[EEP_OFS_CALIB_RX_IQ]; if (byCalibTXIQ || byCalibTXDC || byCalibRXIQ) { - /* CR255, enable TX/RX IQ and DC compensation mode */ + /* CR255, enable TX/RX IQ and + DC compensation mode */ vnt_control_out_u8(pDevice, - MESSAGE_REQUEST_BBREG, - 0xff, - 0x03); - /* CR251, TX I/Q Imbalance Calibration */ + MESSAGE_REQUEST_BBREG, + 0xff, + 0x03); + /* CR251, TX I/Q Imbalance Calibration */ vnt_control_out_u8(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfb, - byCalibTXIQ); - /* CR252, TX DC-Offset Calibration */ + MESSAGE_REQUEST_BBREG, + 0xfb, + byCalibTXIQ); + /* CR252, TX DC-Offset Calibration */ vnt_control_out_u8(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfC, - byCalibTXDC); - /* CR253, RX I/Q Imbalance Calibration */ + MESSAGE_REQUEST_BBREG, + 0xfC, + byCalibTXDC); + /* CR253, RX I/Q Imbalance Calibration */ vnt_control_out_u8(pDevice, - MESSAGE_REQUEST_BBREG, - 0xfd, - byCalibRXIQ); + MESSAGE_REQUEST_BBREG, + 0xfd, + byCalibRXIQ); } else { - /* CR255, turn off BB Calibration compensation */ + /* CR255, turn off + BB Calibration compensation */ vnt_control_out_u8(pDevice, - MESSAGE_REQUEST_BBREG, - 0xff, - 0x0); + MESSAGE_REQUEST_BBREG, + 0xff, + 0x0); } } } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V4 2/6] staging: vt6556: Remove double parentheses
This patch cleanup a checkpatch warning by removing double parentheses from if condition. Additionally it fixes a line over 80 chars. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/baseband.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vt6656/baseband.c b/drivers/staging/vt6656/baseband.c index 8678b41..040b232 100644 --- a/drivers/staging/vt6656/baseband.c +++ b/drivers/staging/vt6656/baseband.c @@ -452,8 +452,9 @@ int BBbVT3184Init(struct vnt_private *priv) priv-ldBmThreshold[2] = 0; priv-ldBmThreshold[3] = 0; /* Fix VT3226 DFC system timing issue */ - vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, SOFTPWRCTL_RFLEOPT); - } else if ((priv-byRFType == RF_VT3342A0)) { + vnt_mac_reg_bits_on(priv, MAC_REG_SOFTPWRCTL2, + SOFTPWRCTL_RFLEOPT); + } else if (priv-byRFType == RF_VT3342A0) { priv-byBBRxConf = vnt_vt3184_vt3226d0[10]; length = sizeof(vnt_vt3184_vt3226d0); addr = vnt_vt3184_vt3226d0; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH V4 3/6] staging: vt6556: Remove uneeded return statements
This patch remove uneeded return statements reported by checkpatch and fixes the indentation of a multi-line call. Tested by compilation only. Signed-off-by: Peter Senna Tschudin peter.se...@gmail.com --- Cahnges from V3: - Splitted the patches by change type drivers/staging/vt6656/card.c | 6 +- drivers/staging/vt6656/main_usb.c | 13 - 2 files changed, 1 insertion(+), 18 deletions(-) diff --git a/drivers/staging/vt6656/card.c b/drivers/staging/vt6656/card.c index 37cd96b..f469d68 100644 --- a/drivers/staging/vt6656/card.c +++ b/drivers/staging/vt6656/card.c @@ -674,9 +674,7 @@ void vnt_reset_next_tbtt(struct vnt_private *priv, u16 beacon_interval) data[7] = (u8)(next_tbtt 56); vnt_control_out(priv, MESSAGE_TYPE_SET_TSFTBTT, - MESSAGE_REQUEST_TBTT, 0, 8, data); - - return; + MESSAGE_REQUEST_TBTT, 0, 8, data); } /* @@ -714,8 +712,6 @@ void vnt_update_next_tbtt(struct vnt_private *priv, u64 tsf, MESSAGE_REQUEST_TBTT, 0, 8, data); dev_dbg(priv-usb-dev, %s TBTT: %8llx\n, __func__, tsf); - - return; } /* diff --git a/drivers/staging/vt6656/main_usb.c b/drivers/staging/vt6656/main_usb.c index 8e05f04..553a8e9 100644 --- a/drivers/staging/vt6656/main_usb.c +++ b/drivers/staging/vt6656/main_usb.c @@ -493,8 +493,6 @@ static void device_free_tx_bufs(struct vnt_private *priv) kfree(tx_context); } - - return; } static void device_free_rx_bufs(struct vnt_private *priv) @@ -519,8 +517,6 @@ static void device_free_rx_bufs(struct vnt_private *priv) kfree(rcb); } - - return; } static void usb_device_reset(struct vnt_private *pDevice) @@ -530,14 +526,11 @@ static void usb_device_reset(struct vnt_private *pDevice) status = usb_reset_device(pDevice-usb); if (status) printk(usb_device_reset fail status=%d\n,status); - return ; } static void device_free_int_bufs(struct vnt_private *priv) { kfree(priv-int_buf.data_buf); - - return; } static bool device_alloc_bufs(struct vnt_private *priv) @@ -718,8 +711,6 @@ static void vnt_stop(struct ieee80211_hw *hw) usb_kill_urb(priv-pInterruptURB); usb_free_urb(priv-pInterruptURB); - - return; } static int vnt_add_interface(struct ieee80211_hw *hw, struct ieee80211_vif *vif) @@ -785,8 +776,6 @@ static void vnt_remove_interface(struct ieee80211_hw *hw, /* LED slow blink */ vnt_mac_set_led(priv, LEDSTS_STS, LEDSTS_SLOW); - - return; } static int vnt_config(struct ieee80211_hw *hw, u32 changed) @@ -966,8 +955,6 @@ static void vnt_configure(struct ieee80211_hw *hw, vnt_control_out_u8(priv, MESSAGE_REQUEST_MACREG, MAC_REG_RCR, rx_mode); dev_dbg(priv-usb-dev, rx mode out= %x\n, rx_mode); - - return; } static int vnt_set_key(struct ieee80211_hw *hw, enum set_key_cmd cmd, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/28] staging: comedi: ni_mio_common: remove ai_continuous from private data
This member of the private data can be determined by checking the cmd-stop_src. Do that instead and remove the member. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 8 ++-- drivers/staging/comedi/drivers/ni_stc.h| 1 - 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 9bcf835..1718382 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1499,8 +1499,8 @@ static void ack_a_interrupt(struct comedi_device *dev, unsigned short a_status) static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, unsigned ai_mite_status) { - struct ni_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; + struct comedi_cmd *cmd = s-async-cmd; /* 67xx boards don't have ai subdevice, but their gpct0 might generate an a interrupt */ if (s-type == COMEDI_SUBD_UNUSED) @@ -1551,7 +1551,7 @@ static void handle_a_interrupt(struct comedi_device *dev, unsigned short status, return; } if (status AI_SC_TC_St) { - if (!devpriv-ai_continuous) + if (cmd-stop_src == TRIG_COUNT) shutdown_ai_command(dev); } } @@ -2513,7 +2513,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* load SC (Scan Count) */ ni_stc_writew(dev, AI_SC_Load, AI_Command_1_Register); - devpriv-ai_continuous = 0; if (stop_count == 0) { devpriv-ai_cmd2 |= AI_End_On_End_Of_Scan; interrupt_a_enable |= AI_STOP_Interrupt_Enable; @@ -2532,9 +2531,6 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) /* load SC (Scan Count) */ ni_stc_writew(dev, AI_SC_Load, AI_Command_1_Register); - - devpriv-ai_continuous = 1; - break; } diff --git a/drivers/staging/comedi/drivers/ni_stc.h b/drivers/staging/comedi/drivers/ni_stc.h index 2b937d3..6f9c481 100644 --- a/drivers/staging/comedi/drivers/ni_stc.h +++ b/drivers/staging/comedi/drivers/ni_stc.h @@ -1422,7 +1422,6 @@ struct ni_private { unsigned short dio_output; unsigned short dio_control; int aimode; - int ai_continuous; unsigned int ai_calib_source; unsigned int ai_calib_source_enabled; spinlock_t window_lock; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 21/28] staging: comedi: ni_mio_common: tidy up the Digital I/O subdevice init
For aesthetics, add some whitespace to the Digital I/O subdevice init. Only hook up the async command support if we have an irq. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 43 ++ 1 file changed, 24 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 7146f21..dc5f927 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5574,32 +5574,37 @@ static int ni_E_init(struct comedi_device *dev, s-type = COMEDI_SUBD_UNUSED; } - /* digital i/o subdevice */ - + /* Digital I/O subdevice */ s = dev-subdevices[NI_DIO_SUBDEV]; - s-type = COMEDI_SUBD_DIO; - s-subdev_flags = SDF_WRITABLE | SDF_READABLE; - s-maxdata = 1; - s-io_bits = 0; /* all bits input */ - s-range_table = range_digital; - s-n_chan = board-has_32dio_chan ? 32 : 8; + s-type = COMEDI_SUBD_DIO; + s-subdev_flags = SDF_WRITABLE | SDF_READABLE; + s-n_chan = board-has_32dio_chan ? 32 : 8; + s-maxdata = 1; + s-range_table = range_digital; if (devpriv-is_m_series) { - s-subdev_flags |= - SDF_LSAMPL | SDF_CMD_WRITE /* | SDF_CMD_READ */; - s-insn_bits = ni_m_series_dio_insn_bits; - s-insn_config = ni_m_series_dio_insn_config; - s-do_cmd = ni_cdio_cmd; - s-do_cmdtest = ni_cdio_cmdtest; - s-cancel = ni_cdio_cancel; - s-async_dma_dir = DMA_BIDIRECTIONAL; - s-len_chanlist = s-n_chan; + s-subdev_flags |= SDF_LSAMPL; + s-insn_bits= ni_m_series_dio_insn_bits; + s-insn_config = ni_m_series_dio_insn_config; + if (dev-irq) { + s-subdev_flags |= SDF_CMD_WRITE /* | SDF_CMD_READ */; + s-len_chanlist = s-n_chan; + s-do_cmdtest = ni_cdio_cmdtest; + s-do_cmd = ni_cdio_cmd; + s-cancel = ni_cdio_cancel; + + /* M-series boards use DMA */ + s-async_dma_dir = DMA_BIDIRECTIONAL; + } + /* reset DIO and set all channels to inputs */ ni_writel(dev, CDO_Reset_Bit | CDI_Reset_Bit, M_Offset_CDIO_Command); ni_writel(dev, s-io_bits, M_Offset_DIO_Direction); } else { - s-insn_bits = ni_dio_insn_bits; - s-insn_config = ni_dio_insn_config; + s-insn_bits= ni_dio_insn_bits; + s-insn_config = ni_dio_insn_config; + + /* set all channels to inputs */ devpriv-dio_control = DIO_Pins_Dir(s-io_bits); ni_writew(dev, devpriv-dio_control, DIO_Control_Register); } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/28] staging: comedi: ni_mio_common: fix ni_ao_insn_read()
The comedi core expects (*insn_read) functions to return insn-n data smaples. Fix this function to work like the core expects. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 10 +++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 1718382..f4125c0 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2939,14 +2939,18 @@ static int ni_ao_config_chanlist(struct comedi_device *dev, } static int ni_ao_insn_read(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_insn *insn, + struct comedi_subdevice *s, + struct comedi_insn *insn, unsigned int *data) { struct ni_private *devpriv = dev-private; + unsigned int chan = CR_CHAN(insn-chanspec); + int i; - data[0] = devpriv-ao[CR_CHAN(insn-chanspec)]; + for (i = 0; i insn-n; i++) + data[i] = devpriv-ao[chan]; - return 1; + return insn-n; } static int ni_ao_insn_write(struct comedi_device *dev, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/28] staging: comedi: ni_mio_common: fix ni_ao_insn_write_671x()
Comedi (*insn_write) functions are expected to write insn-n values to the hardware. Fix this function to work like the core expects. Also, use the comedi_offset_munge() helper to convert the comedi unsigned values into the two's complement values that the hardware needs. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 24 +--- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 471d7af..b52dd2f 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3101,22 +3101,32 @@ static int ni_ao_insn_write(struct comedi_device *dev, static int ni_ao_insn_write_671x(struct comedi_device *dev, struct comedi_subdevice *s, -struct comedi_insn *insn, unsigned int *data) +struct comedi_insn *insn, +unsigned int *data) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; unsigned int chan = CR_CHAN(insn-chanspec); - unsigned int invert; + int i; ao_win_out(1 chan, AO_Immediate_671x); - invert = 1 (board-aobits - 1); ni_ao_config_chanlist(dev, s, insn-chanspec, 1, 0); - devpriv-ao[chan] = data[0]; - ao_win_out(data[0] ^ invert, DACx_Direct_Data_671x(chan)); + for (i = 0; i insn-n; i++) { + unsigned int val = data[i]; - return 1; + devpriv-ao[chan] = val; + + /* +* 671x boards have +/-10V outputs +* munge the unsigned comedi values to 2's complement +*/ + val = comedi_offset_munge(s, val); + + ao_win_out(val, DACx_Direct_Data_671x(chan)); + } + + return insn-n; } static int ni_ao_insn_config(struct comedi_device *dev, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/28] staging: comedi: ni_mio_common: fix ni_ao_insn_write()
Comedi (*insn_write) functions are expected to write insn-n values to the hardware. Fix this function to work like the core expects. Also, don't rely on the return value of ni_ao_comfig_chanlist() to determine if the values need converted to two's complement before writing to the hardware. Use the comedi_range_is_bipolar() and comedi_offset_munge() helpers to clarify the code. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 40 +++--- 1 file changed, 30 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index d937eb8..c08b9b6 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -3079,23 +3079,43 @@ static int ni_ao_insn_read(struct comedi_device *dev, static int ni_ao_insn_write(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { struct ni_private *devpriv = dev-private; unsigned int chan = CR_CHAN(insn-chanspec); - unsigned int invert; + unsigned int range = CR_RANGE(insn-chanspec); + int reg; + int i; - invert = ni_ao_config_chanlist(dev, s, insn-chanspec, 1, 0); + if (devpriv-is_m_series) + reg = M_Offset_DAC_Direct_Data(chan); + else + reg = (chan) ? DAC1_Direct_Data : DAC0_Direct_Data; - devpriv-ao[chan] = data[0]; + ni_ao_config_chanlist(dev, s, insn-chanspec, 1, 0); - if (devpriv-is_m_series) { - ni_writew(dev, data[0], M_Offset_DAC_Direct_Data(chan)); - } else - ni_writew(dev, data[0] ^ invert, - (chan) ? DAC1_Direct_Data : DAC0_Direct_Data); + for (i = 0; i insn-n; i++) { + unsigned int val = data[i]; - return 1; + devpriv-ao[chan] = val; + + if (devpriv-is_m_series) { + /* M-series board always use offset binary values */ + ni_writew(dev, val, reg); + } else { + /* +* Non-M series boards need two's complement values +* for bipolar ranges. +*/ + if (comedi_range_is_bipolar(s, range)) + val = comedi_offset_munge(s, val); + + ni_writew(dev, val, reg); + } + } + + return insn-n; } static int ni_ao_insn_write_671x(struct comedi_device *dev, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/28] staging: comedi: comedidev.h: introduce some 'range_is_external' helpers
The comedi_krange includes a flags member that currently identifies the 'units' of the range (RF_UNIT) and if the range is from an internal or external source (RF_EXTERNAL). Introduce some helper functions to check if a given range is from an external source. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/comedidev.h | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/staging/comedi/comedidev.h b/drivers/staging/comedi/comedidev.h index 83fd155..6af6467 100644 --- a/drivers/staging/comedi/comedidev.h +++ b/drivers/staging/comedi/comedidev.h @@ -363,6 +363,12 @@ static inline bool comedi_range_is_unipolar(struct comedi_subdevice *s, return s-range_table-range[range].min = 0; } +static inline bool comedi_range_is_external(struct comedi_subdevice *s, + unsigned int range) +{ + return !!(s-range_table-range[range].flags RF_EXTERNAL); +} + static inline bool comedi_chan_range_is_bipolar(struct comedi_subdevice *s, unsigned int chan, unsigned int range) @@ -377,6 +383,13 @@ static inline bool comedi_chan_range_is_unipolar(struct comedi_subdevice *s, return s-range_table_list[chan]-range[range].min = 0; } +static inline bool comedi_chan_range_is_external(struct comedi_subdevice *s, +unsigned int chan, +unsigned int range) +{ + return !!(s-range_table_list[chan]-range[range].flags RF_EXTERNAL); +} + /* munge between offset binary and two's complement values */ static inline unsigned int comedi_offset_munge(struct comedi_subdevice *s, unsigned int val) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/28] staging: comedi: ni_mio_common: init clock dividers early in ni_E_init()
The init/reset of the hardware is a bit scattered in this function. For aesthetics, move the init of the clock dividers so it happens early and tidy up the code a bit. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 27 -- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index dc5f927..6d1754f 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5499,6 +5499,18 @@ static int ni_E_init(struct comedi_device *dev, return -EINVAL; } + /* initialize clock dividers */ + devpriv-clock_and_fout = Slow_Internal_Time_Divide_By_2 | + Slow_Internal_Timebase | + Clock_To_Board_Divide_By_2 | + Clock_To_Board; + if (!devpriv-is_6xxx) { + /* BEAM is this needed for PCI-6143 ?? */ + devpriv-clock_and_fout |= (AI_Output_Divide_By_2 | + AO_Output_Divide_By_2); + } + ni_stc_writew(dev, devpriv-clock_and_fout, Clock_and_FOUT_Register); + ret = comedi_alloc_subdevices(dev, NI_NUM_SUBDEVICES); if (ret) return ret; @@ -5770,21 +5782,6 @@ static int ni_E_init(struct comedi_device *dev, /* ai configuration */ s = dev-subdevices[NI_AI_SUBDEV]; ni_ai_reset(dev, s); - if (!devpriv-is_6xxx) { - /* BEAM is this needed for PCI-6143 ?? */ - devpriv-clock_and_fout = - Slow_Internal_Time_Divide_By_2 | - Slow_Internal_Timebase | - Clock_To_Board_Divide_By_2 | - Clock_To_Board | - AI_Output_Divide_By_2 | AO_Output_Divide_By_2; - } else { - devpriv-clock_and_fout = - Slow_Internal_Time_Divide_By_2 | - Slow_Internal_Timebase | - Clock_To_Board_Divide_By_2 | Clock_To_Board; - } - ni_stc_writew(dev, devpriv-clock_and_fout, Clock_and_FOUT_Register); /* analog output configuration */ s = dev-subdevices[NI_AO_SUBDEV]; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 25/28] staging: comedi: ni_mio_common: tidy up the EEPROM subdevice init
For aesthetics, add some whitespace to the subdevice init. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 49c22d6..8f7edcd 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5665,17 +5665,17 @@ static int ni_E_init(struct comedi_device *dev, caldac_setup(dev, s); } - /* EEPROM */ + /* EEPROM subdevice */ s = dev-subdevices[NI_EEPROM_SUBDEV]; - s-type = COMEDI_SUBD_MEMORY; - s-subdev_flags = SDF_READABLE | SDF_INTERNAL; - s-maxdata = 0xff; + s-type = COMEDI_SUBD_MEMORY; + s-subdev_flags = SDF_READABLE | SDF_INTERNAL; + s-maxdata = 0xff; if (devpriv-is_m_series) { - s-n_chan = M_SERIES_EEPROM_SIZE; - s-insn_read = ni_m_series_eeprom_insn_read; + s-n_chan = M_SERIES_EEPROM_SIZE; + s-insn_read= ni_m_series_eeprom_insn_read; } else { - s-n_chan = 512; - s-insn_read = ni_eeprom_insn_read; + s-n_chan = 512; + s-insn_read= ni_eeprom_insn_read; } /* PFI */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/28] staging: comedi: ni_mio_common: tidy up ni_ao_munge()
Use the bytes_per_sample() helper instead of 'sizeof(short)' to clarify the length calculation. Use comedi_offset_munge() to handle the unsigned to two's complement munge of the data for bipolar ranges. Tidy up the local variables. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 22 -- 1 file changed, 12 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index b5b4a7b7..13270b3 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2886,28 +2886,30 @@ static int ni_ai_insn_config(struct comedi_device *dev, return -EINVAL; } -/* munge data from unsigned to 2's complement for analog output bipolar modes */ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, void *data, unsigned int num_bytes, unsigned int chan_index) { - const struct ni_board_struct *board = comedi_board(dev); - struct comedi_async *async = s-async; - struct comedi_cmd *cmd = async-cmd; - unsigned int length = num_bytes / sizeof(short); - unsigned int offset = 1 (board-aobits - 1); + struct comedi_cmd *cmd = s-async-cmd; + unsigned int length = num_bytes / bytes_per_sample(s); unsigned short *array = data; - unsigned int range; unsigned int i; for (i = 0; i length; i++) { - range = CR_RANGE(cmd-chanlist[chan_index]); + unsigned int range = CR_RANGE(cmd-chanlist[chan_index]); + unsigned short val = array[i]; + /* +* Munge data from unsigned to two's complement for +* bipolar ranges. +*/ if (comedi_range_is_bipolar(s, range)) - array[i] -= offset; + val = comedi_offset_munge(s, val); #ifdef PCIDMA - array[i] = cpu_to_le16(array[i]); + val = cpu_to_le16(val); #endif + array[i] = val; + chan_index++; chan_index %= cmd-chanlist_len; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/28] staging: comedi: ni_mio_common: more cleanup
The ni_mio_common.c file is included by a number of National Instruments drivers to provide the common driver support. This series does some more cleanup to get the file closer to being changed into a module instead of including it in the drivers. H Hartley Sweeten (28): staging: comedi: mite.h: tidy up the mite channel register offsets staging: comedi: comedidev.h: introduce some 'range_is_external' helpers staging: comedi: ni_stc.h: remove 'ao_unipolar' flag from ni_board_struct staging: comedi: ni_mio_common: fix ni_ao_insn_write_671x() staging: comedi: ni_mio_common: remove ao_win_out() macro staging: comedi: ni_mio_common: fix ni_ao_insn_write() staging: comedi: ni_stc.h: add some 'is_{board type}' flags to private data staging: comedi: ni_mio_common: tidy up ni_ao_munge() staging: comedi: ni_mio_common: remove INSN_CONFIG_ANALOG_TRIG support code staging: comedi: ni_mio_common: remove some unnecessary boardinfo access staging: comedi: ni_mio_common: merge analog output (*insn_write) functions staging: comedi: ni_mio_common: remove ai_continuous from private data staging: comedi: ni_mio_common: fix ni_ao_insn_read() staging: comedi: ni_mio_common: remove unnecessary use of 'board-adbits' staging: comedi: ni_stc.h: refactor 'adbits' boardinfo staging: comedi: ni_stc.h: refactor 'aobits' boardinfo staging: comedi: ni_mio_common: (*cancel) only works with async cmd support staging: comedi: ni_mio_common: tidy up the Analog Input subdevice init staging: comedi: ni_mio_common: tidy up the Analog Output subdevice init staging: comedi: ni_mio_common: refactor 'num_p0_dio_channels' boardinfo staging: comedi: ni_mio_common: tidy up the Digital I/O subdevice init staging: comedi: ni_mio_common: init clock dividers early in ni_E_init() staging: comedi: ni_mio_common: only reset the ai/ao subdevices if they exist staging: comedi: ni_mio_common: tidy up the calibration subdevice init staging: comedi: ni_mio_common: tidy up the EEPROM subdevice init staging: comedi: ni_mio_common: tidy up the PFI subdevice init staging: comedi: ni_mio_common: tidy up the gpct counter subdevice init staging: comedi: ni_mio_common: tidy up the frequency output subdevice init drivers/staging/comedi/comedidev.h | 13 + drivers/staging/comedi/drivers/mite.h | 106 +--- drivers/staging/comedi/drivers/ni_atmio.c | 44 +- drivers/staging/comedi/drivers/ni_mio_common.c | 753 +++-- drivers/staging/comedi/drivers/ni_mio_cs.c | 24 +- drivers/staging/comedi/drivers/ni_pcimio.c | 289 -- drivers/staging/comedi/drivers/ni_stc.h| 24 +- 7 files changed, 508 insertions(+), 745 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/28] staging: comedi: ni_mio_common: tidy up the frequency output subdevice init
For aesthetics, add some whitespace to the subdevice init. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6545f11..01b29d5 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5777,15 +5777,15 @@ static int ni_E_init(struct comedi_device *dev, s-private = gpct; } - /* Frequency output */ + /* Frequency output subdevice */ s = dev-subdevices[NI_FREQ_OUT_SUBDEV]; - s-type = COMEDI_SUBD_COUNTER; - s-subdev_flags = SDF_READABLE | SDF_WRITABLE; - s-n_chan = 1; - s-maxdata = 0xf; - s-insn_read = ni_freq_out_insn_read; - s-insn_write = ni_freq_out_insn_write; - s-insn_config = ni_freq_out_insn_config; + s-type = COMEDI_SUBD_COUNTER; + s-subdev_flags = SDF_READABLE | SDF_WRITABLE; + s-n_chan = 1; + s-maxdata = 0xf; + s-insn_read= ni_freq_out_insn_read; + s-insn_write = ni_freq_out_insn_write; + s-insn_config = ni_freq_out_insn_config; if (dev-irq) { ni_stc_writew(dev, -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/28] staging: comedi: ni_stc.h: remove 'ao_unipolar' flag from ni_board_struct
This member of the boardinfo for the NI MIO drivers is used to indicate if the ranges for the analog output subdevice (ao_range_table in the boardinfo) includes any unipolar ranges. If it's not set, the ao_range_table only has bipolar ranges. The 'ao_unipolar' flag is checked when munging the ao data values from the user so that the values for bipolar ranges are converted to 2's complement values before they are written to the hardware. The flag is also used when programming the analog output configuration on non-M series boards for bipolar/unipolar and external reference operation. Simplify the driver a bit by removing this boardinfo flag and just using the comedi_range_is_bipolar() and comedi_range_is_external() helpers to check the range directly. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gre...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_atmio.c | 6 -- drivers/staging/comedi/drivers/ni_mio_common.c | 18 +++--- drivers/staging/comedi/drivers/ni_pcimio.c | 16 drivers/staging/comedi/drivers/ni_stc.h| 1 - 4 files changed, 7 insertions(+), 34 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index d7ee6bd..0f4dc5a 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -116,7 +116,6 @@ static const struct ni_board_struct ni_boards[] = { .aobits = 12, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1000, .num_p0_dio_channels = 8, .caldac = { mb88341 }, @@ -133,7 +132,6 @@ static const struct ni_board_struct ni_boards[] = { .aobits = 12, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1000, .num_p0_dio_channels = 8, .caldac = { mb88341 }, @@ -149,7 +147,6 @@ static const struct ni_board_struct ni_boards[] = { .n_aochan = 2, .aobits = 12, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1, .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, @@ -165,7 +162,6 @@ static const struct ni_board_struct ni_boards[] = { .n_aochan = 2, .aobits = 12, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1, .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, @@ -183,7 +179,6 @@ static const struct ni_board_struct ni_boards[] = { .aobits = 12, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1000, .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, @@ -217,7 +212,6 @@ static const struct ni_board_struct ni_boards[] = { .aobits = 16, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, - .ao_unipolar= 1, .ao_speed = 1000, .num_p0_dio_channels = 8, .caldac = { dac8800, dac8043, ad8522 }, diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index ff881a7..471d7af 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2925,7 +2925,8 @@ static void ni_ao_munge(struct comedi_device *dev, struct comedi_subdevice *s, for (i = 0; i length; i++) { range = CR_RANGE(cmd-chanlist[chan_index]); - if (board-ao_unipolar == 0 || (range 1) == 0) + + if (comedi_range_is_bipolar(s, range)) array[i] -= offset; #ifdef PCIDMA array[i] = cpu_to_le16(array[i]); @@ -3028,19 +3029,14 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev, range = CR_RANGE(chanspec[i]); conf = AO_Channel(chan); - if (board-ao_unipolar) { - if ((range 1) == 0) { - conf |= AO_Bipolar; - invert = (1 (board-aobits - 1)); - } else { - invert = 0; - } - if (range 2) - conf |= AO_Ext_Ref; - } else { + if
[PATCH 18/28] staging: comedi: ni_mio_common: tidy up the Analog Input subdevice init
For aesthetics, add some whitespace to the Analog Input subdevice init. The callers of ni_E_init() do the request_irq() and set dev-irq if the interrupt is available. Only hook up the async command support if we have the irq. Also, remove the '#ifdef PCIDMA' here. The ni_pcimio driver is the only place PCIDMA is defined. That driver is also the only user of ni_mio_common that allocates devpriv-mite. Use that test instead to determine if the subdevice async_dma_dir member needs to be initialized. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 49 +- 1 file changed, 25 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 2ab267b..800f4e3 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5503,36 +5503,37 @@ static int ni_E_init(struct comedi_device *dev, if (ret) return ret; - /* analog input subdevice */ - + /* Analog Input subdevice */ s = dev-subdevices[NI_AI_SUBDEV]; - dev-read_subdev = s; if (board-n_adchan) { - s-type = COMEDI_SUBD_AI; - s-subdev_flags = - SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ; + s-type = COMEDI_SUBD_AI; + s-subdev_flags = SDF_READABLE | SDF_DIFF | SDF_DITHER; if (!devpriv-is_611x) - s-subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; + s-subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; if (board-ai_maxdata 0x) - s-subdev_flags |= SDF_LSAMPL; + s-subdev_flags |= SDF_LSAMPL; if (devpriv-is_m_series) - s-subdev_flags |= SDF_SOFT_CALIBRATED; - s-n_chan = board-n_adchan; - s-len_chanlist = 512; - s-maxdata = board-ai_maxdata; - s-range_table = ni_range_lkup[board-gainlkup]; - s-insn_read = ni_ai_insn_read; - s-insn_config = ni_ai_insn_config; - s-do_cmdtest = ni_ai_cmdtest; - s-do_cmd = ni_ai_cmd; - s-cancel = ni_ai_reset; - s-poll = ni_ai_poll; - s-munge = ni_ai_munge; -#ifdef PCIDMA - s-async_dma_dir = DMA_FROM_DEVICE; -#endif + s-subdev_flags |= SDF_SOFT_CALIBRATED; + s-n_chan = board-n_adchan; + s-maxdata = board-ai_maxdata; + s-range_table = ni_range_lkup[board-gainlkup]; + s-insn_read= ni_ai_insn_read; + s-insn_config = ni_ai_insn_config; + if (dev-irq) { + dev-read_subdev = s; + s-subdev_flags |= SDF_CMD_READ; + s-len_chanlist = 512; + s-do_cmdtest = ni_ai_cmdtest; + s-do_cmd = ni_ai_cmd; + s-cancel = ni_ai_reset; + s-poll = ni_ai_poll; + s-munge= ni_ai_munge; + + if (devpriv-mite) + s-async_dma_dir = DMA_FROM_DEVICE; + } } else { - s-type = COMEDI_SUBD_UNUSED; + s-type = COMEDI_SUBD_UNUSED; } /* analog output subdevice */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 20/28] staging: comedi: ni_mio_common: refactor 'num_p0_dio_channels' boardinfo
All of the board supported by this driver have at least 8 Digital I/O channels. A couple of the PCI boards in ni_pcimio have 32 channels. For aesthetics, change this member of the boardinfo into a bit-field flag, 'has_32dio_chan', and use that when initializing the DIO subdevice to set the number of channels to 32 or 8. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_atmio.c | 8 --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- drivers/staging/comedi/drivers/ni_mio_cs.c | 6 --- drivers/staging/comedi/drivers/ni_pcimio.c | 67 -- drivers/staging/comedi/drivers/ni_stc.h| 3 +- 5 files changed, 12 insertions(+), 74 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 3858061..c613423 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -117,7 +117,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, - .num_p0_dio_channels = 8, .caldac = { mb88341 }, }, { .name = at-mio-16e-2, @@ -133,7 +132,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, - .num_p0_dio_channels = 8, .caldac = { mb88341 }, }, { .name = at-mio-16e-10, @@ -148,7 +146,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_maxdata = 0x0fff, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1, - .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, }, { .name = at-mio-16de-10, @@ -163,7 +160,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_maxdata = 0x0fff, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1, - .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, .has_8255 = 1, }, { @@ -180,7 +176,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, - .num_p0_dio_channels = 8, .caldac = { ad8804_debug }, }, { .name = at-mio-16xe-50, @@ -196,7 +191,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_maxdata = 0x0fff, .ao_range_table = range_bipolar10, .ao_speed = 5, - .num_p0_dio_channels = 8, .caldac = { dac8800, dac8043 }, }, { .name = at-mio-16xe-10, @@ -213,7 +207,6 @@ static const struct ni_board_struct ni_boards[] = { .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, - .num_p0_dio_channels = 8, .caldac = { dac8800, dac8043, ad8522 }, }, { .name = at-ai-16xe-10, @@ -225,7 +218,6 @@ static const struct ni_board_struct ni_boards[] = { .alwaysdither = 1,/* unknown */ .gainlkup = ai_gain_14, .ai_speed = 1, - .num_p0_dio_channels = 8, .caldac = { dac8800, dac8043, ad8522 }, }, }; diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 91b3fb4..7146f21 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5582,7 +5582,7 @@ static int ni_E_init(struct comedi_device *dev, s-maxdata = 1; s-io_bits = 0; /* all bits input */ s-range_table = range_digital; - s-n_chan = board-num_p0_dio_channels; + s-n_chan = board-has_32dio_chan ? 32 : 8; if (devpriv-is_m_series) { s-subdev_flags |= SDF_LSAMPL | SDF_CMD_WRITE /* | SDF_CMD_READ */; diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index bb414ec..9b201e4 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -60,7 +60,6 @@ static const struct ni_board_struct ni_boards[] = { .ai_fifo_depth = 1024, .gainlkup = ai_gain_8, .ai_speed
[PATCH 19/28] staging: comedi: ni_mio_common: tidy up the Analog Output subdevice init
For aesthetics, add some whitespace to the Analog Output subdevice init. Also, remove the '#ifdef PCIDMA' here and only hook up the async command support if we have an irq and the board either has a fifo or DMA is supported. The ni_pcimio driver is the only place PCIDMA is defined. That driver is also the only user of ni_mio_common that allocates devpriv-mite. Use that test instead to determine if dma is supported. Move 'is_67xx' check and init_ao_67xx() call into the Analog Output subdevice init. The 67xx boards all have analog outputs and this check does not need to be done for the boards that do not have analog outputs. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 55 ++ 1 file changed, 29 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 800f4e3..91b3fb4 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5536,40 +5536,43 @@ static int ni_E_init(struct comedi_device *dev, s-type = COMEDI_SUBD_UNUSED; } - /* analog output subdevice */ - + /* Analog Output subdevice */ s = dev-subdevices[NI_AO_SUBDEV]; if (board-n_aochan) { - s-type = COMEDI_SUBD_AO; - s-subdev_flags = SDF_WRITABLE | SDF_DEGLITCH | SDF_GROUND; + s-type = COMEDI_SUBD_AO; + s-subdev_flags = SDF_WRITABLE | SDF_DEGLITCH | SDF_GROUND; if (devpriv-is_m_series) - s-subdev_flags |= SDF_SOFT_CALIBRATED; - s-n_chan = board-n_aochan; - s-maxdata = board-ao_maxdata; - s-range_table = board-ao_range_table; - s-insn_read = ni_ao_insn_read; - s-insn_write = ni_ao_insn_write; - s-insn_config = ni_ao_insn_config; -#ifdef PCIDMA - if (board-n_aochan) { - s-async_dma_dir = DMA_TO_DEVICE; -#else - if (board-ao_fifo_depth) { -#endif + s-subdev_flags |= SDF_SOFT_CALIBRATED; + s-n_chan = board-n_aochan; + s-maxdata = board-ao_maxdata; + s-range_table = board-ao_range_table; + s-insn_read= ni_ao_insn_read; + s-insn_write = ni_ao_insn_write; + s-insn_config = ni_ao_insn_config; + + /* +* Along with the IRQ we need either a FIFO or DMA for +* async command support. +*/ + if (dev-irq (board-ao_fifo_depth || devpriv-mite)) { dev-write_subdev = s; - s-subdev_flags |= SDF_CMD_WRITE; - s-do_cmd = ni_ao_cmd; - s-do_cmdtest = ni_ao_cmdtest; - s-cancel = ni_ao_reset; - s-len_chanlist = board-n_aochan; + s-subdev_flags |= SDF_CMD_WRITE; + s-len_chanlist = s-n_chan; + s-do_cmdtest = ni_ao_cmdtest; + s-do_cmd = ni_ao_cmd; + s-cancel = ni_ao_reset; if (!devpriv-is_m_series) - s-munge = ni_ao_munge; + s-munge= ni_ao_munge; + + if (devpriv-mite) + s-async_dma_dir = DMA_TO_DEVICE; } + + if (devpriv-is_67xx) + init_ao_67xx(dev, s); } else { - s-type = COMEDI_SUBD_UNUSED; + s-type = COMEDI_SUBD_UNUSED; } - if (devpriv-is_67xx) - init_ao_67xx(dev, s); /* digital i/o subdevice */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/28] staging: comedi: ni_mio_common: tidy up the PFI subdevice init
For aesthetics, add some whitespace to the subdevice init and tidy it up a bit. Remove the need for the extra local variable. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 8f7edcd..4932b4db 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5490,9 +5490,9 @@ static int ni_E_init(struct comedi_device *dev, const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; struct comedi_subdevice *s; - unsigned j; enum ni_gpct_variant counter_variant; int ret; + int i; if (board-n_aochan MAX_N_AO_CHAN) { printk(bug! n_aochan MAX_N_AO_CHAN\n); @@ -5678,25 +5678,25 @@ static int ni_E_init(struct comedi_device *dev, s-insn_read= ni_eeprom_insn_read; } - /* PFI */ + /* Digital I/O (PFI) subdevice */ s = dev-subdevices[NI_PFI_DIO_SUBDEV]; - s-type = COMEDI_SUBD_DIO; - s-subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s-type = COMEDI_SUBD_DIO; + s-subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_INTERNAL; + s-maxdata = 1; if (devpriv-is_m_series) { - unsigned i; - s-n_chan = 16; + s-n_chan = 16; + s-insn_bits= ni_pfi_insn_bits; + ni_writew(dev, s-state, M_Offset_PFI_DO); for (i = 0; i NUM_PFI_OUTPUT_SELECT_REGS; ++i) { ni_writew(dev, devpriv-pfi_output_select_reg[i], M_Offset_PFI_Output_Select(i + 1)); } } else { - s-n_chan = 10; + s-n_chan = 10; } - s-maxdata = 1; - if (devpriv-is_m_series) - s-insn_bits = ni_pfi_insn_bits; - s-insn_config = ni_pfi_insn_config; + s-insn_config = ni_pfi_insn_config; + ni_set_bits(dev, IO_Bidirection_Pin_Register, ~0, 0); /* cs5529 calibration adc */ @@ -5748,8 +5748,8 @@ static int ni_E_init(struct comedi_device *dev, return -ENOMEM; /* General purpose counters */ - for (j = 0; j NUM_GPCT; ++j) { - s = dev-subdevices[NI_GPCT_SUBDEV(j)]; + for (i = 0; i NUM_GPCT; ++i) { + s = dev-subdevices[NI_GPCT_SUBDEV(i)]; s-type = COMEDI_SUBD_COUNTER; s-subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; s-n_chan = 3; @@ -5768,11 +5768,11 @@ static int ni_E_init(struct comedi_device *dev, s-cancel = ni_gpct_cancel; s-async_dma_dir = DMA_BIDIRECTIONAL; #endif - s-private = devpriv-counter_dev-counters[j]; + s-private = devpriv-counter_dev-counters[i]; - devpriv-counter_dev-counters[j].chip_index = 0; - devpriv-counter_dev-counters[j].counter_index = j; - ni_tio_init_counter(devpriv-counter_dev-counters[j]); + devpriv-counter_dev-counters[i].chip_index = 0; + devpriv-counter_dev-counters[i].counter_index = i; + ni_tio_init_counter(devpriv-counter_dev-counters[i]); } /* Frequency output */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 23/28] staging: comedi: ni_mio_common: only reset the ai/ao subdevices if they exist
So of the boards supported by this driver do not have analog inputs and some don't have analog outputs. Move the calls that reset these subdevices during the (*attach) by ni_E_init() so they only happen if the subdevices are present. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 14 ++ 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6d1754f..e60b9e6 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5544,6 +5544,9 @@ static int ni_E_init(struct comedi_device *dev, if (devpriv-mite) s-async_dma_dir = DMA_FROM_DEVICE; } + + /* reset the analog input configuration */ + ni_ai_reset(dev, s); } else { s-type = COMEDI_SUBD_UNUSED; } @@ -5582,6 +5585,9 @@ static int ni_E_init(struct comedi_device *dev, if (devpriv-is_67xx) init_ao_67xx(dev, s); + + /* reset the analog output configuration */ + ni_ao_reset(dev, s); } else { s-type = COMEDI_SUBD_UNUSED; } @@ -5779,14 +5785,6 @@ static int ni_E_init(struct comedi_device *dev, s-insn_write = ni_freq_out_insn_write; s-insn_config = ni_freq_out_insn_config; - /* ai configuration */ - s = dev-subdevices[NI_AI_SUBDEV]; - ni_ai_reset(dev, s); - - /* analog output configuration */ - s = dev-subdevices[NI_AO_SUBDEV]; - ni_ao_reset(dev, s); - if (dev-irq) { ni_stc_writew(dev, (irq_polarity ? Interrupt_Output_Polarity : 0) | -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/28] staging: comedi: ni_mio_common: tidy up the calibration subdevice init
For aesthetics, add some whitespace to the subdevice init. Refactor the code so that the common parts of the subdevice are initialized in one place. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 30 +- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index e60b9e6..49c22d6 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5642,26 +5642,26 @@ static int ni_E_init(struct comedi_device *dev, s = dev-subdevices[NI_UNUSED_SUBDEV]; s-type = COMEDI_SUBD_UNUSED; - /* calibration subdevice -- ai and ao */ + /* Calibration subdevice */ s = dev-subdevices[NI_CALIBRATION_SUBDEV]; - s-type = COMEDI_SUBD_CALIB; + s-type = COMEDI_SUBD_CALIB; + s-subdev_flags = SDF_INTERNAL; + s-n_chan = 1; + s-maxdata = 0; if (devpriv-is_m_series) { - /* internal PWM analog output used for AI nonlinearity calibration */ - s-subdev_flags = SDF_INTERNAL; - s-insn_config = ni_m_series_pwm_config; - s-n_chan = 1; - s-maxdata = 0; + /* internal PWM output used for AI nonlinearity calibration */ + s-insn_config = ni_m_series_pwm_config; + ni_writel(dev, 0x0, M_Offset_Cal_PWM); } else if (devpriv-is_6143) { - /* internal PWM analog output used for AI nonlinearity calibration */ - s-subdev_flags = SDF_INTERNAL; - s-insn_config = ni_6143_pwm_config; - s-n_chan = 1; - s-maxdata = 0; + /* internal PWM output used for AI nonlinearity calibration */ + s-insn_config = ni_6143_pwm_config; } else { - s-subdev_flags = SDF_WRITABLE | SDF_INTERNAL; - s-insn_read = ni_calib_insn_read; - s-insn_write = ni_calib_insn_write; + s-subdev_flags |= SDF_WRITABLE; + s-insn_read= ni_calib_insn_read; + s-insn_write = ni_calib_insn_write; + + /* setup the caldacs and find the real n_chan and maxdata */ caldac_setup(dev, s); } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/28] staging: comedi: ni_mio_common: merge analog output (*insn_write) functions
Currently the PCI6xxx boards use a different (*insn_write) function for the analog output subdevice. Most of the code is identical to the (*insn_write) used by all the other board types. For aesthetics, merge the two (*insn_write) functions and handle the 'is_6xxx' differences in the common code. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 59 +- 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 6e79bcf..9bcf835 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2964,10 +2964,15 @@ static int ni_ao_insn_write(struct comedi_device *dev, int reg; int i; - if (devpriv-is_m_series) + if (devpriv-is_6xxx) { + ni_ao_win_outw(dev, 1 chan, AO_Immediate_671x); + + reg = DACx_Direct_Data_671x(chan); + } else if (devpriv-is_m_series) { reg = M_Offset_DAC_Direct_Data(chan); - else + } else { reg = (chan) ? DAC1_Direct_Data : DAC0_Direct_Data; + } ni_ao_config_chanlist(dev, s, insn-chanspec, 1, 0); @@ -2976,8 +2981,19 @@ static int ni_ao_insn_write(struct comedi_device *dev, devpriv-ao[chan] = val; - if (devpriv-is_m_series) { - /* M-series board always use offset binary values */ + if (devpriv-is_6xxx) { + /* +* 6xxx boards have bipolar outputs, munge the +* unsigned comedi values to 2's complement +*/ + val = comedi_offset_munge(s, val); + + ni_ao_win_outw(dev, val, reg); + } else if (devpriv-is_m_series) { + /* +* M-series boards use offset binary values for +* bipolar and uinpolar outputs +*/ ni_writew(dev, val, reg); } else { /* @@ -2994,36 +3010,6 @@ static int ni_ao_insn_write(struct comedi_device *dev, return insn-n; } -static int ni_ao_insn_write_671x(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, -unsigned int *data) -{ - struct ni_private *devpriv = dev-private; - unsigned int chan = CR_CHAN(insn-chanspec); - int i; - - ni_ao_win_outw(dev, 1 chan, AO_Immediate_671x); - - ni_ao_config_chanlist(dev, s, insn-chanspec, 1, 0); - - for (i = 0; i insn-n; i++) { - unsigned int val = data[i]; - - devpriv-ao[chan] = val; - - /* -* 671x boards have +/-10V outputs -* munge the unsigned comedi values to 2's complement -*/ - val = comedi_offset_munge(s, val); - - ni_ao_win_outw(dev, val, DACx_Direct_Data_671x(chan)); - } - - return insn-n; -} - static int ni_ao_insn_config(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) @@ -5565,10 +5551,7 @@ static int ni_E_init(struct comedi_device *dev, s-maxdata = (1 board-aobits) - 1; s-range_table = board-ao_range_table; s-insn_read = ni_ao_insn_read; - if (devpriv-is_6xxx) - s-insn_write = ni_ao_insn_write_671x; - else - s-insn_write = ni_ao_insn_write; + s-insn_write = ni_ao_insn_write; s-insn_config = ni_ao_insn_config; #ifdef PCIDMA if (board-n_aochan) { -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/28] staging: comedi: ni_stc.h: add some 'is_{board type}' flags to private data
The board-reg_type if checked quite often in the ni_mio_common.c code to handle differences in the PCI devices supported by the ni_pcimio driver. Simplify the code a bit by adding some 'is_{board type}' bit-field flags to the private data. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 147 ++--- drivers/staging/comedi/drivers/ni_pcimio.c | 20 +++- drivers/staging/comedi/drivers/ni_stc.h| 10 ++ 3 files changed, 90 insertions(+), 87 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index c08b9b6..b5b4a7b7 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -958,11 +958,11 @@ static void ni_e_series_enable_second_irq(struct comedi_device *dev, static void ni_clear_ai_fifo(struct comedi_device *dev) { - const struct ni_board_struct *board = comedi_board(dev); + struct ni_private *devpriv = dev-private; static const int timeout = 1; int i; - if (board-reg_type == ni_reg_6143) { + if (devpriv-is_6143) { /* Flush the 6143 data FIFO */ ni_writel(dev, 0x10, AIFIFO_Control_6143); ni_writel(dev, 0x00, AIFIFO_Control_6143); @@ -977,7 +977,7 @@ static void ni_clear_ai_fifo(struct comedi_device *dev) } } else { ni_stc_writew(dev, 1, ADC_FIFO_Clear); - if (board-reg_type == ni_reg_625x) { + if (devpriv-is_625x) { ni_writeb(dev, 0, M_Offset_Static_AI_Control(0)); ni_writeb(dev, 1, M_Offset_Static_AI_Control(0)); #if 0 @@ -1140,7 +1140,7 @@ static int ni_ao_wait_for_dma_load(struct comedi_device *dev) static void ni_ao_fifo_load(struct comedi_device *dev, struct comedi_subdevice *s, int n) { - const struct ni_board_struct *board = comedi_board(dev); + struct ni_private *devpriv = dev-private; struct comedi_async *async = s-async; struct comedi_cmd *cmd = async-cmd; int chan; @@ -1158,10 +1158,10 @@ static void ni_ao_fifo_load(struct comedi_device *dev, range = CR_RANGE(cmd-chanlist[chan]); - if (board-reg_type ni_reg_6xxx_mask) { + if (devpriv-is_6xxx) { packed_data = d 0x; /* 6711 only has 16 bit wide ao fifo */ - if (board-reg_type != ni_reg_6711) { + if (!devpriv-is_6711) { err = comedi_buf_get(s, d); if (err == 0) break; @@ -1224,11 +1224,12 @@ static int ni_ao_prep_fifo(struct comedi_device *dev, struct comedi_subdevice *s) { const struct ni_board_struct *board = comedi_board(dev); + struct ni_private *devpriv = dev-private; int n; /* reset fifo */ ni_stc_writew(dev, 1, DAC_FIFO_Clear); - if (board-reg_type ni_reg_6xxx_mask) + if (devpriv-is_6xxx) ni_ao_win_outl(dev, 0x6, AO_FIFO_Offset_Load_611x); /* load some data */ @@ -1248,12 +1249,11 @@ static int ni_ao_prep_fifo(struct comedi_device *dev, static void ni_ai_fifo_read(struct comedi_device *dev, struct comedi_subdevice *s, int n) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; struct comedi_async *async = s-async; int i; - if (board-reg_type == ni_reg_611x) { + if (devpriv-is_611x) { unsigned short data[2]; u32 dl; @@ -1270,7 +1270,7 @@ static void ni_ai_fifo_read(struct comedi_device *dev, data[0] = dl 0x; cfc_write_to_buffer(s, data[0]); } - } else if (board-reg_type == ni_reg_6143) { + } else if (devpriv-is_6143) { unsigned short data[2]; u32 dl; @@ -1324,7 +1324,6 @@ static void ni_handle_fifo_half_full(struct comedi_device *dev) */ static void ni_handle_fifo_dregs(struct comedi_device *dev) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; struct comedi_subdevice *s = dev-read_subdev; unsigned short data[2]; @@ -1332,7 +1331,7 @@ static void ni_handle_fifo_dregs(struct comedi_device *dev) unsigned short fifo_empty; int i; - if (board-reg_type == ni_reg_611x) { + if (devpriv-is_611x) { while ((ni_stc_readw(dev, AI_Status_1_Register) AI_FIFO_Empty_St) == 0) {
[PATCH 27/28] staging: comedi: ni_mio_common: tidy up the gpct counter subdevice init
For aesthetics, add some whitespace to the subdevice init and tidy it up a bit. Unfortunately we can't get rid of the '#ifdef PCIDMA' here yet due to other ifdefery in this file. For now just add the correct test so that the async command support is not hooked up unless we have an IRQ and DMA. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 64 +- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 4932b4db..6545f11 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5490,7 +5490,6 @@ static int ni_E_init(struct comedi_device *dev, const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; struct comedi_subdevice *s; - enum ni_gpct_variant counter_variant; int ret; int i; @@ -5735,44 +5734,47 @@ static int ni_E_init(struct comedi_device *dev, s-insn_config = ni_rtsi_insn_config; ni_rtsi_init(dev); - if (devpriv-is_m_series) - counter_variant = ni_gpct_variant_m_series; - else - counter_variant = ni_gpct_variant_e_series; + /* allocate and initialize the gpct counter device */ devpriv-counter_dev = ni_gpct_device_construct(dev, - ni_gpct_write_register, - ni_gpct_read_register, - counter_variant, - NUM_GPCT); + ni_gpct_write_register, + ni_gpct_read_register, + (devpriv-is_m_series) + ? ni_gpct_variant_m_series + : ni_gpct_variant_e_series, + NUM_GPCT); if (!devpriv-counter_dev) return -ENOMEM; - /* General purpose counters */ + /* Counter (gpct) subdevices */ for (i = 0; i NUM_GPCT; ++i) { + struct ni_gpct *gpct = devpriv-counter_dev-counters[i]; + + /* setup and initialize the counter */ + gpct-chip_index = 0; + gpct-counter_index = i; + ni_tio_init_counter(gpct); + s = dev-subdevices[NI_GPCT_SUBDEV(i)]; - s-type = COMEDI_SUBD_COUNTER; - s-subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; - s-n_chan = 3; - if (devpriv-is_m_series) - s-maxdata = 0x; - else - s-maxdata = 0xff; - s-insn_read = ni_tio_insn_read; - s-insn_write = ni_tio_insn_read; - s-insn_config = ni_tio_insn_config; + s-type = COMEDI_SUBD_COUNTER; + s-subdev_flags = SDF_READABLE | SDF_WRITABLE | SDF_LSAMPL; + s-n_chan = 3; + s-maxdata = (devpriv-is_m_series) ? 0x +: 0x00ff; + s-insn_read= ni_tio_insn_read; + s-insn_write = ni_tio_insn_read; + s-insn_config = ni_tio_insn_config; #ifdef PCIDMA - s-subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */; - s-do_cmd = ni_gpct_cmd; - s-len_chanlist = 1; - s-do_cmdtest = ni_tio_cmdtest; - s-cancel = ni_gpct_cancel; - s-async_dma_dir = DMA_BIDIRECTIONAL; -#endif - s-private = devpriv-counter_dev-counters[i]; + if (dev-irq devpriv-mite) { + s-subdev_flags |= SDF_CMD_READ /* | SDF_CMD_WRITE */; + s-len_chanlist = 1; + s-do_cmdtest = ni_tio_cmdtest; + s-do_cmd = ni_gpct_cmd; + s-cancel = ni_gpct_cancel; - devpriv-counter_dev-counters[i].chip_index = 0; - devpriv-counter_dev-counters[i].counter_index = i; - ni_tio_init_counter(devpriv-counter_dev-counters[i]); + s-async_dma_dir = DMA_BIDIRECTIONAL; + } +#endif + s-private = gpct; } /* Frequency output */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/28] staging: comedi: ni_mio_common: remove some unnecessary boardinfo access
Currently ni_m_series_ao_config_chanlist() gets the boardinfo pointer in order to get the number of analog output channels. Get this from the comedi_subdevice instead. The ni_old_ao_config_chanlist() function also gets the boardinfo pointer to get the analog output resolution, 'aobits', in order to calculate the value needed to convert samples from unsigned to two's complement for bipolar ranges. Use the comedi_subdevice 'maxdata' instead. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 8854f18..6e79bcf 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -2818,7 +2818,6 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev, unsigned int chanspec[], unsigned int n_chans, int timed) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; unsigned int range; unsigned int chan; @@ -2827,7 +2826,7 @@ static int ni_m_series_ao_config_chanlist(struct comedi_device *dev, int invert = 0; if (timed) { - for (i = 0; i board-n_aochan; ++i) { + for (i = 0; i s-n_chan; ++i) { devpriv-ao_conf[i] = ~MSeries_AO_Update_Timed_Bit; ni_writeb(dev, devpriv-ao_conf[i], M_Offset_AO_Config_Bank(i)); @@ -2893,7 +2892,6 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev, unsigned int chanspec[], unsigned int n_chans) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; unsigned int range; unsigned int chan; @@ -2908,7 +2906,7 @@ static int ni_old_ao_config_chanlist(struct comedi_device *dev, if (comedi_range_is_bipolar(s, range)) { conf |= AO_Bipolar; - invert = (1 (board-aobits - 1)); + invert = (s-maxdata + 1) 1; } else { invert = 0; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/28] staging: comedi: mite.h: tidy up the mite channel register offsets
Convert the inline MITE_* functions, used to calculate the mite channel register offsets, into simple macros. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/mite.h | 106 ++ 1 file changed, 18 insertions(+), 88 deletions(-) diff --git a/drivers/staging/comedi/drivers/mite.h b/drivers/staging/comedi/drivers/mite.h index a4852cb..33d87a2 100644 --- a/drivers/staging/comedi/drivers/mite.h +++ b/drivers/staging/comedi/drivers/mite.h @@ -107,11 +107,6 @@ void mite_prep_dma(struct mite_channel *mite_chan, int mite_buf_change(struct mite_dma_descriptor_ring *ring, struct comedi_subdevice *s); -static inline int CHAN_OFFSET(int channel) -{ - return 0x500 + 0x100 * channel; -}; - enum mite_registers { /* The bits 0x90180700 in MITE_UNKNOWN_DMA_BURST_REG can be written and read back. The bits 0x1f always read as 1. @@ -123,90 +118,25 @@ enum mite_registers { MITE_PCI_CONFIG_OFFSET = 0x300, MITE_CSIGR = 0x460 /* chip signature */ }; -static inline int MITE_CHOR(int channel) -{ /* channel operation */ - return CHAN_OFFSET(channel) + 0x0; -}; - -static inline int MITE_CHCR(int channel) -{ /* channel control */ - return CHAN_OFFSET(channel) + 0x4; -}; - -static inline int MITE_TCR(int channel) -{ /* transfer count */ - return CHAN_OFFSET(channel) + 0x8; -}; - -static inline int MITE_MCR(int channel) -{ /* memory configuration */ - return CHAN_OFFSET(channel) + 0xc; -}; - -static inline int MITE_MAR(int channel) -{ /* memory address */ - return CHAN_OFFSET(channel) + 0x10; -}; - -static inline int MITE_DCR(int channel) -{ /* device configuration */ - return CHAN_OFFSET(channel) + 0x14; -}; - -static inline int MITE_DAR(int channel) -{ /* device address */ - return CHAN_OFFSET(channel) + 0x18; -}; - -static inline int MITE_LKCR(int channel) -{ /* link configuration */ - return CHAN_OFFSET(channel) + 0x1c; -}; -static inline int MITE_LKAR(int channel) -{ /* link address */ - return CHAN_OFFSET(channel) + 0x20; -}; - -static inline int MITE_LLKAR(int channel) -{ /* see mite section of tnt5002 manual */ - return CHAN_OFFSET(channel) + 0x24; -}; - -static inline int MITE_BAR(int channel) -{ /* base address */ - return CHAN_OFFSET(channel) + 0x28; -}; - -static inline int MITE_BCR(int channel) -{ /* base count */ - return CHAN_OFFSET(channel) + 0x2c; -}; - -static inline int MITE_SAR(int channel) -{ /* ? address */ - return CHAN_OFFSET(channel) + 0x30; -}; - -static inline int MITE_WSCR(int channel) -{ /* ? */ - return CHAN_OFFSET(channel) + 0x34; -}; - -static inline int MITE_WSER(int channel) -{ /* ? */ - return CHAN_OFFSET(channel) + 0x38; -}; - -static inline int MITE_CHSR(int channel) -{ /* channel status */ - return CHAN_OFFSET(channel) + 0x3c; -}; - -static inline int MITE_FCR(int channel) -{ /* fifo count */ - return CHAN_OFFSET(channel) + 0x40; -}; +#define MITE_CHAN(x) (0x500 + 0x100 * (x)) +#define MITE_CHOR(x) (0x00 + MITE_CHAN(x)) /* channel operation */ +#define MITE_CHCR(x) (0x04 + MITE_CHAN(x)) /* channel control */ +#define MITE_TCR(x)(0x08 + MITE_CHAN(x)) /* transfer count */ +#define MITE_MCR(x)(0x0c + MITE_CHAN(x)) /* memory configuration */ +#define MITE_MAR(x)(0x10 + MITE_CHAN(x)) /* memory address */ +#define MITE_DCR(x)(0x14 + MITE_CHAN(x)) /* device configuration */ +#define MITE_DAR(x)(0x18 + MITE_CHAN(x)) /* device address */ +#define MITE_LKCR(x) (0x1c + MITE_CHAN(x)) /* link configuration */ +#define MITE_LKAR(x) (0x20 + MITE_CHAN(x)) /* link address */ +#define MITE_LLKAR(x) (0x24 + MITE_CHAN(x)) /* see tnt5002 manual */ +#define MITE_BAR(x)(0x28 + MITE_CHAN(x)) /* base address */ +#define MITE_BCR(x)(0x2c + MITE_CHAN(x)) /* base count */ +#define MITE_SAR(x)(0x30 + MITE_CHAN(x)) /* ? address */ +#define MITE_WSCR(x) (0x34 + MITE_CHAN(x)) /* ? */ +#define MITE_WSER(x) (0x38 + MITE_CHAN(x)) /* ? */ +#define MITE_CHSR(x) (0x3c + MITE_CHAN(x)) /* channel status */ +#define MITE_FCR(x)(0x40 + MITE_CHAN(x)) /* fifo count */ enum MITE_IODWBSR_bits { WENAB = 0x80, /* window enable */ -- 1.9.3 ___ devel mailing
[PATCH 17/28] staging: comedi: ni_mio_common: (*cancel) only works with async cmd support
The comedi subdevice (*cancel) function can only be called by the core if the subdevice supports async commands. Move the initialization of this callback to it is only set if async commands are enabled. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 8303d66..2ab267b 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5559,11 +5559,11 @@ static int ni_E_init(struct comedi_device *dev, s-subdev_flags |= SDF_CMD_WRITE; s-do_cmd = ni_ao_cmd; s-do_cmdtest = ni_ao_cmdtest; + s-cancel = ni_ao_reset; s-len_chanlist = board-n_aochan; if (!devpriv-is_m_series) s-munge = ni_ao_munge; } - s-cancel = ni_ao_reset; } else { s-type = COMEDI_SUBD_UNUSED; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 16/28] staging: comedi: ni_stc.h: refactor 'aobits' boardinfo
For aesthetics, change the 'aobits' in the boardinfo to 'ao_maxdata' to remove the need for the calculation of the subdevice 'maxdata'. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_atmio.c | 14 ++-- drivers/staging/comedi/drivers/ni_mio_common.c | 2 +- drivers/staging/comedi/drivers/ni_mio_cs.c | 8 +-- drivers/staging/comedi/drivers/ni_pcimio.c | 88 +- drivers/staging/comedi/drivers/ni_stc.h| 2 +- 5 files changed, 57 insertions(+), 57 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 160e703..3858061 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -113,7 +113,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 800, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, @@ -129,7 +129,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 2000, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, @@ -145,7 +145,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 1, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1, .num_p0_dio_channels = 8, @@ -160,7 +160,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 1, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1, .num_p0_dio_channels = 8, @@ -176,7 +176,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 2000, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, @@ -193,7 +193,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_8, .ai_speed = 5, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_range_table = range_bipolar10, .ao_speed = 5, .num_p0_dio_channels = 8, @@ -209,7 +209,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_14, .ai_speed = 1, .n_aochan = 2, - .aobits = 16, + .ao_maxdata = 0x, .ao_fifo_depth = 2048, .ao_range_table = range_ni_E_ao_ext, .ao_speed = 1000, diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 4c451b5..8303d66 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5544,7 +5544,7 @@ static int ni_E_init(struct comedi_device *dev, if (devpriv-is_m_series) s-subdev_flags |= SDF_SOFT_CALIBRATED; s-n_chan = board-n_aochan; - s-maxdata = (1 board-aobits) - 1; + s-maxdata = board-ao_maxdata; s-range_table = board-ao_range_table; s-insn_read = ni_ao_insn_read; s-insn_write = ni_ao_insn_write; diff --git a/drivers/staging/comedi/drivers/ni_mio_cs.c b/drivers/staging/comedi/drivers/ni_mio_cs.c index bba709d..bb414ec 100644 --- a/drivers/staging/comedi/drivers/ni_mio_cs.c +++ b/drivers/staging/comedi/drivers/ni_mio_cs.c @@ -81,7 +81,7 @@ static const struct ni_board_struct ni_boards[] = { .gainlkup = ai_gain_16, .ai_speed = 2000, .n_aochan = 2, - .aobits = 12, + .ao_maxdata = 0x0fff, .ao_fifo_depth = 2048,
[PATCH 15/28] staging: comedi: ni_stc.h: refactor 'adbits' boardinfo
For aesthetics, change the 'adbits' in the boardinfo to 'ai_maxdata' to remove the need for the calculation of the subdevice 'maxdata'. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_atmio.c | 16 ++--- drivers/staging/comedi/drivers/ni_mio_common.c | 4 +- drivers/staging/comedi/drivers/ni_mio_cs.c | 10 +-- drivers/staging/comedi/drivers/ni_pcimio.c | 98 +- drivers/staging/comedi/drivers/ni_stc.h| 2 +- 5 files changed, 65 insertions(+), 65 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_atmio.c b/drivers/staging/comedi/drivers/ni_atmio.c index 0f4dc5a..160e703 100644 --- a/drivers/staging/comedi/drivers/ni_atmio.c +++ b/drivers/staging/comedi/drivers/ni_atmio.c @@ -108,7 +108,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 44, .isapnp_id = 0x, /* XXX unknown */ .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 8192, .gainlkup = ai_gain_16, .ai_speed = 800, @@ -124,7 +124,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 25, .isapnp_id = 0x1900, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 2048, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -140,7 +140,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 36, .isapnp_id = 0x2400, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 1, @@ -155,7 +155,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 37, .isapnp_id = 0x2500, .n_adchan = 16, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 512, .gainlkup = ai_gain_16, .ai_speed = 1, @@ -171,7 +171,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 38, .isapnp_id = 0x2600, .n_adchan = 64, - .adbits = 12, + .ai_maxdata = 0x0fff, .ai_fifo_depth = 2048, .gainlkup = ai_gain_16, .ai_speed = 2000, @@ -187,7 +187,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 39, .isapnp_id = 0x2700, .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0x, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_8, @@ -203,7 +203,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 50, .isapnp_id = 0x, /* XXX unknown */ .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0x, .ai_fifo_depth = 512, .alwaysdither = 1, .gainlkup = ai_gain_14, @@ -220,7 +220,7 @@ static const struct ni_board_struct ni_boards[] = { .device_id = 51, .isapnp_id = 0x, /* XXX unknown */ .n_adchan = 16, - .adbits = 16, + .ai_maxdata = 0x, .ai_fifo_depth = 512, .alwaysdither = 1,/* unknown */ .gainlkup = ai_gain_14, diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 05f51bc..4c451b5 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -5513,13 +5513,13 @@ static int ni_E_init(struct comedi_device *dev, SDF_READABLE | SDF_DIFF | SDF_DITHER | SDF_CMD_READ; if (!devpriv-is_611x) s-subdev_flags |= SDF_GROUND | SDF_COMMON | SDF_OTHER; - if (board-adbits 16) + if (board-ai_maxdata 0x) s-subdev_flags |= SDF_LSAMPL; if (devpriv-is_m_series) s-subdev_flags |= SDF_SOFT_CALIBRATED; s-n_chan = board-n_adchan; s-len_chanlist = 512; - s-maxdata = (1 board-adbits) - 1; +
[PATCH 14/28] staging: comedi: ni_mio_common: remove unnecessary use of 'board-adbits'
For aesthetics, use the subdevice 'maxdata' instead of the board 'adbits'. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_mio_common.c | 16 ++-- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index f4125c0..05f51bc 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -1899,13 +1899,11 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, struct ni_private *devpriv = dev-private; unsigned int chan, range, aref; unsigned int i; - unsigned offset; unsigned int dither; unsigned range_code; ni_stc_writew(dev, 1, Configuration_Memory_Clear); -/* offset = 1 (board-adbits - 1); */ if ((list[0] CR_ALT_SOURCE)) { unsigned bypass_bits; chan = CR_CHAN(list[0]); @@ -1929,7 +1927,6 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, } else { ni_writel(dev, 0, M_Offset_AI_Config_FIFO_Bypass); } - offset = 0; for (i = 0; i n_chan; i++) { unsigned config_bits = 0; chan = CR_CHAN(list[i]); @@ -1938,7 +1935,7 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, dither = ((list[i] CR_ALT_FILTER) != 0); range_code = ni_gainlkup[board-gainlkup][range]; - devpriv-ai_offset[i] = offset; + devpriv-ai_offset[i] = 0; switch (aref) { case AREF_DIFF: config_bits |= @@ -2000,14 +1997,15 @@ static void ni_m_series_load_channelgain_list(struct comedi_device *dev, * valid channels are 0-3 */ static void ni_load_channelgain_list(struct comedi_device *dev, +struct comedi_subdevice *s, unsigned int n_chan, unsigned int *list) { const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; + unsigned int offset = (s-maxdata + 1) 1; unsigned int chan, range, aref; unsigned int i; unsigned int hi, lo; - unsigned offset; unsigned int dither; if (devpriv-is_m_series) { @@ -2053,7 +2051,6 @@ static void ni_load_channelgain_list(struct comedi_device *dev, } } - offset = 1 (board-adbits - 1); for (i = 0; i n_chan; i++) { if (!devpriv-is_6143 (list[i] CR_ALT_SOURCE)) { chan = devpriv-ai_calib_source; @@ -2120,15 +2117,14 @@ static int ni_ai_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct ni_board_struct *board = comedi_board(dev); struct ni_private *devpriv = dev-private; + unsigned int mask = (s-maxdata + 1) 1; int i, n; - const unsigned int mask = (1 board-adbits) - 1; unsigned signbits; unsigned short d; unsigned long dl; - ni_load_channelgain_list(dev, 1, insn-chanspec); + ni_load_channelgain_list(dev, s, 1, insn-chanspec); ni_clear_ai_fifo(dev); @@ -2447,7 +2443,7 @@ static int ni_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) } ni_clear_ai_fifo(dev); - ni_load_channelgain_list(dev, cmd-chanlist_len, cmd-chanlist); + ni_load_channelgain_list(dev, s, cmd-chanlist_len, cmd-chanlist); /* start configuration */ ni_stc_writew(dev, AI_Configuration_Start, Joint_Reset_Register); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v4] staging: android: Clean up else statement from binder_send_failed_reply
Hi, This patch got accepted ? Thanks -- Lucas Tanure +55 (19) 988176559 On Sun, Jul 13, 2014 at 9:31 PM, Lucas Tanure tan...@linux.com wrote: Kernel coding style. Remove useless else statement after return. Changes from v1 and v2: Fix warning for mixed declarations and code. Declaration of struct binder_transaction *next made outside of while. Changes from v3: Removed initialization to NULL for next variable. Signed-off-by: Lucas Tanure tan...@linux.com --- drivers/staging/android/binder.c | 28 ++-- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/drivers/staging/android/binder.c b/drivers/staging/android/binder.c index 14714a6..4f34dc0 100644 --- a/drivers/staging/android/binder.c +++ b/drivers/staging/android/binder.c @@ -1183,6 +1183,7 @@ static void binder_send_failed_reply(struct binder_transaction *t, uint32_t error_code) { struct binder_thread *target_thread; + struct binder_transaction *next; BUG_ON(t-flags TF_ONE_WAY); while (1) { @@ -1210,24 +1211,23 @@ static void binder_send_failed_reply(struct binder_transaction *t, target_thread-return_error); } return; - } else { - struct binder_transaction *next = t-from_parent; + } + next = t-from_parent; - binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, -send failed reply for transaction %d, target dead\n, -t-debug_id); + binder_debug(BINDER_DEBUG_FAILED_TRANSACTION, +send failed reply for transaction %d, target dead\n, +t-debug_id); - binder_pop_transaction(target_thread, t); - if (next == NULL) { - binder_debug(BINDER_DEBUG_DEAD_BINDER, -reply failed, no target thread at root\n); - return; - } - t = next; + binder_pop_transaction(target_thread, t); + if (next == NULL) { binder_debug(BINDER_DEBUG_DEAD_BINDER, -reply failed, no target thread -- retry %d\n, - t-debug_id); +reply failed, no target thread at root\n); + return; } + t = next; + binder_debug(BINDER_DEBUG_DEAD_BINDER, +reply failed, no target thread -- retry %d\n, + t-debug_id); } } -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
On Fri, Jul 11, 2014 at 03:25:11PM +, Haiyang Zhang wrote: -Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Friday, July 11, 2014 1:53 AM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 Oops that should have been https://bugzilla.kernel.org/attachment.cgi?id=142351 (either way it's information linked off https://bugzilla.kernel.org/show_bug.cgi?id=78771 ). Thanks for the dmesg. By looking at it, seems the netvsc driver was loaded properly, and 2 NICs are up, one NIC is down (probably not set to connected in HyperV manager?). Or, this dmesg wasn't the one when bug happens? This was a dmesg where the bug did happen and your first guess is right - there are 3 NICs but only the first two are connected and the last is set to Not connected in Hyper-V Manager. Since you found the commit b679ef73edc is related to this problem, could you do a simple test: Reduce the receive buffer size back to 2MB, like below, then re-test it, see if the problem goes away? drivers/net/hyperv/hyperv_net.h #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ After doing this I was able to reach over 900 reboots where the network connected properly. -- Sitsofe | http://sucs.org/~sits/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2
-Original Message- From: Sitsofe Wheeler [mailto:sits...@gmail.com] Sent: Monday, July 14, 2014 5:31 PM To: Haiyang Zhang Cc: KY Srinivasan; David S. Miller; de...@linuxdriverproject.org; linux- ker...@vger.kernel.org; net...@vger.kernel.org Subject: Re: [BISECTED][REGRESSION] Loading Hyper-V network drivers is racy in 3.14+ on Hyper-V 2012 R2 On Fri, Jul 11, 2014 at 03:25:11PM +, Haiyang Zhang wrote: Since you found the commit b679ef73edc is related to this problem, could you do a simple test: Reduce the receive buffer size back to 2MB, like below, then re-test it, see if the problem goes away? drivers/net/hyperv/hyperv_net.h #define NETVSC_RECEIVE_BUFFER_SIZE (1024*1024*2) /* 2MB */ After doing this I was able to reach over 900 reboots where the network connected properly. Thanks for the tests! I will make a patch that can automatically retry smaller memory allocs when memory is insufficient. Thanks, - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/15] staging: comedi: ni_daq_700: tidy up daq700_dio_insn_bits()
This board has 8 digital output and 8 digital input channels. For convienence all 16 channels are packed into one DIO subdevice. Add a comment to clarify this. Tidy up the 'mask' check used when updating the digital outputs. For aesthetics, rename the digital output and digital input registers. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_daq_700.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index ba22951..1798b47 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -61,11 +61,11 @@ /* * Regsiter I/O map */ +#define DAQ700_DO_REG 0x04 +#define DAQ700_DI_REG 0x05 #define DAQ700_TIMER_BASE 0x08 /* daqcard700 registers */ -#define DIO_W 0x04/* WO 8bit */ -#define DIO_R 0x05/* RO 8bit */ #define CMD_R1 0x00/* WO 8bit */ #define CMD_R2 0x07/* RW 8bit */ #define CMD_R3 0x05/* W0 8bit */ @@ -94,14 +94,16 @@ static int daq700_dio_insn_bits(struct comedi_device *dev, unsigned int mask; unsigned int val; + /* +* channels 0-7 are always outputs +* channels 8-15 are always inputs +*/ mask = comedi_dio_update_state(s, data); - if (mask) { - if (mask 0xff) - outb(s-state 0xff, dev-iobase + DIO_W); - } + if (mask 0xff) + outb(s-state 0xff, dev-iobase + DAQ700_DO_REG); val = s-state 0xff; - val |= inb(dev-iobase + DIO_R) 8; + val |= inb(dev-iobase + DAQ700_DI_REG) 8; data[1] = val; -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/15] staging: comedi: ni_daq_700: tidy up and add async cmd support
Tidy up this driver a bit and add support for async commands using the Analog Input subdevice. H Hartley Sweeten (15): staging: comedi: ni_daq_700: remove unnecessary enable and flush of ADC staging: comedi: ni_daq_700: use 8253.h helpers for timer operations staging: comedi: ni_daq_700: fix daq700_dio_insn_config() staging: comedi: ni_daq_700: tidy up daq700_dio_insn_bits() staging: comedi: ni_daq_700: tidy up the command register defines staging: comedi: ni_daq_700: tidy up the status register defines staging: comedi: ni_daq_700: tidy up the remaining register defines staging: comedi: ni_daq_700: flush A/D FIFO on conversion failure staging: comedi: ni_daq_700: tidy up daq700_ai_rinsn() staging: comedi: ni_daq_700: tidy up daq700_ai_config() staging: comedi: ni_daq_700: tidy up the subdevice init staging: comedi: ni_daq_700: introduce daq700_ai_set_chanspec() staging: comedi: ni_daq_700: add ai async command support staging: comedi: ni_daq_700: add a counter subdevice staging: comedi: ni_daq_700: update the comedi driver comment drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/comedi.h | 9 + drivers/staging/comedi/drivers/ni_daq_700.c | 791 3 files changed, 686 insertions(+), 115 deletions(-) -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/15] staging: comedi: ni_daq_700: remove unnecessary enable and flush of ADC
The ADC conversions are enabled and the FIFO is flushed by daq700_ai_config() when the driver is initially attached. There is no reason to repeat the ADC enable and flush the FIFO before each sample read in the (*insn_read). Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_daq_700.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 5e472cb..4d5cb5a 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -169,11 +169,7 @@ static int daq700_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n insn-n; n++) { /* trigger conversion with out0 L to H */ - outb(0x00, dev-iobase + CMD_R2); /* enable ADC conversions */ outb(0x30, dev-iobase + CMO_R); /* mode 0 out0 L, from H */ - outb(0x00, dev-iobase + ADCLEAR_R);/* clear the ADC FIFO */ - /* read 16bit junk from FIFO to clear */ - inw(dev-iobase + ADFIFO_R); /* mode 1 out0 H, L to H, start conversion */ outb(0x32, dev-iobase + CMO_R); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/15] staging: comedi: ni_daq_700: tidy up the subdevice init
For aesthetics, add some white space to the subdevice init and tidy it up a bit. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_daq_700.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 0be7312..2b4d4e6 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -275,25 +275,25 @@ static int daq700_auto_attach(struct comedi_device *dev, if (ret) return ret; - /* DAQCard-700 dio */ + /* Digital Input/Output subdevice */ s = dev-subdevices[0]; s-type = COMEDI_SUBD_DIO; s-subdev_flags = SDF_READABLE | SDF_WRITABLE; s-n_chan = 16; - s-range_table = range_digital; s-maxdata = 1; + s-range_table = range_digital; s-insn_bits= daq700_dio_insn_bits; s-insn_config = daq700_dio_insn_config; - s-io_bits = 0x00ff; + s-io_bits = 0x00ff; /* direction is fixed */ - /* DAQCard-700 ai */ + /* Analog Input subdevice */ s = dev-subdevices[1]; - s-type = COMEDI_SUBD_AI; - s-subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; - s-n_chan = 16; - s-maxdata = (1 12) - 1; - s-range_table = range_daq700_ai; - s-insn_read = daq700_ai_insn_read; + s-type = COMEDI_SUBD_AI; + s-subdev_flags = SDF_READABLE | SDF_GROUND | SDF_DIFF; + s-n_chan = 16; + s-maxdata = 0x0fff; + s-range_table = range_daq700_ai; + s-insn_read= daq700_ai_insn_read; daq700_initialize(dev); -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/15] staging: comedi: ni_daq_700: fix daq700_dio_insn_config()
This board has 8 digital output and 8 digital input channels. The direction of these channels is not configurable. For convienence all 16 channels are packed into one DIO subdevice. The (*insn_config) for this subdevice currently uses the comedi core provided comedi_dio_insn_config() function to handle the instructions. This function handles the INSN_CONFIG_DIO_INPUT and INSN_CONFIG_DIO_OUTPUT instructions which are used to change the configuration of the channels. After calling the core function, this driver fixes the subdevice io_bits and returns success. These instructions should be returning -EINVAL since the channels are not configurable. Refactor the (*insn_config) to only handle the INSN_CONFIG_DIO_QUERY instruction and return -EINVAL for all others. Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_daq_700.c | 19 --- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 16b52b6..ba22951 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -113,14 +113,19 @@ static int daq700_dio_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - int ret; - - ret = comedi_dio_insn_config(dev, s, insn, data, 0); - if (ret) - return ret; + unsigned int mask = 1 CR_CHAN(insn-chanspec); - /* The DIO channels are not configurable, fix the io_bits */ - s-io_bits = 0x00ff; + /* +* The DIO channels are not configurable, only the query instruction +* is supported. +*/ + switch (data[0]) { + case INSN_CONFIG_DIO_QUERY: + data[1] = (s-io_bits mask) ? COMEDI_OUTPUT : COMEDI_INPUT; + break; + default: + return -EINVAL; + } return insn-n; } -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/15] staging: comedi: ni_daq_700: use 8253.h helpers for timer operations
Clarify the timer operations by using the helper functions in 8253.h. For aesthetics, factor the ai start conversion code out of daq700_ai_rinsn(). Signed-off-by: H Hartley Sweeten hswee...@visionengravers.com Cc: Ian Abbott abbo...@mev.co.uk Cc: Greg Kroah-Hartman gr...@linuxfoundation.org --- drivers/staging/comedi/drivers/ni_daq_700.c | 35 - 1 file changed, 24 insertions(+), 11 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_daq_700.c b/drivers/staging/comedi/drivers/ni_daq_700.c index 4d5cb5a..16b52b6 100644 --- a/drivers/staging/comedi/drivers/ni_daq_700.c +++ b/drivers/staging/comedi/drivers/ni_daq_700.c @@ -51,11 +51,18 @@ #include linux/delay.h #include linux/interrupt.h -#include ../comedidev.h - #include pcmcia/cistpl.h #include pcmcia/ds.h +#include ../comedidev.h + +#include 8253.h + +/* + * Regsiter I/O map + */ +#define DAQ700_TIMER_BASE 0x08 + /* daqcard700 registers */ #define DIO_W 0x04/* WO 8bit */ #define DIO_R 0x05/* RO 8bit */ @@ -66,10 +73,6 @@ #define STA_R2 0x01/* RO 8bit */ #define ADFIFO_R 0x02/* RO 16bit */ #define ADCLEAR_R 0x01/* WO 8bit */ -#define CDA_R0 0x08/* RW 8bit */ -#define CDA_R1 0x09/* RW 8bit */ -#define CDA_R2 0x0A/* RW 8bit */ -#define CMO_R 0x0B/* RO 8bit */ #define TIC_R 0x06/* WO 8bit */ /* daqcard700 modes */ #define CMD_R3_DIFF 0x04/* diff mode */ @@ -122,6 +125,18 @@ static int daq700_dio_insn_config(struct comedi_device *dev, return insn-n; } +static void daq700_ai_start_conv(struct comedi_device *dev) +{ + /* +* Manually trigger an A/D conversion with a low-to-high +* transition of OUT0. +*/ + i8254_set_mode(dev-iobase + DAQ700_TIMER_BASE, 0, + 0, I8254_MODE0 | I8254_BINARY); /* OUT0 low */ + i8254_set_mode(dev-iobase + DAQ700_TIMER_BASE, 0, + 0, I8254_MODE1 | I8254_BINARY); /* OUT0 high */ +} + static int daq700_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -168,10 +183,7 @@ static int daq700_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n insn-n; n++) { - /* trigger conversion with out0 L to H */ - outb(0x30, dev-iobase + CMO_R); /* mode 0 out0 L, from H */ - /* mode 1 out0 H, L to H, start conversion */ - outb(0x32, dev-iobase + CMO_R); + daq700_ai_start_conv(dev); /* wait for conversion to end */ ret = comedi_timeout(dev, s, insn, daq700_ai_eoc, 0); @@ -208,7 +220,8 @@ static void daq700_ai_config(struct comedi_device *dev, outb(0x80, iobase + CMD_R1);/* disable scanning, ADC to chan 0 */ outb(0x00, iobase + CMD_R2);/* clear all bits */ outb(0x00, iobase + CMD_R3);/* set +-10 range */ - outb(0x32, iobase + CMO_R); /* config counter mode1, out0 to H */ + i8254_set_mode(iobase + DAQ700_TIMER_BASE, 0, + 0, I8254_MODE1 | I8254_BINARY); /* OUT0 high */ outb(0x00, iobase + TIC_R); /* clear counter interrupt */ outb(0x00, iobase + ADCLEAR_R); /* clear the ADC FIFO */ inw(iobase + ADFIFO_R); /* read 16bit junk from FIFO to clear */ -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel