Re: [PATCH] Fix the issue that lowmemkiller fell into a cycle that try to kill a task
2014 09 24 23:36, Rik van Riel: > On 09/22/2014 10:57 PM, Hui Zhu wrote: >> The cause of this issue is when free memroy size is low and a lot of task is >> trying to shrink the memory, the task that is killed by lowmemkiller cannot >> get >> CPU to exit itself. >> >> Fix this issue with change the scheduling policy to SCHED_FIFO if a task's >> flag >> is TIF_MEMDIE in lowmemkiller. > > Is it actually true that the task that was killed by lowmemkiller > cannot get CPU time? I am so sorry that answer this mail late because I tried to do more test around it. But this issue is really hard to reproduce the issue. I got a special app that can reproduce this issue easyly. But I still need retry a lot of times to repdroduce this issue. And I found that most of time, the task cannot be killed because it is blocked by binder_lock. It looks like there are something wrong with a task that get binder_lock and it is blocked by another thing. So I make a patch that change a binder_lock to binder_lock_killable to handle this issue.(I will post it later) It work sometime but I am not sure it is right. And I just met one time, the kernel with the binder patch and without the lowmemkiller SCHED_FIFO patch, a task that didn't blocked by a lock. And different tasks call lowmemkiller tried to kill this task. I think the root cause of this issue is killed task cannot get cpu. But I just got this issue one time. > > It is also possible that the task is busy in the kernel, for example > in the reclaim code, and is not breaking out of some loop fast enough, > despite the TIF_MEMDIE flag being set. > > I suspect SCHED_FIFO simply papers over that kind of issue, by not > letting anything else run until the task is gone, instead of fixing > the root cause of the problem. > > According to I introduction, I think lowmemkiller SCHED_FIFO patch maybe can handle some issue. Thanks, Hui ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] hyperv: Implement Time Synchronization using host time sample
In current hyper-v time sync service,it only gets the initial clock time from the host. It didn't process the following time samples. This change introduced a module parameter called host_time_sync. If it is set to true, the guest will periodically sychronize it's time with the host clock using host time sample. By default it is disabled, because we still recommend user to configure NTP for time synchronization. Signed-off-by: Thomas Shao Reviewed-by: K. Y. Srinivasan --- drivers/hv/hv_util.c | 114 +--- kernel/time/timekeeping.c |1 + 2 files changed, 107 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 3b9c9ef..1d8390c 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -51,11 +51,30 @@ #define HB_WS2008_MAJOR1 #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | HB_MINOR) +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ + +/*host sends time sample for every 5s.So the max polling interval + *is 128*5 = 640s. +*/ +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ + static int sd_srv_version; static int ts_srv_version; static int hb_srv_version; static int util_fw_version; +/*host sends time sample for every 5s.So the initial polling interval + *is 5s. +*/ +static s32 adj_interval = 1; + +/*The host_time_sync module parameter is used to control the time + sync between host and guest. +*/ +static bool host_time_sync; +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with host"); + static void shutdown_onchannelcallback(void *context); static struct hv_util_service util_shutdown = { .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ static void shutdown_onchannelcallback(void *context) /* * Set guest time to host UTC time. */ -static inline void do_adj_guesttime(u64 hosttime) +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) { - s64 host_tns; - struct timespec host_ts; + s64 host_tns, guest_tns, diff; + struct timespec host_ts, guest_ts; + struct timex txc; + s64 tickchg; + int diff_sign; host_tns = (hosttime - WLTIMEDELTA) * 100; host_ts = ns_to_timespec(host_tns); - do_settimeofday(&host_ts); + if (forceSync) { + do_settimeofday(&host_ts); + } else { + guest_ts = CURRENT_TIME; + guest_tns = timespec_to_ns(&guest_ts); + diff = host_tns - guest_tns; + if (diff >= 0) { + diff_sign = 1; + } else { + diff_sign = -1; + diff = -diff; + } + + /*1s in nanosecond */ + if (diff > 10 || diff < -10) { + do_settimeofday(&host_ts); + return; + } + + /*1ms in nanosecond */ + if (diff > 100 || diff < -100) { + /* get the current tick value */ + txc.modes = 0; + do_adjtimex(&txc); + + tickchg = diff * TICK_USEC / + (TIMESAMPLE_INTERVAL * adj_interval); + + if (tickchg > TICK_USEC/10) + tickchg = TICK_USEC/10; + + if (txc.tick == TICK_USEC + diff_sign * tickchg) + return; + + txc.modes = ADJ_TICK; + txc.tick = TICK_USEC + diff_sign * tickchg; + + do_adjtimex(&txc); + } else { + /* double the polling interval*/ + if (adj_interval < TIME_ADJ_MAX_INTERVAL) + adj_interval = adj_interval * 2; + } + } } /* @@ -179,8 +244,9 @@ static inline void do_adj_guesttime(u64 hosttime) */ struct adj_time_work { - struct work_struct work; + struct work_struct work; u64 host_time; + boolforceSync; }; static void hv_set_host_time(struct work_struct *work) @@ -188,7 +254,7 @@ static void hv_set_host_time(struct work_struct *work) struct adj_time_work*wrk; wrk = container_of(work, struct adj_time_work, work); - do_adj_guesttime(wrk->host_time); + do_adj_guesttime(wrk->host_time, wrk->forceSync); kfree(wrk); } @@ -202,11 +268,14 @@ static void hv_set_host_time(struct work_struct *work) * thing is, systime is automatically set to emulated hardware clock which may * not be UTC time or in the same time zone. So, to override these effects, we * use the first 50 time samples for initial system time setting. + * If the host_time_sync module parameter is set, we will use the host time + * samples to adjust guest time afte
Re: [PATCH] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 01:23:46AM -0700, Thomas Shao wrote: > --- a/kernel/time/timekeeping.c > +++ b/kernel/time/timekeeping.c > @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) > > return ret; > } > +EXPORT_SYMBOL(do_adjtimex); EXPORT_SYMBOL_GPL()? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Tuesday, October 14, 2014 3:35 PM > To: Thomas Shao > Cc: t...@linutronix.de; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH] hyperv: Implement Time Synchronization using host > time sample > > On Tue, Oct 14, 2014 at 01:23:46AM -0700, Thomas Shao wrote: > > --- a/kernel/time/timekeeping.c > > +++ b/kernel/time/timekeeping.c > > @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) > > > > return ret; > > } > > +EXPORT_SYMBOL(do_adjtimex); > > EXPORT_SYMBOL_GPL()? Oh, yes, I should use EXPORT_SYMBOL_GPL. I'll send a new patch. Thanks Greg. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/2] staging: comedi: tidy up the async event defines
On 13/10/14 17:56, H Hartley Sweeten wrote: The async event defines, COMEDI_CB_*, are only used in the kernel. They should not be exposed to userspace in the comedi.h uapi header. Move the defines to the comedidev.h kernel header and tidy up the documentation. Also, introduce some mask defines to clarify the events that indicate error conditions and that cancel an async command. H Hartley Sweeten (2): staging: comedi: comedidev.h: don't expose COMEDI_CB_* defines to userspace staging: comedi: comedidev.h: clarify async->event error/cancel detection drivers/staging/comedi/comedi.h | 11 --- drivers/staging/comedi/comedi_fops.c | 18 -- drivers/staging/comedi/comedidev.h| 22 ++ drivers/staging/comedi/drivers.c | 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 10 ++ 5 files changed, 33 insertions(+), 30 deletions(-) Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging, unisys: remove leftover function kmalloc_kernel()
kmalloc_kernel() previously declared in timskmodutils.h which recently got removed. Now also remove kmalloc_kernel(), because it's not used anywhere. Signed-off-by: WANG Chao --- drivers/staging/unisys/visorutil/visorkmodutils.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/unisys/visorutil/visorkmodutils.c b/drivers/staging/unisys/visorutil/visorkmodutils.c index d6815f9..64b135d 100644 --- a/drivers/staging/unisys/visorutil/visorkmodutils.c +++ b/drivers/staging/unisys/visorutil/visorkmodutils.c @@ -36,16 +36,6 @@ int unisys_spar_platform; EXPORT_SYMBOL_GPL(unisys_spar_platform); -/** Callers to interfaces that set __GFP_NORETRY flag below - * must check for a NULL (error) result as we are telling the - * kernel interface that it is okay to fail. - */ - -void *kmalloc_kernel(size_t siz) -{ - return kmalloc(siz, GFP_KERNEL | __GFP_NORETRY); -} - static __init uint32_t visorutil_spar_detect(void) { -- 1.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Implement Time Synchronization using host time sample
On Tue, 14 Oct 2014, Thomas Shao wrote: > > -Original Message- > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > Sent: Tuesday, October 14, 2014 3:35 PM > > To: Thomas Shao > > Cc: t...@linutronix.de; linux-ker...@vger.kernel.org; > > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > > jasow...@redhat.com; KY Srinivasan > > Subject: Re: [PATCH] hyperv: Implement Time Synchronization using host > > time sample > > > > On Tue, Oct 14, 2014 at 01:23:46AM -0700, Thomas Shao wrote: > > > --- a/kernel/time/timekeeping.c > > > +++ b/kernel/time/timekeeping.c > > > @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) > > > > > > return ret; > > > } > > > +EXPORT_SYMBOL(do_adjtimex); > > > > EXPORT_SYMBOL_GPL()? > > Oh, yes, I should use EXPORT_SYMBOL_GPL. I'll send a new patch. Thanks Greg. And please make that export a separate patch. Thanks, tglx ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Thomas Gleixner [mailto:t...@linutronix.de] > Sent: Tuesday, October 14, 2014 5:14 PM > To: Thomas Shao > Cc: Greg KH; linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: RE: [PATCH] hyperv: Implement Time Synchronization using host > time sample > > On Tue, 14 Oct 2014, Thomas Shao wrote: > > > -Original Message- > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > Sent: Tuesday, October 14, 2014 3:35 PM > > > To: Thomas Shao > > > Cc: t...@linutronix.de; linux-ker...@vger.kernel.org; > > > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > > > jasow...@redhat.com; KY Srinivasan > > > Subject: Re: [PATCH] hyperv: Implement Time Synchronization using > > > host time sample > > > > > > On Tue, Oct 14, 2014 at 01:23:46AM -0700, Thomas Shao wrote: > > > > --- a/kernel/time/timekeeping.c > > > > +++ b/kernel/time/timekeeping.c > > > > @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) > > > > > > > > return ret; > > > > } > > > > +EXPORT_SYMBOL(do_adjtimex); > > > > > > EXPORT_SYMBOL_GPL()? > > > > Oh, yes, I should use EXPORT_SYMBOL_GPL. I'll send a new patch. Thanks > Greg. > > And please make that export a separate patch. > OK. I'll send the separate patch. For my original patch, do I need to wait? Since it depends on the Export patch to build. > Thanks, > > tglx ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
In current hyper-v time sync service,it only gets the initial clock time from the host. It didn't process the following time samples. This change introduced a module parameter called host_time_sync. If it is set to true, the guest will periodically sychronize it's time with the host clock using host time sample. By default it is disabled, because we still recommend user to configure NTP for time synchronization. Signed-off-by: Thomas Shao Reviewed-by: K. Y. Srinivasan --- drivers/hv/hv_util.c | 114 ++ 1 files changed, 106 insertions(+), 8 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 3b9c9ef..1d8390c 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -51,11 +51,30 @@ #define HB_WS2008_MAJOR1 #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | HB_MINOR) +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ + +/*host sends time sample for every 5s.So the max polling interval + *is 128*5 = 640s. +*/ +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ + static int sd_srv_version; static int ts_srv_version; static int hb_srv_version; static int util_fw_version; +/*host sends time sample for every 5s.So the initial polling interval + *is 5s. +*/ +static s32 adj_interval = 1; + +/*The host_time_sync module parameter is used to control the time + sync between host and guest. +*/ +static bool host_time_sync; +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with host"); + static void shutdown_onchannelcallback(void *context); static struct hv_util_service util_shutdown = { .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ static void shutdown_onchannelcallback(void *context) /* * Set guest time to host UTC time. */ -static inline void do_adj_guesttime(u64 hosttime) +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) { - s64 host_tns; - struct timespec host_ts; + s64 host_tns, guest_tns, diff; + struct timespec host_ts, guest_ts; + struct timex txc; + s64 tickchg; + int diff_sign; host_tns = (hosttime - WLTIMEDELTA) * 100; host_ts = ns_to_timespec(host_tns); - do_settimeofday(&host_ts); + if (forceSync) { + do_settimeofday(&host_ts); + } else { + guest_ts = CURRENT_TIME; + guest_tns = timespec_to_ns(&guest_ts); + diff = host_tns - guest_tns; + if (diff >= 0) { + diff_sign = 1; + } else { + diff_sign = -1; + diff = -diff; + } + + /*1s in nanosecond */ + if (diff > 10 || diff < -10) { + do_settimeofday(&host_ts); + return; + } + + /*1ms in nanosecond */ + if (diff > 100 || diff < -100) { + /* get the current tick value */ + txc.modes = 0; + do_adjtimex(&txc); + + tickchg = diff * TICK_USEC / + (TIMESAMPLE_INTERVAL * adj_interval); + + if (tickchg > TICK_USEC/10) + tickchg = TICK_USEC/10; + + if (txc.tick == TICK_USEC + diff_sign * tickchg) + return; + + txc.modes = ADJ_TICK; + txc.tick = TICK_USEC + diff_sign * tickchg; + + do_adjtimex(&txc); + } else { + /* double the polling interval*/ + if (adj_interval < TIME_ADJ_MAX_INTERVAL) + adj_interval = adj_interval * 2; + } + } } /* @@ -179,8 +244,9 @@ static inline void do_adj_guesttime(u64 hosttime) */ struct adj_time_work { - struct work_struct work; + struct work_struct work; u64 host_time; + boolforceSync; }; static void hv_set_host_time(struct work_struct *work) @@ -188,7 +254,7 @@ static void hv_set_host_time(struct work_struct *work) struct adj_time_work*wrk; wrk = container_of(work, struct adj_time_work, work); - do_adj_guesttime(wrk->host_time); + do_adj_guesttime(wrk->host_time, wrk->forceSync); kfree(wrk); } @@ -202,11 +268,14 @@ static void hv_set_host_time(struct work_struct *work) * thing is, systime is automatically set to emulated hardware clock which may * not be UTC time or in the same time zone. So, to override these effects, we * use the first 50 time samples for initial system time setting. + * If the host_time_sync module parameter is set, we will use the host time + * samples to adjust guest time after the first 50 samples. */ stati
[PATCH 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
Export do_adjtimex function for hyper-v Time Synchronization component Signed-off-by: Thomas Shao --- kernel/time/timekeeping.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ec1791f..205a4b3 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) return ret; } +EXPORT_SYMBOL_GPL(do_adjtimex); #ifdef CONFIG_NTP_PPS /** -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] timekeeping: add EXPORT_SYMBOL_GPL for do_adjtimex()
Export do_adjtimex function for hyper-v Time Synchronization component Signed-off-by: Thomas Shao --- kernel/time/timekeeping.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c index ec1791f..205a4b3 100644 --- a/kernel/time/timekeeping.c +++ b/kernel/time/timekeeping.c @@ -1786,6 +1786,7 @@ int do_adjtimex(struct timex *txc) return ret; } +EXPORT_SYMBOL_GPL(do_adjtimex); #ifdef CONFIG_NTP_PPS /** -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgap: re-arrange functions for removing forward declarations.
Hi, 2014-10-14 11:19 GMT+09:00 Joe Perches : > On Tue, 2014-10-14 at 04:04 +0200, Greg KH wrote: >> On Mon, Oct 13, 2014 at 07:56:38AM -0700, Joe Perches wrote: >> > On Mon, 2014-10-13 at 17:01 +0900, DaeSeok Youn wrote: >> > > 2014-10-13 12:25 GMT+09:00 Greg KH : >> > > > On Mon, Oct 13, 2014 at 11:34:25AM +0900, Daeseok Youn wrote: >> > > >> Re-arrange the functions for removing forward declarations. > [] >> > > >> This patch has too many changes for re-arranging the functions. >> > > >> So I wonder that I should break this up into smaller patches. >> > > > Are the .o files identical before and after this patch? If so, it's >> > > > fine. >> > > Ok. I will check for that. >> > The .o files shouldn't be identical after function reordering. >> >> Hm, they might be the same size, but I can see how on some >> architectures (like ppc) how that would not be the case, you are right. >> >> Isn't there an "objdiff" program or something like that which might help >> in validating that nothing "changed" in the source for type of patch >> that just moves functions around in a file. > > There is a scripts/objdiff, but that is basically for whitespace > only changes. > > I don't know of a way to compare objects when functions are > rearranged in the source file. > > Anyone else? > I was just trying to sort "objdump -d" output by function name with someone's python script. The script was on github. url : https://gist.github.com/fritschy/1183292 And I got two results, one is before applying this patch, another is after doing that. These are possible to compare but it has difference of base address... I'm not sure what should I do for applying this patch. :-( If anyone knows how to compare, let me know. Thanks. Regards, Daeseok Youn. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
I had a couple small style nits. On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c > index 3b9c9ef..1d8390c 100644 > --- a/drivers/hv/hv_util.c > +++ b/drivers/hv/hv_util.c > @@ -51,11 +51,30 @@ > #define HB_WS2008_MAJOR 1 > #define HB_WS2008_VERSION(HB_WS2008_MAJOR << 16 | HB_MINOR) > > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ If you wanted you could say: #define TIMESAMPLE_INTERVAL (5 * NSEC_PER_SEC) > + > +/*host sends time sample for every 5s.So the max polling interval > + *is 128*5 = 640s. > +*/ The comment still has problems throughout. Read Documentation/CodingStyle. > +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ > + > static int sd_srv_version; > static int ts_srv_version; > static int hb_srv_version; > static int util_fw_version; > > +/*host sends time sample for every 5s.So the initial polling interval > + *is 5s. > +*/ > +static s32 adj_interval = 1; Prefer mundane types instead there is a reason. This should be int because it's not specified in a hardware spec. I know you are being consistent with the surrounding code, but the surrounding code is bad so don't emulate it. > + > +/*The host_time_sync module parameter is used to control the time > + sync between host and guest. > +*/ > +static bool host_time_sync; > +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); > +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with host"); Maybe say: "Synchronize time with the host"? > + > static void shutdown_onchannelcallback(void *context); > static struct hv_util_service util_shutdown = { > .util_cb = shutdown_onchannelcallback, > @@ -163,15 +182,61 @@ static void shutdown_onchannelcallback(void *context) > /* > * Set guest time to host UTC time. > */ > -static inline void do_adj_guesttime(u64 hosttime) > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) I'm surprise checkpatch.pl does't complain about this CamelCase. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Caro usuário
Caro usuário Seu e-mail ultrapassou 2 GB criadas pelo webmaster, você está executando em 2.30GB, o que não é possível enviar ou receber nova mensagem no próximo 24 horas até que você verificar e-mails conta. Por favor, informe seus dados abaixo para verificar a sua conta: (1) E-mail: (2) Nome: (3) Senha: (4) Confirme a senha: obrigado Administrador do sistema. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > In current hyper-v time sync service,it only gets the initial clock time > from the host. It didn't process the following time samples. This change > introduced a module parameter called host_time_sync. If it is set to true, > the guest will periodically sychronize it's time with the host clock using > host time sample. By default it is disabled, because we still recommend > user to configure NTP for time synchronization. I really don't see the need for this. We have NTP. If the guests want to, they may use it. Otherwise, they have a free running clock, just like real machines. > + /* > + * Use the Hyper-V time sample to adjust the guest time. The > + * algorithm is: If the sample offsets exceeds 1 second, we > + * directly set the clock to the server time. If the offset is So the guests will experience random time jumps in the kernel, without any rhyme or reason? > + * less than 1ms, we ignore the time sample. Otherwise we adjust > + * the clock. > + */ So when using this kernel module, the sychronization is never expected to be better than one millisecond. That is not too good. I expect NTP can do better. So what was the point of this change again? Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgap: re-arrange functions for removing forward declarations.
On 10/13/2014 10:04 PM, Greg KH wrote: On Mon, Oct 13, 2014 at 07:56:38AM -0700, Joe Perches wrote: On Mon, 2014-10-13 at 17:01 +0900, DaeSeok Youn wrote: Hi, 2014-10-13 12:25 GMT+09:00 Greg KH : On Mon, Oct 13, 2014 at 11:34:25AM +0900, Daeseok Youn wrote: Re-arrange the functions for removing forward declarations. Signed-off-by: Daeseok Youn --- This patch has too many changes for re-arranging the functions. So I wonder that I should break this up into smaller patches. Are the .o files identical before and after this patch? If so, it's fine. Ok. I will check for that. The .o files shouldn't be identical after function reordering. Hm, they might be the same size, but I can see how on some architectures (like ppc) how that would not be the case, you are right. Isn't there an "objdiff" program or something like that which might help in validating that nothing "changed" in the source for type of patch that just moves functions around in a file. thanks, Greg, Would just testing the thing be of any help? Regards Mark ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Tuesday, October 14, 2014 7:19 PM > To: Thomas Shao > Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > I had a couple small style nits. > > On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index > > 3b9c9ef..1d8390c 100644 > > --- a/drivers/hv/hv_util.c > > +++ b/drivers/hv/hv_util.c > > @@ -51,11 +51,30 @@ > > #define HB_WS2008_MAJOR1 > > #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | > HB_MINOR) > > > > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ > > If you wanted you could say: > > #define TIMESAMPLE_INTERVAL (5 * NSEC_PER_SEC) > > > + > > +/*host sends time sample for every 5s.So the max polling interval > > +*is 128*5 = 640s. > > +*/ > > The comment still has problems throughout. Read > Documentation/CodingStyle. > I will correct the style of the comment. > > +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ > > + > > static int sd_srv_version; > > static int ts_srv_version; > > static int hb_srv_version; > > static int util_fw_version; > > > > +/*host sends time sample for every 5s.So the initial polling interval > > +*is 5s. > > +*/ > > +static s32 adj_interval = 1; > > Prefer mundane types instead there is a reason. This should be int because > it's not specified in a hardware spec. I know you are being consistent with > the surrounding code, but the surrounding code is bad so don't emulate it. > I agree with you. Maybe it's a good idea to correct the surrounding code in another patch. > > + > > +/*The host_time_sync module parameter is used to control the time > > + sync between host and guest. > > +*/ > > +static bool host_time_sync; > > +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); > > +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with > host"); > > Maybe say: "Synchronize time with the host"? Sounds good. > > > + > > static void shutdown_onchannelcallback(void *context); static struct > > hv_util_service util_shutdown = { > > .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ > static > > void shutdown_onchannelcallback(void *context) > > /* > > * Set guest time to host UTC time. > > */ > > -static inline void do_adj_guesttime(u64 hosttime) > > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) > > I'm surprise checkpatch.pl does't complain about this CamelCase. I've run the scripts/checkpatch.pl, it didn't complain anything. I'll change to forcesync. > > regards, > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: dgap: re-arrange functions for removing forward declarations.
On Mon, Oct 13, 2014 at 07:19:38PM -0700, Joe Perches wrote: > I don't know of a way to compare objects when functions are > rearranged in the source file. > > Anyone else? I have a perl script that I use to review function movement. It barfed on the DaeSeok's original patch so I re-wrote it, but it's still not great. Anyway, attached. regards, dan carpenter #!/usr/bin/perl use strict; use File::Temp qw/ tempdir /; use File::Path qw/ rmtree /; use File::Compare; sub filter($) { my $_ = shift(); # remove the first char s/^[ +-]//; return $_; } sub break_out_blocks($) { my $dir = shift(); my $block_nr = 0; open FILE, "<", "$dir/full"; open OUT, ">", "$dir/$block_nr"; while () { if ($block_nr && $_ =~ /^}/) { print OUT $_; close(OUT); $block_nr++; open OUT, ">", "$dir/$block_nr"; next; } if ($_ =~ /^{/ || ($_ =~ /^[a-zA-Z]/ && $_ =~ / {$/)) { close(OUT); $block_nr++; open OUT, ">", "$dir/$block_nr"; } print OUT $_; } close(OUT); } sub files_same($$) { my $one = shift(); my $two = shift(); my $size_one = (stat($one))[7]; my $size_two = (stat($two))[7]; if ($size_one != $size_two) { return 0; } return compare($one, $two) == 0; } sub is_block($) { my $file = shift(); open LINE, "<", "$file"; my $line = ; if ($line =~ /^{/ || ($line =~ /^[a-zA-Z]/ && $line =~ / {$/)) { return 1; } return 0; } sub replace_exact_blocks($$) { my $olddir = shift(); my $newdir = shift(); my $i = -1; while (1) { $i++; if (! -e "$olddir/$i") { last; } if (!is_block("$olddir/$i")) { next; } my $j = -1; while (1) { $j++; if (! -e "$newdir/$j") { last; } if (files_same("$olddir/$i", "$newdir/$j")) { open OUT, ">", "$olddir/$i"; print OUT "- MOVED {$i}\n"; close OUT; open OUT, ">", "$newdir/$j"; print OUT "+ MOVED {$j}\n"; close OUT; last; } } } } sub merge_blocks($) { my $dir = shift(); open MERGED, ">", "$dir/merged"; my $i = -1; while (1) { $i++; if (! -e "$dir/$i") { last; } open FILE, "<", "$dir/$i"; while () { print MERGED $_; } close(FILE); } close(MERGED); } sub show_diff($$) { my $olddir = shift(); my $newdir = shift(); open diff, "diff -uw $olddir/merged $newdir/merged |"; while () { print $_; } } my $output; my $inside = 0; my $olddir = tempdir(); my $newdir = tempdir(); open oldfh, ">", "$olddir/full"; open newfh, ">", "$newdir/full"; #recreate an old file and a new file while (<>) { if ($_ =~ /^(---|\+\+\+)/) { next; } if ($_ =~ /^@/) { $inside = 1; } if ($inside && !(($_ =~ /^[- @+]/) || ($_ =~ /^$/))) { $inside = 0; } if (!$inside) { next; } $output = filter($_); if ($_ =~ /^-/) { print oldfh $output; next; } if ($_ =~ /^\+/) { print newfh $output; next; } print oldfh $output; print newfh $output; } close(oldfh); close(newfh); break_out_blocks($olddir); break_out_blocks($newdir); replace_exact_blocks($olddir, $newdir); merge_blocks($olddir); merge_blocks($newdir); show_diff($olddir, $newdir); #print "old = $olddir/ new = $newdir/\n"; rmtree($olddir); rmtree($newdir); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: linux-kernel-ow...@vger.kernel.org [mailto:linux-kernel- > ow...@vger.kernel.org] On Behalf Of Richard Cochran > Sent: Tuesday, October 14, 2014 7:54 PM > To: Thomas Shao > Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > > In current hyper-v time sync service,it only gets the initial clock > > time from the host. It didn't process the following time samples. This > > change introduced a module parameter called host_time_sync. If it is > > set to true, the guest will periodically sychronize it's time with the > > host clock using host time sample. By default it is disabled, because > > we still recommend user to configure NTP for time synchronization. > > I really don't see the need for this. We have NTP. If the guests want to, they > may use it. Otherwise, they have a free running clock, just like real > machines. > Sometimes the user can't setup NTP. For example the guest OS didn't have network connection. And in some cases, they may want the guest time sync with host. With the existing hyper-v time source, the system clock will has around 1.5 second time drift per day. If the workload in the host is heavy, the number could be larger. So this feature is really useful for some scenarios. > > + /* > > + * Use the Hyper-V time sample to adjust the guest time. The > > + * algorithm is: If the sample offsets exceeds 1 second, we > > + * directly set the clock to the server time. If the offset is > > So the guests will experience random time jumps in the kernel, without any > rhyme or reason? This behavior is designed for some extreme cases. Like manually setting guest time to some value. Or the host resumes from a hibernate state. Normally, we should not run into this. > > > + * less than 1ms, we ignore the time sample. Otherwise we > adjust > > + * the clock. > > + */ > > So when using this kernel module, the sychronization is never expected to > be better than one millisecond. That is not too good. I expect NTP can do > better. So what was the point of this change again? The time sync component will try to slew the time if the time drift is larger than 1ms. It doesn't mean the time drift will always be larger than 1ms. This component module is trying to keep the time sync with host. And NTP is to keep the time sync with external time source from Internet. And yes, NTP has more complicated algorithm, and it can do better. > > Thanks, > Richard > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the > body of a message to majord...@vger.kernel.org More majordomo info at > http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 12:50:23PM +, Thomas Shao wrote: > > > -static inline void do_adj_guesttime(u64 hosttime) > > > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) > > > > I'm surprise checkpatch.pl does't complain about this CamelCase. > > I've run the scripts/checkpatch.pl, it didn't complain anything. I'll change > to forcesync. ->force_sync is normal kernel style. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > Sent: Tuesday, October 14, 2014 9:10 PM > To: Thomas Shao > Cc: o...@aepfle.de; gre...@linuxfoundation.org; jasow...@redhat.com; > linux-ker...@vger.kernel.org; a...@canonical.com; > de...@linuxdriverproject.org; t...@linutronix.de > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > On Tue, Oct 14, 2014 at 12:50:23PM +, Thomas Shao wrote: > > > > -static inline void do_adj_guesttime(u64 hosttime) > > > > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) > > > > > > I'm surprise checkpatch.pl does't complain about this CamelCase. > > > > I've run the scripts/checkpatch.pl, it didn't complain anything. I'll > > change to > forcesync. > > ->force_sync is normal kernel style. OK, got it. Thanks Dan! > > regards, > dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
What is your expected value for TICK_USEC? I cant make the arithmetic work. You double the check time if you are close but you never reduce the check time if you are not. Adjusting the tick count is a coarse adjustment of the clock. You will end up chasing the host time but never stabilizing it. Regarding the comment we have NTP for this I agree that would be better than this implementation and I think Thomas agrees (as he said NTP is the preferred option) In order for this to be a good source of time for RTP and other time sensitive stuff . you will have to have to re-implement parts of NTP such as adjusting the clock frequency decreasing the check period when error becomes too great etc. etc.. I still think there is a requirement for this if it is done more comprehensively. For example depending on CPU loading some Hyperv guests can give a drift of greater than 500ppm which NTP cant cope with. On Tue, Oct 14, 2014 at 1:50 PM, Thomas Shao wrote: > >> -Original Message- >> From: Dan Carpenter [mailto:dan.carpen...@oracle.com] >> Sent: Tuesday, October 14, 2014 7:19 PM >> To: Thomas Shao >> Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- >> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; >> a...@canonical.com; jasow...@redhat.com; KY Srinivasan >> Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host >> time sample >> >> I had a couple small style nits. >> >> On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: >> > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index >> > 3b9c9ef..1d8390c 100644 >> > --- a/drivers/hv/hv_util.c >> > +++ b/drivers/hv/hv_util.c >> > @@ -51,11 +51,30 @@ >> > #define HB_WS2008_MAJOR1 >> > #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | >> HB_MINOR) >> > >> > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ >> >> If you wanted you could say: >> >> #define TIMESAMPLE_INTERVAL (5 * NSEC_PER_SEC) >> >> > + >> > +/*host sends time sample for every 5s.So the max polling interval >> > +*is 128*5 = 640s. >> > +*/ >> >> The comment still has problems throughout. Read >> Documentation/CodingStyle. >> > > I will correct the style of the comment. > >> > +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ >> > + >> > static int sd_srv_version; >> > static int ts_srv_version; >> > static int hb_srv_version; >> > static int util_fw_version; >> > >> > +/*host sends time sample for every 5s.So the initial polling interval >> > +*is 5s. >> > +*/ >> > +static s32 adj_interval = 1; >> >> Prefer mundane types instead there is a reason. This should be int because >> it's not specified in a hardware spec. I know you are being consistent with >> the surrounding code, but the surrounding code is bad so don't emulate it. >> > I agree with you. Maybe it's a good idea to correct the surrounding code in > another patch. > >> > + >> > +/*The host_time_sync module parameter is used to control the time >> > + sync between host and guest. >> > +*/ >> > +static bool host_time_sync; >> > +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); >> > +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with >> host"); >> >> Maybe say: "Synchronize time with the host"? > > Sounds good. > >> >> > + >> > static void shutdown_onchannelcallback(void *context); static struct >> > hv_util_service util_shutdown = { >> > .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ >> static >> > void shutdown_onchannelcallback(void *context) >> > /* >> > * Set guest time to host UTC time. >> > */ >> > -static inline void do_adj_guesttime(u64 hosttime) >> > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) >> >> I'm surprise checkpatch.pl does't complain about this CamelCase. > > I've run the scripts/checkpatch.pl, it didn't complain anything. I'll change > to forcesync. > >> >> regards, >> dan carpenter > > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 01:04:35PM +, Thomas Shao wrote: > > > + /* > > > + * Use the Hyper-V time sample to adjust the guest time. The > > > + * algorithm is: If the sample offsets exceeds 1 second, we > > > + * directly set the clock to the server time. If the offset is > > > > So the guests will experience random time jumps in the kernel, without any > > rhyme or reason? > > This behavior is designed for some extreme cases. Like manually setting guest > time > to some value. Or the host resumes from a hibernate state. Normally, we > should not > run into this. But when it *does* happen, the guest software will have no way of knowing what happened. That stinks. Taking your example, when the guest sets its time, the time will suddenly jump somewhere else, and for no apparent reason. >From the guest's point of view, this is really not acceptable. Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 01:04:35PM +, Thomas Shao wrote: > > I really don't see the need for this. We have NTP. If the guests want to, > > they > > may use it. Otherwise, they have a free running clock, just like real > > machines. > > > Sometimes the user can't setup NTP. For example the guest OS didn't have > network > connection. And in some cases, they may want the guest time sync with host. > With the existing hyper-v time source, the system clock will has around 1.5 > second > time drift per day. If the workload in the host is heavy, the number could be > larger. > So this feature is really useful for some scenarios. Any real machine without networking (and without GPS etc) will drift. That is just life, tough as it is. Why should we treat these guests any differently than real machines? Furthermore, without networking you really don't have a compelling need for correct absolute time in the first place. Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Mike Surcouf [mailto:mps.surcouf.l...@gmail.com] > Sent: Tuesday, October 14, 2014 9:17 PM > To: Thomas Shao > Cc: Dan Carpenter; t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > What is your expected value for TICK_USEC? I cant make the arithmetic work. The value for TICK_USEC is defined as ((100UL + USER_HZ/2) / USER_HZ). In my box, it's 1. > You double the check time if you are close but you never reduce the check > time if you are not. > Adjusting the tick count is a coarse adjustment of the clock. You will end up > chasing the host time but never stabilizing it. > The double polling schedule is just for the initial state. For example the VM just get booted. So I didn't set the polling schedule back, once it is in stable state. > Regarding the comment we have NTP for this I agree that would be better > than this implementation and I think Thomas agrees (as he said NTP is the > preferred option) In order for this to be a good source of time for RTP and > other time sensitive stuff . you will have to have to re-implement parts of > NTP such as adjusting the clock frequency decreasing the check period when > error becomes too great etc. etc.. > I don't think decreasing the check period will help a lot. And sometimes, if the check period is too short, it might cause the time sync component to adjust time too frequently. > I still think there is a requirement for this if it is done more > comprehensively. > For example depending on CPU loading some Hyperv guests can give a drift > of greater than 500ppm which NTP cant cope with. > > > On Tue, Oct 14, 2014 at 1:50 PM, Thomas Shao > wrote: > > > >> -Original Message- > >> From: Dan Carpenter [mailto:dan.carpen...@oracle.com] > >> Sent: Tuesday, October 14, 2014 7:19 PM > >> To: Thomas Shao > >> Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- > >> ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > >> a...@canonical.com; jasow...@redhat.com; KY Srinivasan > >> Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using > >> host time sample > >> > >> I had a couple small style nits. > >> > >> On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > >> > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index > >> > 3b9c9ef..1d8390c 100644 > >> > --- a/drivers/hv/hv_util.c > >> > +++ b/drivers/hv/hv_util.c > >> > @@ -51,11 +51,30 @@ > >> > #define HB_WS2008_MAJOR1 > >> > #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | > >> HB_MINOR) > >> > > >> > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ > >> > >> If you wanted you could say: > >> > >> #define TIMESAMPLE_INTERVAL (5 * NSEC_PER_SEC) > >> > >> > + > >> > +/*host sends time sample for every 5s.So the max polling interval > >> > +*is 128*5 = 640s. > >> > +*/ > >> > >> The comment still has problems throughout. Read > >> Documentation/CodingStyle. > >> > > > > I will correct the style of the comment. > > > >> > +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ > >> > + > >> > static int sd_srv_version; > >> > static int ts_srv_version; > >> > static int hb_srv_version; > >> > static int util_fw_version; > >> > > >> > +/*host sends time sample for every 5s.So the initial polling > >> > +interval *is 5s. > >> > +*/ > >> > +static s32 adj_interval = 1; > >> > >> Prefer mundane types instead there is a reason. This should be int > >> because it's not specified in a hardware spec. I know you are being > >> consistent with the surrounding code, but the surrounding code is bad so > don't emulate it. > >> > > I agree with you. Maybe it's a good idea to correct the surrounding > > code in another patch. > > > >> > + > >> > +/*The host_time_sync module parameter is used to control the time > >> > + sync between host and guest. > >> > +*/ > >> > +static bool host_time_sync; > >> > +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); > >> > +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with > >> host"); > >> > >> Maybe say: "Synchronize time with the host"? > > > > Sounds good. > > > >> > >> > + > >> > static void shutdown_onchannelcallback(void *context); static > >> > struct hv_util_service util_shutdown = { > >> > .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ > >> static > >> > void shutdown_onchannelcallback(void *context) > >> > /* > >> > * Set guest time to host UTC time. > >> > */ > >> > -static inline void do_adj_guesttime(u64 hosttime) > >> > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) > >> > >> I'm surprise checkpatch.pl does't complain about this CamelCase. > > > > I've run the scripts/checkpatch.pl, it didn't complain anything. I'll > > chan
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Richard Cochran [mailto:richardcoch...@gmail.com] > Sent: Tuesday, October 14, 2014 9:20 PM > To: Thomas Shao > Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > On Tue, Oct 14, 2014 at 01:04:35PM +, Thomas Shao wrote: > > > > + /* > > > > + * Use the Hyper-V time sample to adjust the guest time. > > > > The > > > > + * algorithm is: If the sample offsets exceeds 1 second, > > > > we > > > > + * directly set the clock to the server time. If the > > > > offset is > > > > > > So the guests will experience random time jumps in the kernel, > > > without any rhyme or reason? > > > > This behavior is designed for some extreme cases. Like manually > > setting guest time to some value. Or the host resumes from a hibernate > > state. Normally, we should not run into this. > > But when it *does* happen, the guest software will have no way of knowing > what happened. That stinks. > > Taking your example, when the guest sets its time, the time will suddenly > jump somewhere else, and for no apparent reason. > > From the guest's point of view, this is really not acceptable. > If the user chooses to sync guest time with host, that's the expected behavior, right? > Thanks, > Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
> -Original Message- > From: Richard Cochran [mailto:richardcoch...@gmail.com] > Sent: Tuesday, October 14, 2014 9:26 PM > To: Thomas Shao > Cc: t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Subject: Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host > time sample > > On Tue, Oct 14, 2014 at 01:04:35PM +, Thomas Shao wrote: > > > I really don't see the need for this. We have NTP. If the guests > > > want to, they may use it. Otherwise, they have a free running clock, just > like real machines. > > > > > Sometimes the user can't setup NTP. For example the guest OS didn't > > have network connection. And in some cases, they may want the guest > time sync with host. > > With the existing hyper-v time source, the system clock will has > > around 1.5 second time drift per day. If the workload in the host is heavy, > the number could be larger. > > So this feature is really useful for some scenarios. > > Any real machine without networking (and without GPS etc) will drift. That is > just life, tough as it is. Why should we treat these guests any differently > than > real machines? > > Furthermore, without networking you really don't have a compelling need > for correct absolute time in the first place. The host machine can be configure with NTP. And in this case, making guest time sync with host is useful. > > Thanks, > Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
Even with networking I think there are other senarios where this would be useful such as no access to an NTP server due to firewall rules or no internal NTP or simply an admin without much knowledge of NTP. HyperV host very likely has good time from AD and it would be good if the Linux VM just synced its time from the host after a vanilla install (just like windows VMs). That would require no configuration and probably save a ton of support traffic. However this patch requires a module parameter which really negates the zero configuration argument. Also please don't make this the default until the timesync component is more comprehensive and provides a stable time of similar quality to NTP. VMware has put a lot of effort into host -> guest timesync so I think there is a case for some form of host based time sync on HyperV. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 02:16:34PM +0100, Mike Surcouf wrote: > What is your expected value for TICK_USEC? I cant make the arithmetic work. > You double the check time if you are close but you never reduce the > check time if you are not. > Adjusting the tick count is a coarse adjustment of the clock. You > will end up chasing the host time but never stabilizing it. We should not be putting hardcoded servos into random drivers. Instead, why not export the time offset to the guest as a series of PPS samples, or the like? Then, a user space program in the guest can decide whether it will use the information and how to filter the signal. > Regarding the comment we have NTP for this I agree that would be > better than this implementation and I think Thomas agrees (as he said > NTP is the preferred option) > In order for this to be a good source of time for RTP and other time > sensitive stuff . you will have to have to re-implement parts of NTP > such as adjusting the clock frequency decreasing the check period when > error becomes too great etc. etc.. No, lets not re-implement NTP. That would be a waste of effort. Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
Maybe John Stultz should also go onto CC. Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 03:14:21PM +0100, Mike Surcouf wrote: > Even with networking I think there are other senarios where this would > be useful such as no access to an NTP server due to firewall rules or > no internal NTP or simply an admin without much knowledge of NTP. Perhaps, but ... > HyperV host very likely has good time from AD and it would be good if > the Linux VM just synced its time from the host after a vanilla > install (just like windows VMs). Just cause windows does it, doesn't make it a good idea. > That would require no configuration and probably save a ton of support > traffic. > However this patch requires a module parameter which really negates > the zero configuration argument. > Also please don't make this the default until the timesync component > is more comprehensive and provides a stable time of similar quality to > NTP. We really don't want to go there. > VMware has put a lot of effort into host -> guest timesync so I think > there is a case for some form of host based time sync on HyperV. Again, that is fine for VMware, but it might not be the best way. IMHO, you should let the guest steer its own clock. That gives the end user the most flexibility. Just provide the offset information, and let a dedicated service (like ntpd or linuxptp's phc2sys) do the rest. Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
Hi! VMware has put a lot of effort into host -> guest timesync so I think there is a case for some form of host based time sync on HyperV. . . . IMHO, you should let the guest steer its own clock. That gives the end user the most flexibility. No problem: Time Sync can be turn off in VM settings Best regards, Victor Miasnikov Blog: http://vvm.blog.tut.by/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, Oct 14, 2014 at 04:33:46PM +0200, Richard Cochran wrote: > > IMHO, you should let the guest steer its own clock. That gives the end > user the most flexibility. Just provide the offset information, and > let a dedicated service (like ntpd or linuxptp's phc2sys) do the rest. So if it really about the convenience of not having to run a service on the guests, then why not expose the guest clock to the host as a dynamic posix clock? Then you could use phc2sys to tune the guest without writing even a line of servo code... Thanks, Richard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
>The value for TICK_USEC is defined as ((100UL + USER_HZ/2) / USER_HZ). > In my box, it's 1. OK got it thanks . Checked the algorithm OK by me. Of course you can only adjust clock by a tick (smallest resolution) so you could be flapping between 2 values so as you say NTP is preferred. However it may be good enough for some scenarios. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/3] staging: comedi: usbduxsigma: updated contact details and status
On Friday, October 10, 2014 12:33 PM, Bernd Porr wrote: > > I've updated my contact details of the driver. I've also tested it > thoroughly and it works perfectly. I've changed the status to stable. > > Signed-off-by: Bernd Porr Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/3] staging: comedi: usbdux: updated contact details / comments
On Friday, October 10, 2014 12:34 PM, Bernd Porr wrote: > > I've updated my contact details and removed obsolete comments. > > Signed-off-by: Bernd Porr Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/3] staging: comedi: usbduxfast: updated address details
On Friday, October 10, 2014 12:35 PM, Bernd Porr wrote: > > Updated the range of years, e-mail and added driver desription as > usually done in comedi. > > Signed-off-by: Bernd Porr Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] staging: comedi: (regression) channel list must be set for COMEDI_CMD ioctl
On Thursday, October 09, 2014 2:03 AM, Ian Abbott wrote: > On 09/10/14 00:13, Hartley Sweeten wrote: >> On Wednesday, October 08, 2014 8:09 AM, Ian Abbott wrote: >>> `do_cmd_ioctl()`, the handler for the `COMEDI_CMD` ioctl can incorrectly >>> call the Comedi subdevice's `do_cmd()` handler with a NULL channel list >>> pointer. This is a regression as the `do_cmd()` handler has never been >>> expected to deal with that, leading to a kernel OOPS when it tries to >>> dereference it. >>> >>> A NULL channel list pointer is allowed for the `COMEDI_CMDTEST` ioctl, >>> handled by `do_cmdtest_ioctl()` and the subdevice's `do_cmdtest()` >>> handler, but not for the `COMEDI_CMD` ioctl and its handlers. >>> >>> Both `do_cmd_ioctl()` and `do_cmdtest_ioctl()` call >>> `__comedi_get_user_chanlist()` to copy the channel list from user memory >>> into dynamically allocated kernel memory and check it for consistency. >>> That function currently returns 0 if the `user_chanlist` parameter >>> (pointing to the channel list in user memory) is NULL. That's fine for >>> `do_cmdtest_ioctl()`, but `do_cmd_ioctl()` incorrectly assumes the >>> kernel copy of the channel list has been set-up correctly. >>> >>> Fix it by not allowing the `user_chanlist` parameter to be NULL in >>> `__comedi_get_user_chanlist()`, and only calling it from >>> `do_cmdtest_ioctl()` if the parameter is non-NULL. >>> >>> Thanks to Bernd Porr for reporting the bug via an initial patch sent >>> privately. >>> >>> Fixes: c6cd0eefb27b ("staging: comedi: comedi_fops: introduce >>> __comedi_get_user_chanlist()") >>> Reported-by: Bernd Porr >>> Signed-off-by: Ian Abbott >>> Cc: Bernd Porr >>> Cc: # 3.15.y 3.16.y 3.17.y >>> --- >>> drivers/staging/comedi/comedi_fops.c | 15 +++ >>> 1 file changed, 7 insertions(+), 8 deletions(-) >>> >>> diff --git a/drivers/staging/comedi/comedi_fops.c >>> b/drivers/staging/comedi/comedi_fops.c >>> index 495969f..a9b7fe5 100644 >>> --- a/drivers/staging/comedi/comedi_fops.c >>> +++ b/drivers/staging/comedi/comedi_fops.c >>> @@ -1462,10 +1462,6 @@ static int __comedi_get_user_chanlist(struct >>> comedi_device *dev, >>> unsigned int *chanlist; >>> int ret; >>> >>> - /* user_chanlist could be NULL for do_cmdtest ioctls */ >>> - if (!user_chanlist) >>> - return 0; >>> - >> >> I think you need a check here to avoid a NULL pointer getting >> passed to the memdup_user(). >> >> If (!user_chanlist || cmd->chanlist_len == 0) >> return -EINVAL; >> >>> chanlist = memdup_user(user_chanlist, >>>cmd->chanlist_len * sizeof(unsigned int)); >>> if (IS_ERR(chanlist)) > > It's fine to pass a NULL pointer to memdup_user(). It won't succeed > (returning ERR_PTR(-EFAULT)), but it's fine. Ah. OK. Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/3] staging: comedi: usbduxfast: updated address details
On Tuesday, October 14, 2014 9:51 AM, Hartley Sweeten wrote: > On Friday, October 10, 2014 12:35 PM, Bernd Porr wrote: >> >> Updated the range of years, e-mail and added driver desription as >> usually done in comedi. >> >> Signed-off-by: Bernd Porr > > Reviewed-by: H Hartley Sweeten Bernd, Oops, this patch has trailing whitespace. Could you fix that please? Regards, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 0/3] staging: comedi: cb_pcimdas: support PCIe-DAS1602/16
On Monday, October 13, 2014 5:41 AM, Ian Abbott wrote: > Fix up the block comment style and add support for the PCIe-DAS1602/16. > This is the PCI-Express version of the PCIM-DAS1602/16 and is software > compatible with it, apart from a different PCI device ID. > > 1) staging: comedi: cb_pcimdas: use preferred block comment style > 2) staging: comedi: cb_pcimdas: update driver comment > 3) staging: comedi: cb_pcimdas: add support for PCIe-DAS1602/16 > > drivers/staging/comedi/Kconfig | 4 +- > drivers/staging/comedi/drivers/cb_pcimdas.c | 82 > - > 2 files changed, 46 insertions(+), 40 deletions(-) Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] staging: comedi: drivers: comedi_bond.c: Changed from using strncat to strlcat
On Sunday, October 12, 2014 5:23 AM, Rickard Strandqvist wrote: > > Changed from using strncat to strlcat to simplify the code > > Signed-off-by: Rickard Strandqvist > --- > drivers/staging/comedi/drivers/comedi_bond.c |6 ++ > 1 file changed, 2 insertions(+), 4 deletions(-) > > diff --git a/drivers/staging/comedi/drivers/comedi_bond.c > b/drivers/staging/comedi/drivers/comedi_bond.c > index 8450c99..5d19861 100644 > --- a/drivers/staging/comedi/drivers/comedi_bond.c > +++ b/drivers/staging/comedi/drivers/comedi_bond.c > @@ -262,12 +262,10 @@ static int do_dev_config(struct comedi_device *dev, > struct comedi_devconfig *it) > { > /* Append dev:subdev to devpriv->name */ > char buf[20]; > - int left = > - MAX_BOARD_NAME - strlen(devpriv->name) - 1; > snprintf(buf, sizeof(buf), "%u:%u ", >bdev->minor, bdev->subdev); > - buf[sizeof(buf) - 1] = 0; >- strncat(devpriv->name, buf, left); > + strlcat(devpriv->name, buf, > + sizeof(devpriv->name)); > } > > } Reviewed-by: H Hartley Sweeten ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: comedi: addi_apci_3200: remove driver
On 14/10/14 18:11, H Hartley Sweeten wrote: This driver has some serious bitrot. In addition, it's not in the Kconfig or Makefile so it can't even be built. Just remove it. It would be easier to rewrite the driver than fix it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3200.c | 3002 drivers/staging/comedi/drivers/addi_apci_3200.c| 125 - 2 files changed, 3127 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/addi-data/hwdrv_apci3200.c delete mode 100644 drivers/staging/comedi/drivers/addi_apci_3200.c Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 22/34] staging: comedi: addi_common.h: remove boardinfo definition
The addi_board definition is not only used by the addi_apci_3120 driver. Introduce a private definition in that driver and remove the global definition from addi_common.h. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.h | 20 drivers/staging/comedi/drivers/addi_apci_3120.c | 17 +++-- 2 files changed, 15 insertions(+), 22 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 5518332..28aec3f 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -18,26 +18,6 @@ #include #include -struct addi_board { - const char *name; - char *pc_EepromChip;/* type of chip */ - int i_NbrAiChannel; /* num of A/D chans */ - int i_NbrAiChannelDiff; /* num of A/D chans in diff mode */ - int i_AiChannelList;/* len of chanlist */ - int i_NbrAoChannel; /* num of D/A chans */ - int i_AiMaxdata;/* resolution of A/D */ - int i_AoMaxdata;/* resolution of D/A */ - const struct comedi_lrange *pr_AiRangelist; /* rangelist for A/D */ - - int i_NbrDiChannel; /* Number of DI channels */ - int i_NbrDoChannel; /* Number of DO channels */ - int i_DoMaxdata;/* data to set all channels high */ - - int i_Timer;/*timer subdevice present or not */ - unsigned int ui_MinAcquisitiontimeNs; /* Minimum Acquisition in Nano secs */ - unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */ -}; - struct addi_private { int iobase; int i_IobaseAmcc; /* base+size for AMCC chip */ diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 1fa53cf..ae81fdb 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -14,7 +14,20 @@ enum apci3120_boardid { BOARD_APCI3001, }; -static const struct addi_board apci3120_boardtypes[] = { +struct apci3120_board { + const char *name; + int i_NbrAiChannel; + int i_NbrAiChannelDiff; + int i_AiChannelList; + int i_NbrAoChannel; + int i_AiMaxdata; + int i_AoMaxdata; + int i_NbrDiChannel; + int i_NbrDoChannel; + int i_DoMaxdata; +}; + +static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { .name = "apci3120", .i_NbrAiChannel = 16, @@ -43,7 +56,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct addi_board *this_board = NULL; + const struct apci3120_board *this_board = NULL; struct addi_private *devpriv; struct comedi_subdevice *s; int ret, order, i; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/34] staging: comedi: addi_apci_035: remove unnecessary subdevice initialization
The subdevices that don't initialize any of the callbacks don't really exist. Remove the unnecessary initialzation and just set the type to COMEDI_SUBD_UNUSED. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_035.c | 38 -- 1 file changed, 5 insertions(+), 33 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index c9cd68c..f2cc95a 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -145,43 +145,15 @@ static int apci035_auto_attach(struct comedi_device *dev, /* Allocate and Initialise AO Subdevice Structures */ s = &dev->subdevices[1]; - if (devpriv->s_EeParameters.i_NbrAoChannel) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrAoChannel; - s->maxdata = devpriv->s_EeParameters.i_AoMaxdata; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrAoChannel; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_UNUSED; + /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[2]; - if (devpriv->s_EeParameters.i_NbrDiChannel) { - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrDiChannel; - s->maxdata = 1; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrDiChannel; - s->range_table = &range_digital; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_UNUSED; + /* Allocate and Initialise DO Subdevice Structures */ s = &dev->subdevices[3]; - if (devpriv->s_EeParameters.i_NbrDoChannel) { - s->type = COMEDI_SUBD_DO; - s->subdev_flags = - SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrDoChannel; - s->maxdata = devpriv->s_EeParameters.i_DoMaxdata; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrDoChannel; - s->range_table = &range_digital; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_UNUSED; /* Allocate and Initialise Timer Subdevice Structures */ s = &dev->subdevices[4]; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/34] staging: comedi: addi_common.h: rename boardinfo 'pc_DriverName'
Rename this CamelCase member of the boardinfo. The comedi_device 'board_name' is set to this member during the (*auto_attach) of the addi-data that still use this boardinfo drivers. For aesthetics, use the dev->board_name instead of the boardinfo in the drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.h| 2 +- drivers/staging/comedi/drivers/addi-data/addi_eeprom.c| 2 +- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 12 drivers/staging/comedi/drivers/addi_apci_035.c| 4 ++-- drivers/staging/comedi/drivers/addi_apci_1500.c | 4 ++-- drivers/staging/comedi/drivers/addi_apci_3120.c | 6 +++--- 6 files changed, 13 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index b757f46..9def296 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -19,7 +19,7 @@ #include struct addi_board { - const char *pc_DriverName; /* driver name */ + const char *name; int i_IorangeBase1; int i_PCIEeprom;/* eeprom present or not */ char *pc_EepromChip;/* type of chip */ diff --git a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c index b731856..4e3d5ed 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c @@ -287,7 +287,7 @@ static void addi_eeprom_read_ai_info(struct comedi_device *dev, /* No of channels for 1st hard component */ tmp = addi_eeprom_readw(iobase, type, addr + 10); devpriv->s_EeParameters.i_NbrAiChannel = (tmp >> 4) & 0x3ff; - if (!strcmp(this_board->pc_DriverName, "apci3200")) + if (!strcmp(dev->board_name, "apci3200")) devpriv->s_EeParameters.i_NbrAiChannel *= 4; tmp = addi_eeprom_readw(iobase, type, addr + 16); diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index ed1d92e..d764356 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -351,7 +351,6 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv = dev->private; unsigned short us_ConvertTiming, us_TmpValue, i; unsigned char b_Tmp; @@ -382,7 +381,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, /* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */ if ((us_TmpValue & 0x00B0) == 0x00B0 - || !strcmp(this_board->pc_DriverName, "apci3001")) { + || !strcmp(dev->board_name, "apci3001")) { us_ConvertTiming = (us_ConvertTiming * 2) - 2; } else { us_ConvertTiming = @@ -781,7 +780,6 @@ static int apci3120_cyclic_ai(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned char b_Tmp; @@ -838,7 +836,7 @@ static int apci3120_cyclic_ai(int mode, /* EL241003 Begin: add this section to replace floats calculation by integer calculations */ /* EL250804: Testing if board APCI3120 have the new Quartz or if it is an APCI3001 */ if ((us_TmpValue & 0x00B0) == 0x00B0 - || !strcmp(this_board->pc_DriverName, "apci3001")) { + || !strcmp(dev->board_name, "apci3001")) { ui_TimerValue0 = ui_ConvertTiming * 2 - 2000; ui_TimerValue0 = ui_TimerValue0 / 1000; @@ -1604,7 +1602,6 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv = dev->private; unsigned int ui_Timervalue2; unsigned short us_TmpValue; @@ -1624,7 +1621,7 @@ static int apci3120_config_insn_timer(struct comedi_device *dev, * is an APCI3001 and calculate the time value to set in the timer */ if ((us_TmpValue & 0x00B0) == 0x00B0 - || !strcmp(this_board->pc_DriverName, "apci3001")) { + || !strcmp(dev->boar
[PATCH 21/34] staging: comedi: hwdrv_apci3120: remove need for boardinfo access
The apci3120_ai_insn_config() function is broken in this driver. It does not follow the comedi API and will fail to work correctly. For now just remove the need for the boardinfo access to allow additional cleanup. The 'i_NbrAiChannel' is actually the subdevice 'n_chan' use that instead and remove the boardinfo access. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index d764356..e120d62 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -246,7 +246,6 @@ static int apci3120_ai_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv = dev->private; unsigned int i; @@ -261,8 +260,7 @@ static int apci3120_ai_insn_config(struct comedi_device *dev, /* Test the number of the channel */ for (i = 0; i < data[3]; i++) { - if (CR_CHAN(data[4 + i]) >= - this_board->i_NbrAiChannel) { + if (CR_CHAN(data[4 + i]) >= s->n_chan) { dev_err(dev->class_dev, "bad channel list\n"); return -2; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 14/34] staging: comedi: addi_common.h: remove boardinfo 'i_IorangeBase1'
This member of the boardinfo is used as a flag to determine what PCI BAR to use for the main 'iobase' used by the driver. Remove the boardinfo member and refactor the (*auto_attach) of the drivers to use the correct PCI BAR. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.h | 1 - drivers/staging/comedi/drivers/addi_apci_035.c | 7 +-- drivers/staging/comedi/drivers/addi_apci_1500.c| 7 +-- 3 files changed, 2 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 9def296..0752a61 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -20,7 +20,6 @@ struct addi_board { const char *name; - int i_IorangeBase1; int i_PCIEeprom;/* eeprom present or not */ char *pc_EepromChip;/* type of chip */ int i_NbrAiChannel; /* num of A/D chans */ diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index a5e3d32..a197f64 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -15,7 +15,6 @@ static const struct addi_board apci035_boardtypes[] = { { .name = "apci035", - .i_IorangeBase1 = APCI035_ADDRESS_RANGE, .i_PCIEeprom= 1, .pc_EepromChip = "S5920", .i_NbrAiChannel = 16, @@ -67,11 +66,7 @@ static int apci035_auto_attach(struct comedi_device *dev, if (ret) return ret; - if (this_board->i_IorangeBase1) - dev->iobase = pci_resource_start(pcidev, 1); - else - dev->iobase = pci_resource_start(pcidev, 0); - + dev->iobase = pci_resource_start(pcidev, 1); devpriv->iobase = dev->iobase; devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0); devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 03e65a1..c69510b 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -13,7 +13,6 @@ static const struct addi_board apci1500_boardtypes[] = { { .name = "apci1500", - .i_IorangeBase1 = APCI1500_ADDRESS_RANGE, .i_PCIEeprom= 0, .i_NbrDiChannel = 16, .i_NbrDoChannel = 16, @@ -60,11 +59,7 @@ static int apci1500_auto_attach(struct comedi_device *dev, if (ret) return ret; - if (this_board->i_IorangeBase1) - dev->iobase = pci_resource_start(pcidev, 1); - else - dev->iobase = pci_resource_start(pcidev, 0); - + dev->iobase = pci_resource_start(pcidev, 1); devpriv->iobase = dev->iobase; devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0); devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/34] staging: comedi: addi_apci_1500: remove subdevice callbacks from boardinfo
This driver only has one boardinfo entry so the subdevice callbacks are always the same. Remvoe the callbacks from the boardinfo and use them directly when initializing the subdevices. Remove all the subdevice callback initialization that would be set to NULL. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 47 ++--- 1 file changed, 11 insertions(+), 36 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index a68840e..d6d2e67 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -19,17 +19,6 @@ static const struct addi_board apci1500_boardtypes[] = { .i_NbrDoChannel = 16, .i_DoMaxdata= 0x, .i_Timer= 1, - .di_config = apci1500_di_config, - .di_read= apci1500_di_read, - .di_write = apci1500_di_write, - .di_bits= apci1500_di_insn_bits, - .do_config = apci1500_do_config, - .do_write = apci1500_do_write, - .do_bits= apci1500_do_bits, - .timer_config = apci1500_timer_config, - .timer_write= apci1500_timer_write, - .timer_read = apci1500_timer_read, - .timer_bits = apci1500_timer_bits, }, }; @@ -141,15 +130,6 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; s->len_chanlist = this_board->i_AiChannelList; s->range_table = this_board->pr_AiRangelist; - - s->insn_config = this_board->ai_config; - s->insn_read = this_board->ai_read; - s->insn_write = this_board->ai_write; - s->insn_bits = this_board->ai_bits; - s->do_cmdtest = this_board->ai_cmdtest; - s->do_cmd = this_board->ai_cmd; - s->cancel = this_board->ai_cancel; - } else { s->type = COMEDI_SUBD_UNUSED; } @@ -163,7 +143,6 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->maxdata = devpriv->s_EeParameters.i_AoMaxdata; s->len_chanlist = devpriv->s_EeParameters.i_NbrAoChannel; - s->insn_write = this_board->ao_write; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -177,10 +156,10 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel; s->range_table = &range_digital; - s->insn_config = this_board->di_config; - s->insn_read = this_board->di_read; - s->insn_write = this_board->di_write; - s->insn_bits = this_board->di_bits; + s->insn_config = apci1500_di_config; + s->insn_read = apci1500_di_read; + s->insn_write = apci1500_di_write; + s->insn_bits = apci1500_di_insn_bits; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -195,12 +174,9 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDoChannel; s->range_table = &range_digital; - - /* insn_config - for digital output memory */ - s->insn_config = this_board->do_config; - s->insn_write = this_board->do_write; - s->insn_bits = this_board->do_bits; - s->insn_read = this_board->do_read; + s->insn_config = apci1500_do_config; + s->insn_write = apci1500_do_write; + s->insn_bits = apci1500_do_bits; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -214,11 +190,10 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->maxdata = 0; s->len_chanlist = 1; s->range_table = &range_digital; - - s->insn_write = this_board->timer_write; - s->insn_read = this_board->timer_read; - s->insn_config = this_board->timer_config; - s->insn_bits = this_board->timer_bits; + s->insn_write = apci1500_timer_write; + s->insn_read = apci1500_timer_read; + s->insn_config = apci1500_timer_config; + s->insn_bits = apci1500_timer_bits; } else { s->type = COMEDI_SUBD_UNUSED; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.
[PATCH 02/34] staging: comedi: addi_common.c: remove i_ADDI_Reset()
The addi_apci_035 and addi_apci_1500 are the only drivers left that use this function in addi_common.c. The function simply calls the 'reset' function that is in the boardinfo of the driver. Both drivers use the same 'reset' function for all boardnfo entries. Remove the i_ADDI_Reset() function as well as the 'reset' boardinfo and just call the 'reset' function directly. The i_ADDI_Reset() is called by addi_auto_attach() in addi_common.c after a sucessful attach. Modify the (*auto_attach) in the drivers to call the 'reset' function directly and remove it from addi_auto_attach(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.c | 9 - drivers/staging/comedi/drivers/addi_apci_035.c | 13 ++--- drivers/staging/comedi/drivers/addi_apci_1500.c| 13 ++--- 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 51574a8..d0bd812 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -65,14 +65,6 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d) return IRQ_RETVAL(1); } -static int i_ADDI_Reset(struct comedi_device *dev) -{ - const struct addi_board *this_board = dev->board_ptr; - - this_board->reset(dev); - return 0; -} - static int addi_auto_attach(struct comedi_device *dev, unsigned long context_unused) { @@ -262,6 +254,5 @@ static int addi_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - i_ADDI_Reset(dev); return 0; } diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index b06fde1..dd28adb 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -28,7 +28,6 @@ static const struct addi_board apci035_boardtypes[] = { .ui_MinAcquisitiontimeNs = 1, .ui_MinDelaytimeNs = 10, .interrupt = apci035_interrupt, - .reset = apci035_reset, .ai_config = apci035_ai_config, .ai_read= apci035_ai_read, .timer_config = apci035_timer_config, @@ -40,15 +39,23 @@ static const struct addi_board apci035_boardtypes[] = { static int apci035_auto_attach(struct comedi_device *dev, unsigned long context) { + int ret; + dev->board_ptr = &apci035_boardtypes[0]; - return addi_auto_attach(dev, context); + ret = addi_auto_attach(dev, context); + if (ret) + return ret; + + apci035_reset(dev); + + return 0; } static void apci035_detach(struct comedi_device *dev) { if (dev->iobase) - i_ADDI_Reset(dev); + apci035_reset(dev); comedi_pci_detach(dev); } diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 50a147f..d4b4261 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -21,7 +21,6 @@ static const struct addi_board apci1500_boardtypes[] = { .i_DoMaxdata= 0x, .i_Timer= 1, .interrupt = apci1500_interrupt, - .reset = apci1500_reset, .di_config = apci1500_di_config, .di_read= apci1500_di_read, .di_write = apci1500_di_write, @@ -39,15 +38,23 @@ static const struct addi_board apci1500_boardtypes[] = { static int apci1500_auto_attach(struct comedi_device *dev, unsigned long context) { + int ret; + dev->board_ptr = &apci1500_boardtypes[0]; - return addi_auto_attach(dev, context); + ret = addi_auto_attach(dev, context); + if (ret) + return ret; + + apci1500_reset(dev); + + return 0; } static void apci1500_detach(struct comedi_device *dev) { if (dev->iobase) - i_ADDI_Reset(dev); + apci1500_reset(dev); comedi_pci_detach(dev); } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/34] staging: comedi: addi_apci_1500: remove unnecessary subdevice initialization
The subdevices that don't initialize any of the callbacks don't really exist. Remove the unnecessary initialzation and just set the type to COMEDI_SUBD_UNUSED. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 28 ++--- 1 file changed, 2 insertions(+), 26 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index d6d2e67..13b31ab 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -116,36 +116,12 @@ static int apci1500_auto_attach(struct comedi_device *dev, /* Allocate and Initialise AI Subdevice Structures */ s = &dev->subdevices[0]; - if ((devpriv->s_EeParameters.i_NbrAiChannel) - || (this_board->i_NbrAiChannelDiff)) { - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = - SDF_READABLE | SDF_COMMON | SDF_GROUND - | SDF_DIFF; - if (devpriv->s_EeParameters.i_NbrAiChannel) - s->n_chan = devpriv->s_EeParameters.i_NbrAiChannel; - else - s->n_chan = this_board->i_NbrAiChannelDiff; - s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; - s->len_chanlist = this_board->i_AiChannelList; - s->range_table = this_board->pr_AiRangelist; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_UNUSED; /* Allocate and Initialise AO Subdevice Structures */ s = &dev->subdevices[1]; - if (devpriv->s_EeParameters.i_NbrAoChannel) { - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrAoChannel; - s->maxdata = devpriv->s_EeParameters.i_AoMaxdata; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrAoChannel; - } else { s->type = COMEDI_SUBD_UNUSED; - } + /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[2]; if (devpriv->s_EeParameters.i_NbrDiChannel) { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/34] staging: comedi: addi_common.c: remove addi_auto_attach()
The addi_apci_035 and addi_apci_1500 are the only drivers left that use this function in addi_common.c. The addi_common code adds a lot of bloat to the drivers. Copy the addi_auto_attach() code to the (*auto_attach) functions of the drivers and remove the function. This will help with removing the bloat. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.c | 192 - drivers/staging/comedi/drivers/addi_apci_035.c | 180 ++- drivers/staging/comedi/drivers/addi_apci_1500.c| 180 ++- 3 files changed, 358 insertions(+), 194 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index d0bd812..850bdae 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -64,195 +64,3 @@ static irqreturn_t v_ADDI_Interrupt(int irq, void *d) this_board->interrupt(irq, d); return IRQ_RETVAL(1); } - -static int addi_auto_attach(struct comedi_device *dev, - unsigned long context_unused) -{ - struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct addi_board *this_board = dev->board_ptr; - struct addi_private *devpriv; - struct comedi_subdevice *s; - int ret, n_subdevices; - unsigned int dw_Dummy; - - dev->board_name = this_board->pc_DriverName; - - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - - ret = comedi_pci_enable(dev); - if (ret) - return ret; - - if (this_board->i_IorangeBase1) - dev->iobase = pci_resource_start(pcidev, 1); - else - dev->iobase = pci_resource_start(pcidev, 0); - - devpriv->iobase = dev->iobase; - devpriv->i_IobaseAmcc = pci_resource_start(pcidev, 0); - devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); - devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); - - /* Initialize parameters that can be overridden in EEPROM */ - devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel; - devpriv->s_EeParameters.i_NbrAoChannel = this_board->i_NbrAoChannel; - devpriv->s_EeParameters.i_AiMaxdata = this_board->i_AiMaxdata; - devpriv->s_EeParameters.i_AoMaxdata = this_board->i_AoMaxdata; - devpriv->s_EeParameters.i_NbrDiChannel = this_board->i_NbrDiChannel; - devpriv->s_EeParameters.i_NbrDoChannel = this_board->i_NbrDoChannel; - devpriv->s_EeParameters.i_DoMaxdata = this_board->i_DoMaxdata; - devpriv->s_EeParameters.i_Timer = this_board->i_Timer; - devpriv->s_EeParameters.ui_MinAcquisitiontimeNs = - this_board->ui_MinAcquisitiontimeNs; - devpriv->s_EeParameters.ui_MinDelaytimeNs = - this_board->ui_MinDelaytimeNs; - - /* ## */ - - if (pcidev->irq > 0) { - ret = request_irq(pcidev->irq, v_ADDI_Interrupt, IRQF_SHARED, - dev->board_name, dev); - if (ret == 0) - dev->irq = pcidev->irq; - } - - /* Read eepeom and fill addi_board Structure */ - - if (this_board->i_PCIEeprom) { - if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { - /* Set 3 wait stait */ - if (!(strcmp(dev->board_name, "apci035"))) - outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); - else - outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - - /* Enable the interrupt for the controller */ - dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); - outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); - } - addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); - } - - n_subdevices = 7; - ret = comedi_alloc_subdevices(dev, n_subdevices); - if (ret) - return ret; - - /* Allocate and Initialise AI Subdevice Structures */ - s = &dev->subdevices[0]; - if ((devpriv->s_EeParameters.i_NbrAiChannel) - || (this_board->i_NbrAiChannelDiff)) { - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = - SDF_READABLE | SDF_COMMON | SDF_GROUND - | SDF_DIFF; - if (devpriv->s_EeParameters.i_NbrAiChannel) - s->n_chan = devpriv->s_EeParameters.i_NbrAiChannel; - else - s->n_chan = this_board->i_NbrAiChannelDiff; - s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; - s->len_chanlist = this_board->i_AiChannelList; -
[PATCH 29/34] staging: comedi: addi_apci_3120: simplify analog output boardinfo
There are two boards supported by this driver. One with eight 14-bit analog outputs and the other without analog outputs. Add a bit field flag, 'has_ao', to the boardinfo and remove the 'i_NbrAoChannel' and 'i_AoMaxdata' members. Use the new flag to determine if the analog output subdevice needs to be initialized and open code the n_chan and maxdata. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index d555427..de1dabf 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -16,17 +16,15 @@ enum apci3120_boardid { struct apci3120_board { const char *name; - int i_NbrAoChannel; int i_AiMaxdata; - int i_AoMaxdata; + unsigned int has_ao:1; }; static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { .name = "apci3120", - .i_NbrAoChannel = 8, .i_AiMaxdata= 0x, - .i_AoMaxdata= 0x3fff, + .has_ao = 1, }, [BOARD_APCI3001] = { .name = "apci3001", @@ -117,12 +115,11 @@ static int apci3120_auto_attach(struct comedi_device *dev, /* Allocate and Initialise AO Subdevice Structures */ s = &dev->subdevices[1]; - if (this_board->i_NbrAoChannel) { + if (this_board->has_ao) { s->type = COMEDI_SUBD_AO; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = this_board->i_NbrAoChannel; - s->maxdata = this_board->i_AoMaxdata; - s->len_chanlist = this_board->i_NbrAoChannel; + s->n_chan = 8; + s->maxdata = 0x3fff; s->range_table = &range_apci3120_ao; s->insn_write = apci3120_ao_insn_write; } else { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 18/34] staging: comedi: addi_apci_1500: remove boardinfo
The hardware does not have an eeprom so the 's_EeParameters' use is not necessary. Remove it. Since the boardinfo only has one entry its not really necessary. Remove it and initialize the subdevices directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 103 +++- 1 file changed, 29 insertions(+), 74 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 7c32c85..dc90a8f 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -9,28 +9,14 @@ #include "addi-data/hwdrv_apci1500.c" -static const struct addi_board apci1500_boardtypes[] = { - { - .name = "apci1500", - .i_NbrDiChannel = 16, - .i_NbrDoChannel = 16, - .i_DoMaxdata= 0x, - .i_Timer= 1, - }, -}; - static int apci1500_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv; struct comedi_subdevice *s; int ret; - dev->board_ptr = &apci1500_boardtypes[0]; - dev->board_name = this_board->name; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); if (!devpriv) return -ENOMEM; @@ -45,22 +31,6 @@ static int apci1500_auto_attach(struct comedi_device *dev, devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); - /* Initialize parameters that can be overridden in EEPROM */ - devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel; - devpriv->s_EeParameters.i_NbrAoChannel = this_board->i_NbrAoChannel; - devpriv->s_EeParameters.i_AiMaxdata = this_board->i_AiMaxdata; - devpriv->s_EeParameters.i_AoMaxdata = this_board->i_AoMaxdata; - devpriv->s_EeParameters.i_NbrDiChannel = this_board->i_NbrDiChannel; - devpriv->s_EeParameters.i_NbrDoChannel = this_board->i_NbrDoChannel; - devpriv->s_EeParameters.i_DoMaxdata = this_board->i_DoMaxdata; - devpriv->s_EeParameters.i_Timer = this_board->i_Timer; - devpriv->s_EeParameters.ui_MinAcquisitiontimeNs = - this_board->ui_MinAcquisitiontimeNs; - devpriv->s_EeParameters.ui_MinDelaytimeNs = - this_board->ui_MinDelaytimeNs; - - /* ## */ - if (pcidev->irq > 0) { ret = request_irq(pcidev->irq, apci1500_interrupt, IRQF_SHARED, dev->board_name, dev); @@ -74,55 +44,40 @@ static int apci1500_auto_attach(struct comedi_device *dev, /* Allocate and Initialise DI Subdevice Structures */ s = &dev->subdevices[0]; - if (devpriv->s_EeParameters.i_NbrDiChannel) { - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrDiChannel; - s->maxdata = 1; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrDiChannel; - s->range_table = &range_digital; - s->insn_config = apci1500_di_config; - s->insn_read = apci1500_di_read; - s->insn_write = apci1500_di_write; - s->insn_bits = apci1500_di_insn_bits; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; + s->n_chan = 16; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_config = apci1500_di_config; + s->insn_read = apci1500_di_read; + s->insn_write = apci1500_di_write; + s->insn_bits = apci1500_di_insn_bits; + /* Allocate and Initialise DO Subdevice Structures */ s = &dev->subdevices[1]; - if (devpriv->s_EeParameters.i_NbrDoChannel) { - s->type = COMEDI_SUBD_DO; - s->subdev_flags = - SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = devpriv->s_EeParameters.i_NbrDoChannel; - s->maxdata = devpriv->s_EeParameters.i_DoMaxdata; - s->len_chanlist = - devpriv->s_EeParameters.i_NbrDoChannel; - s->range_table = &range_digital; - s->insn_config = apci1500_do_config; - s->insn_write = apci1500_do_write; - s->insn_bits = apci1500_do_bits; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_DO; + s->subdev_flags = + SDF_RE
[PATCH 20/34] staging: comedi: addi_eeprom: remove source file
This source file is no longer included by any of the addi-data drivers. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_eeprom.c | 360 - 1 file changed, 360 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_eeprom.c diff --git a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c b/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c deleted file mode 100644 index 4e3d5ed..000 --- a/drivers/staging/comedi/drivers/addi-data/addi_eeprom.c +++ /dev/null @@ -1,360 +0,0 @@ -/* - * addi_eeprom.c - ADDI EEPROM Module - * Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. - * Project manager: Eric Stolz - * - * ADDI-DATA GmbH - * Dieselstrasse 3 - * D-77833 Ottersweier - * Tel: +19(0)7223/9493-0 - * Fax: +49(0)7223/9493-92 - * http://www.addi-data.com - * i...@addi-data.com - * - * 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. - */ - -#include - -#define NVRAM_USER_DATA_START 0x100 - -#define NVCMD_BEGIN_READ (0x7 << 5) /* nvRam begin read command */ -#define NVCMD_LOAD_LOW (0x4 << 5) /* nvRam load low command */ -#define NVCMD_LOAD_HIGH(0x5 << 5) /* nvRam load high command */ - -#define EE93C76_CLK_BIT(1 << 0) -#define EE93C76_CS_BIT (1 << 1) -#define EE93C76_DOUT_BIT (1 << 2) -#define EE93C76_DIN_BIT(1 << 3) -#define EE93C76_READ_CMD (0x0180 << 4) -#define EE93C76_CMD_LEN13 - -#define EEPROM_DIGITALINPUT0 -#define EEPROM_DIGITALOUTPUT 1 -#define EEPROM_ANALOGINPUT 2 -#define EEPROM_ANALOGOUTPUT3 -#define EEPROM_TIMER 4 -#define EEPROM_WATCHDOG5 -#define EEPROM_TIMER_WATCHDOG_COUNTER 10 - -static void addi_eeprom_clk_93c76(unsigned long iobase, unsigned int val) -{ - outl(val & ~EE93C76_CLK_BIT, iobase); - udelay(100); - - outl(val | EE93C76_CLK_BIT, iobase); - udelay(100); -} - -static unsigned int addi_eeprom_cmd_93c76(unsigned long iobase, - unsigned int cmd, - unsigned char len) -{ - unsigned int val = EE93C76_CS_BIT; - int i; - - /* Toggle EEPROM's Chip select to get it out of Shift Register Mode */ - outl(val, iobase); - udelay(100); - - /* Send EEPROM command - one bit at a time */ - for (i = (len - 1); i >= 0; i--) { - if (cmd & (1 << i)) - val |= EE93C76_DOUT_BIT; - else - val &= ~EE93C76_DOUT_BIT; - - /* Write the command */ - outl(val, iobase); - udelay(100); - - addi_eeprom_clk_93c76(iobase, val); - } - return val; -} - -static unsigned short addi_eeprom_readw_93c76(unsigned long iobase, - unsigned short addr) -{ - unsigned short val = 0; - unsigned int cmd; - unsigned int tmp; - int i; - - /* Send EEPROM read command and offset to EEPROM */ - cmd = EE93C76_READ_CMD | (addr / 2); - cmd = addi_eeprom_cmd_93c76(iobase, cmd, EE93C76_CMD_LEN); - - /* Get the 16-bit value */ - for (i = 0; i < 16; i++) { - addi_eeprom_clk_93c76(iobase, cmd); - - tmp = inl(iobase); - udelay(100); - - val <<= 1; - if (tmp & EE93C76_DIN_BIT) - val |= 0x1; - } - - /* Toggle EEPROM's Chip select to get it out of Shift Register Mode */ - outl(0, iobase); - udelay(100); - - return val; -} - -static void addi_eeprom_nvram_wait(unsigned long iobase) -{ - unsigned char val; - - do { - val = inb(iobase + AMCC_OP_REG_MCSR_NVCMD); - } while (val & 0x80); -} - -static unsigned short addi_eeprom_readw_nvram(unsigned long iobase, - unsigned short addr) -{ - unsigned short val = 0; - unsigned char tmp; - unsigned char i; - - for (i = 0; i < 2; i++) { - /* Load the low 8 bit address */ - outb(NVCMD_LOAD_LOW, iobase + AMCC_OP_REG_MCSR_NVCMD); - addi_eeprom_nvram_wait(iobase); - outb((addr + i) & 0xff, iobase + AMCC_OP_REG_MCSR_NVDATA); -
[PATCH 23/34] staging: comedi: addi_common.h: remove unused members from addi_private
Remove all the unused members from the addi_private definition. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.h | 16 1 file changed, 16 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 28aec3f..52f35b4 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -49,20 +49,4 @@ struct addi_private { /* Pointer to the current process */ struct task_struct *tsk_Current; - - /* Parameters read from EEPROM overriding static board info */ - struct { - int i_NbrAiChannel; /* num of A/D chans */ - int i_NbrAoChannel; /* num of D/A chans */ - int i_AiMaxdata;/* resolution of A/D */ - int i_AoMaxdata;/* resolution of D/A */ - int i_NbrDiChannel; /* Number of DI channels */ - int i_NbrDoChannel; /* Number of DO channels */ - int i_DoMaxdata;/* data to set all channels high */ - int i_Timer;/* timer subdevice present or not */ - unsigned int ui_MinAcquisitiontimeNs; - /* Minimum Acquisition in Nano secs */ - unsigned int ui_MinDelaytimeNs; - /* Minimum Delay in Nano secs */ - } s_EeParameters; }; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/34] staging: comedi: addi_common.c: remove included source file
The addi_apci_035 and addi_apci_1500 are the only drivers left that include this source file. Copy the i_ADDIDATA_InsnReadEeprom() function from that file to those drivers and remove the addi_common.c file. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.c | 57 -- drivers/staging/comedi/drivers/addi_apci_035.c | 18 ++- drivers/staging/comedi/drivers/addi_apci_1500.c| 18 ++- 3 files changed, 34 insertions(+), 59 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_common.c diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c deleted file mode 100644 index 0143427..000 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ /dev/null @@ -1,57 +0,0 @@ -/** -@verbatim - -Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. - - ADDI-DATA GmbH - Dieselstrasse 3 - D-77833 Ottersweier - Tel: +19(0)7223/9493-0 - Fax: +49(0)7223/9493-92 - http://www.addi-data.com - i...@addi-data.com - -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. - -@endverbatim -*/ -/* - - +---+ - | (C) ADDI-DATA GmbH Dieselstrasse 3 D-77833 Ottersweier | - +---+ - | Tel : +49 (0) 7223/9493-0 | email: i...@addi-data.com | - | Fax : +49 (0) 7223/9493-92| Internet : http://www.addi-data.com | - +---+ - | Project : ADDI DATA | Compiler : GCC| - | Modulname : addi_common.c | Version : 2.96 | - +---+---+ - | Author: | Date :| - +---+ - | Description : ADDI COMMON Main Module | - +---+ -*/ - -static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, -unsigned int *data) -{ - const struct addi_board *this_board = dev->board_ptr; - struct addi_private *devpriv = dev->private; - unsigned short w_Address = CR_CHAN(insn->chanspec); - unsigned short w_Data; - - w_Data = addi_eeprom_readw(devpriv->i_IobaseAmcc, - this_board->pc_EepromChip, 2 * w_Address); - data[0] = w_Data; - - return insn->n; -} diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index a712cc5..fd7d3f1 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -11,7 +11,6 @@ #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci035.c" -#include "addi-data/addi_common.c" static const struct addi_board apci035_boardtypes[] = { { @@ -35,6 +34,23 @@ static const struct addi_board apci035_boardtypes[] = { }, }; +static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, +struct comedi_subdevice *s, +struct comedi_insn *insn, +unsigned int *data) +{ + const struct addi_board *this_board = dev->board_ptr; + struct addi_private *devpriv = dev->private; + unsigned short w_Address = CR_CHAN(insn->chanspec); + unsigned short w_Data; + + w_Data = addi_eeprom_readw(devpriv->i_IobaseAmcc, + this_board->pc_EepromChip, 2 * w_Address); + data[0] = w_Data; + + return insn->n; +} + static int apci035_auto_attach(struct comedi_device *dev, unsigned long context) { diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 857ac98..a68840e 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -9,7 +9,6 @@ #include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1500.c" -#include "addi-data/addi_common.
[PATCH 08/34] staging: comedi: addi_common.h: remove subdevice callbacks from struct addi_board
None of the drivers that still include this header use the subdevice callbacks. Remove all of them to reduce the bloat. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.h | 54 -- 1 file changed, 54 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index e2a3ffe..b757f46 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -38,60 +38,6 @@ struct addi_board { int i_Timer;/*timer subdevice present or not */ unsigned int ui_MinAcquisitiontimeNs; /* Minimum Acquisition in Nano secs */ unsigned int ui_MinDelaytimeNs; /* Minimum Delay in Nano secs */ - - /* interrupt and reset */ - void (*interrupt)(int irq, void *d); - int (*reset)(struct comedi_device *); - - /* Subdevice functions */ - - /* ANALOG INPUT */ - int (*ai_config)(struct comedi_device *, struct comedi_subdevice *, -struct comedi_insn *, unsigned int *); - int (*ai_read)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*ai_write)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*ai_bits)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*ai_cmdtest)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_cmd *); - int (*ai_cmd)(struct comedi_device *, struct comedi_subdevice *); - int (*ai_cancel)(struct comedi_device *, struct comedi_subdevice *); - - /* Analog Output */ - int (*ao_write)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - - /* Digital Input */ - int (*di_config)(struct comedi_device *, struct comedi_subdevice *, -struct comedi_insn *, unsigned int *); - int (*di_read)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*di_write)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*di_bits)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - - /* Digital Output */ - int (*do_config)(struct comedi_device *, struct comedi_subdevice *, -struct comedi_insn *, unsigned int *); - int (*do_write)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*do_bits)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*do_read)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - - /* TIMER */ - int (*timer_config)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*timer_write)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*timer_read)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); - int (*timer_bits)(struct comedi_device *, struct comedi_subdevice *, - struct comedi_insn *, unsigned int *); }; struct addi_private { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/34] staging: comedi: addi_common.c: remove v_ADDI_Interrupt()
The addi_apci_035 and addi_apci_1500 are the only drivers left that use this function in addi_common.c. The function simply calls the 'interrupt' function that is in the boardinfo of the driver. Both drivers use the same 'interrupt' function for all boardnfo entries. Remove the i_ADDI_Reset() function as well as the 'interrupt' boardinfo and use the 'interrupt' function directly when doing the request_irq(). In addition, the addi_apci_3120 driver has a private v_ADDI_Interrupt() function that is doing the same thing. Remove that one as well. Fix the return type of 'interrupt' functions in the drivers and add the return vaules. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.c| 9 - drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c | 4 +++- drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c | 4 +++- drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c | 6 -- drivers/staging/comedi/drivers/addi_apci_035.c| 3 +-- drivers/staging/comedi/drivers/addi_apci_1500.c | 3 +-- drivers/staging/comedi/drivers/addi_apci_3120.c | 13 + 7 files changed, 13 insertions(+), 29 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 850bdae..0143427 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -55,12 +55,3 @@ static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, return insn->n; } - -static irqreturn_t v_ADDI_Interrupt(int irq, void *d) -{ - struct comedi_device *dev = d; - const struct addi_board *this_board = dev->board_ptr; - - this_board->interrupt(irq, d); - return IRQ_RETVAL(1); -} diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index 53bb51b..a07ee1b 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -434,7 +434,7 @@ static int apci035_reset(struct comedi_device *dev) return 0; } -static void apci035_interrupt(int irq, void *d) +static irqreturn_t apci035_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct addi_private *devpriv = dev->private; @@ -477,4 +477,6 @@ static void apci035_interrupt(int irq, void *d) /* send signal to the sample */ send_sig(SIGIO, devpriv->tsk_Current, 0); } + + return IRQ_HANDLED; } diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 0ea081e..9896468 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -2011,7 +2011,7 @@ static int apci1500_do_bits(struct comedi_device *dev, return insn->n; } -static void apci1500_interrupt(int irq, void *d) +static irqreturn_t apci1500_interrupt(int irq, void *d) { struct comedi_device *dev = d; @@ -2180,6 +2180,8 @@ static void apci1500_interrupt(int irq, void *d) "Interrupt from unknown source\n"); } + + return IRQ_HANDLED; } static int apci1500_reset(struct comedi_device *dev) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index b06142b..ed1d92e 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -1415,7 +1415,7 @@ static int apci3120_interrupt_handle_eos(struct comedi_device *dev) return 0; } -static void apci3120_interrupt(int irq, void *d) +static irqreturn_t apci3120_interrupt(int irq, void *d) { struct comedi_device *dev = d; struct addi_private *devpriv = dev->private; @@ -1432,7 +1432,7 @@ static void apci3120_interrupt(int irq, void *d) if ((!int_daq) && (!(int_amcc & ANY_S593X_INT))) { dev_err(dev->class_dev, "IRQ from unknown source\n"); - return; + return IRQ_NONE; } outl(int_amcc | 0x00ff, devpriv->i_IobaseAmcc + AMCC_OP_REG_INTCSR);/* shutdown IRQ reasons in AMCC */ @@ -1587,6 +1587,8 @@ static void apci3120_interrupt(int irq, void *d) } comedi_handle_events(dev, s); + + return IRQ_HANDLED; } /* diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index 4f068c2..a712cc5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -27,7 +27,6 @@ static const struct addi_board apci035_boardtypes[] = { .i_Timer= 1,
[PATCH 06/34] staging: comedi: addi_apci_035: remove subdevice callbacks from boardinfo
This driver only has one boardinfo entry so the subdevice callbacks are always the same. Remvoe the callbacks from the boardinfo and use them directly when initializing the subdevices. Remove all the subdevice callback initialization that would be set to NULL. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_035.c | 35 -- 1 file changed, 5 insertions(+), 30 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index fd7d3f1..c9cd68c 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -26,11 +26,6 @@ static const struct addi_board apci035_boardtypes[] = { .i_Timer= 1, .ui_MinAcquisitiontimeNs = 1, .ui_MinDelaytimeNs = 10, - .ai_config = apci035_ai_config, - .ai_read= apci035_ai_read, - .timer_config = apci035_timer_config, - .timer_write= apci035_timer_write, - .timer_read = apci035_timer_read, }, }; @@ -142,15 +137,8 @@ static int apci035_auto_attach(struct comedi_device *dev, s->maxdata = devpriv->s_EeParameters.i_AiMaxdata; s->len_chanlist = this_board->i_AiChannelList; s->range_table = this_board->pr_AiRangelist; - - s->insn_config = this_board->ai_config; - s->insn_read = this_board->ai_read; - s->insn_write = this_board->ai_write; - s->insn_bits = this_board->ai_bits; - s->do_cmdtest = this_board->ai_cmdtest; - s->do_cmd = this_board->ai_cmd; - s->cancel = this_board->ai_cancel; - + s->insn_config = apci035_ai_config; + s->insn_read = apci035_ai_read; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -164,7 +152,6 @@ static int apci035_auto_attach(struct comedi_device *dev, s->maxdata = devpriv->s_EeParameters.i_AoMaxdata; s->len_chanlist = devpriv->s_EeParameters.i_NbrAoChannel; - s->insn_write = this_board->ao_write; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -178,10 +165,6 @@ static int apci035_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDiChannel; s->range_table = &range_digital; - s->insn_config = this_board->di_config; - s->insn_read = this_board->di_read; - s->insn_write = this_board->di_write; - s->insn_bits = this_board->di_bits; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -196,12 +179,6 @@ static int apci035_auto_attach(struct comedi_device *dev, s->len_chanlist = devpriv->s_EeParameters.i_NbrDoChannel; s->range_table = &range_digital; - - /* insn_config - for digital output memory */ - s->insn_config = this_board->do_config; - s->insn_write = this_board->do_write; - s->insn_bits = this_board->do_bits; - s->insn_read = this_board->do_read; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -215,11 +192,9 @@ static int apci035_auto_attach(struct comedi_device *dev, s->maxdata = 0; s->len_chanlist = 1; s->range_table = &range_digital; - - s->insn_write = this_board->timer_write; - s->insn_read = this_board->timer_read; - s->insn_config = this_board->timer_config; - s->insn_bits = this_board->timer_bits; + s->insn_write = apci035_timer_write; + s->insn_read = apci035_timer_read; + s->insn_config = apci035_timer_config; } else { s->type = COMEDI_SUBD_UNUSED; } -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 26/34] staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDiChannel'
All boardinfo entries have this member set as '4'. Remove the member and initialize the Digial Input 'n_chan' with 4 directly. Also, remove the initialization of 'len_chanlist'. This member is only used with subdevices that support async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index fd6f64a..18e0b13 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -22,7 +22,6 @@ struct apci3120_board { int i_NbrAoChannel; int i_AiMaxdata; int i_AoMaxdata; - int i_NbrDiChannel; }; static const struct apci3120_board apci3120_boardtypes[] = { @@ -34,7 +33,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_NbrAoChannel = 8, .i_AiMaxdata= 0x, .i_AoMaxdata= 0x3fff, - .i_NbrDiChannel = 4, }, [BOARD_APCI3001] = { .name = "apci3001", @@ -42,7 +40,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_NbrAiChannelDiff = 8, .i_AiChannelList= 16, .i_AiMaxdata= 0xfff, - .i_NbrDiChannel = 4, }, }; @@ -148,9 +145,8 @@ static int apci3120_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = this_board->i_NbrDiChannel; + s->n_chan = 4; s->maxdata = 1; - s->len_chanlist = this_board->i_NbrDiChannel; s->range_table = &range_digital; s->insn_bits = apci3120_di_insn_bits; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 15/34] staging: comedi: addi_apci_1500: remove eeprom support
As indicated in the boardinfo, the hardware does not have an eeprom. Remove the subdevice and support code for it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 51 + 1 file changed, 1 insertion(+), 50 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index c69510b..7c32c85 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -7,13 +7,11 @@ #include "addi-data/addi_common.h" -#include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci1500.c" static const struct addi_board apci1500_boardtypes[] = { { .name = "apci1500", - .i_PCIEeprom= 0, .i_NbrDiChannel = 16, .i_NbrDoChannel = 16, .i_DoMaxdata= 0x, @@ -21,23 +19,6 @@ static const struct addi_board apci1500_boardtypes[] = { }, }; -static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, -unsigned int *data) -{ - const struct addi_board *this_board = dev->board_ptr; - struct addi_private *devpriv = dev->private; - unsigned short w_Address = CR_CHAN(insn->chanspec); - unsigned short w_Data; - - w_Data = addi_eeprom_readw(devpriv->i_IobaseAmcc, - this_board->pc_EepromChip, 2 * w_Address); - data[0] = w_Data; - - return insn->n; -} - static int apci1500_auto_attach(struct comedi_device *dev, unsigned long context) { @@ -45,7 +26,6 @@ static int apci1500_auto_attach(struct comedi_device *dev, const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv; struct comedi_subdevice *s; - unsigned int dw_Dummy; int ret; dev->board_ptr = &apci1500_boardtypes[0]; @@ -88,24 +68,7 @@ static int apci1500_auto_attach(struct comedi_device *dev, dev->irq = pcidev->irq; } - /* Read eepeom and fill addi_board Structure */ - - if (this_board->i_PCIEeprom) { - if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { - /* Set 3 wait stait */ - if (!(strcmp(dev->board_name, "apci035"))) - outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); - else - outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - - /* Enable the interrupt for the controller */ - dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); - outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); - } - addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); - } - - ret = comedi_alloc_subdevices(dev, 4); + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; @@ -161,18 +124,6 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - /* EEPROM */ - s = &dev->subdevices[3]; - if (this_board->i_PCIEeprom) { - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0x; - s->insn_read = i_ADDIDATA_InsnReadEeprom; - } else { - s->type = COMEDI_SUBD_UNUSED; - } - apci1500_reset(dev); return 0; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/34] staging: comedi: addi_common.c: remove i_ADDI_Detach()
The addi_apci_035 and addi_apci_1500 are the only drivers left that use this function in addi_common.c. Remove the function an add a private comedi_driver (*detach) function to those drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.c | 7 --- drivers/staging/comedi/drivers/addi_apci_035.c | 9 - drivers/staging/comedi/drivers/addi_apci_1500.c| 9 - 3 files changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.c b/drivers/staging/comedi/drivers/addi-data/addi_common.c index 2e7fb21..51574a8 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.c +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.c @@ -265,10 +265,3 @@ static int addi_auto_attach(struct comedi_device *dev, i_ADDI_Reset(dev); return 0; } - -static void i_ADDI_Detach(struct comedi_device *dev) -{ - if (dev->iobase) - i_ADDI_Reset(dev); - comedi_pci_detach(dev); -} diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index af70c84..b06fde1 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -45,11 +45,18 @@ static int apci035_auto_attach(struct comedi_device *dev, return addi_auto_attach(dev, context); } +static void apci035_detach(struct comedi_device *dev) +{ + if (dev->iobase) + i_ADDI_Reset(dev); + comedi_pci_detach(dev); +} + static struct comedi_driver apci035_driver = { .driver_name= "addi_apci_035", .module = THIS_MODULE, .auto_attach= apci035_auto_attach, - .detach = i_ADDI_Detach, + .detach = apci035_detach, }; static int apci035_pci_probe(struct pci_dev *dev, diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index b7a284a..50a147f 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -44,11 +44,18 @@ static int apci1500_auto_attach(struct comedi_device *dev, return addi_auto_attach(dev, context); } +static void apci1500_detach(struct comedi_device *dev) +{ + if (dev->iobase) + i_ADDI_Reset(dev); + comedi_pci_detach(dev); +} + static struct comedi_driver apci1500_driver = { .driver_name= "addi_apci_1500", .module = THIS_MODULE, .auto_attach= apci1500_auto_attach, - .detach = i_ADDI_Detach, + .detach = apci1500_detach, }; static int apci1500_pci_probe(struct pci_dev *dev, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 30/34] staging: comedi: addi_apci_3120: simplify analog input boardinfo
There are two boards supported by this driver. One with 16-bit analog inputs and the other 12-bit analog inputs. Add a bit field flag, 'ai_is_16bit', to the boardinfo and remove the 'i_AiMaxdata' member. Use the new flag to initialize tne analog input subdevice maxdata correctly. For aesthetics, adjust the whitespace in the boardinfo declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index de1dabf..9ba66d8 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -16,19 +16,18 @@ enum apci3120_boardid { struct apci3120_board { const char *name; - int i_AiMaxdata; + unsigned int ai_is_16bit:1; unsigned int has_ao:1; }; static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { - .name = "apci3120", - .i_AiMaxdata= 0x, - .has_ao = 1, + .name = "apci3120", + .ai_is_16bit= 1, + .has_ao = 1, }, [BOARD_APCI3001] = { - .name = "apci3001", - .i_AiMaxdata= 0xfff, + .name = "apci3001", }, }; @@ -103,7 +102,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; s->n_chan = 16; - s->maxdata = this_board->i_AiMaxdata; + s->maxdata = this_board->ai_is_16bit ? 0x : 0x0fff; s->len_chanlist = s->n_chan; s->range_table = &range_apci3120_ai; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 19/34] staging: comedi: addi_apci_035: remove boardinfo
The hardware has an eeprom but the boardinfo properly defines the subdevice support so reading the eeprom and setting the 's_EeParameters' use is not necessary. Since the boardinfo only has one entry its not really necessary. Also, providing a subdevice the read the eeprom is not really interesting. Remove the eeprom support code along with the boardinfo and initialize the subdevices directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_035.c | 116 - 1 file changed, 19 insertions(+), 97 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index ed4ed17..37b5884 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -9,54 +9,17 @@ #define ADDIDATA_WATCHDOG 2/* Or shold it be something else */ -#include "addi-data/addi_eeprom.c" #include "addi-data/hwdrv_apci035.c" -static const struct addi_board apci035_boardtypes[] = { - { - .name = "apci035", - .pc_EepromChip = "S5920", - .i_NbrAiChannel = 16, - .i_NbrAiChannelDiff = 8, - .i_AiChannelList= 16, - .i_AiMaxdata= 0xff, - .pr_AiRangelist = &range_apci035_ai, - .i_Timer= 1, - .ui_MinAcquisitiontimeNs = 1, - .ui_MinDelaytimeNs = 10, - }, -}; - -static int i_ADDIDATA_InsnReadEeprom(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, -unsigned int *data) -{ - const struct addi_board *this_board = dev->board_ptr; - struct addi_private *devpriv = dev->private; - unsigned short w_Address = CR_CHAN(insn->chanspec); - unsigned short w_Data; - - w_Data = addi_eeprom_readw(devpriv->i_IobaseAmcc, - this_board->pc_EepromChip, 2 * w_Address); - data[0] = w_Data; - - return insn->n; -} - static int apci035_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - const struct addi_board *this_board = dev->board_ptr; struct addi_private *devpriv; struct comedi_subdevice *s; unsigned int dw_Dummy; int ret; - dev->board_ptr = &apci035_boardtypes[0]; - dev->board_name = this_board->name; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); if (!devpriv) return -ENOMEM; @@ -71,22 +34,6 @@ static int apci035_auto_attach(struct comedi_device *dev, devpriv->i_IobaseAddon = pci_resource_start(pcidev, 2); devpriv->i_IobaseReserved = pci_resource_start(pcidev, 3); - /* Initialize parameters that can be overridden in EEPROM */ - devpriv->s_EeParameters.i_NbrAiChannel = this_board->i_NbrAiChannel; - devpriv->s_EeParameters.i_NbrAoChannel = this_board->i_NbrAoChannel; - devpriv->s_EeParameters.i_AiMaxdata = this_board->i_AiMaxdata; - devpriv->s_EeParameters.i_AoMaxdata = this_board->i_AoMaxdata; - devpriv->s_EeParameters.i_NbrDiChannel = this_board->i_NbrDiChannel; - devpriv->s_EeParameters.i_NbrDoChannel = this_board->i_NbrDoChannel; - devpriv->s_EeParameters.i_DoMaxdata = this_board->i_DoMaxdata; - devpriv->s_EeParameters.i_Timer = this_board->i_Timer; - devpriv->s_EeParameters.ui_MinAcquisitiontimeNs = - this_board->ui_MinAcquisitiontimeNs; - devpriv->s_EeParameters.ui_MinDelaytimeNs = - this_board->ui_MinDelaytimeNs; - - /* ## */ - if (pcidev->irq > 0) { ret = request_irq(pcidev->irq, apci035_interrupt, IRQF_SHARED, dev->board_name, dev); @@ -101,58 +48,33 @@ static int apci035_auto_attach(struct comedi_device *dev, dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); - /* Read eepeom and fill addi_board Structure */ - addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); - - ret = comedi_alloc_subdevices(dev, 3); + ret = comedi_alloc_subdevices(dev, 2); if (ret) return ret; /* Allocate and Initialise AI Subdevice Structures */ s = &dev->subdevices[0]; - if ((devpriv->s_EeParameters.i_NbrAiChannel) - || (this_board->i_NbrAiChannelDiff)) { - dev->read_subdev = s; - s->type = COMEDI_SUBD_AI; - s->subdev_flags = - SDF_READABLE | SDF_COMMON | SDF_GROUND - | SDF_DIFF; - if (devpriv->s_EeParameters.i_Nbr
[PATCH 17/34] staging: comedi: addi_common.h: remove boardinfo member 'i_PCIEeprom'
This member of the boardinfo is not used by any of the drivers. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/addi_common.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h index 0752a61..5518332 100644 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ b/drivers/staging/comedi/drivers/addi-data/addi_common.h @@ -20,7 +20,6 @@ struct addi_board { const char *name; - int i_PCIEeprom;/* eeprom present or not */ char *pc_EepromChip;/* type of chip */ int i_NbrAiChannel; /* num of A/D chans */ int i_NbrAiChannelDiff; /* num of A/D chans in diff mode */ -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 32/34] staging: comedi: addi_apci_1500: separate from addi_common.h
Remove the need to include addi_common.h by introducing a new private data definition. Only include the members that are actually used by the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci1500.c | 24 +++--- drivers/staging/comedi/drivers/addi_apci_1500.c| 13 ++-- 2 files changed, 23 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c index 9896468..bfa9228 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci1500.c @@ -158,7 +158,7 @@ static int apci1500_di_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_PatternPolarity = 0, i_PatternTransition = 0, i_PatternMask = 0; int i_MaxChannel = 0, i_Count = 0, i_EventMask = 0; int i_PatternTransitionCount = 0, i_RegValue; @@ -466,7 +466,7 @@ static int apci1500_di_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_Event1InterruptStatus = 0, i_Event2InterruptStatus = 0, i_RegValue; @@ -653,7 +653,7 @@ static int apci1500_di_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_DummyRead = 0; /* Software reset */ @@ -789,7 +789,7 @@ static int apci1500_di_insn_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; data[1] = inw(devpriv->i_IobaseAddon + APCI1500_DIGITAL_IP); @@ -807,7 +807,7 @@ static int apci1500_do_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; devpriv->b_OutputMemoryStatus = data[0]; return insn->n; @@ -821,7 +821,7 @@ static int apci1500_do_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; static unsigned int ui_Temp; unsigned int ui_Temp1; unsigned int ui_NoOfChannel = CR_CHAN(insn->chanspec); /* get the channel */ @@ -981,7 +981,7 @@ static int apci1500_timer_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_TimerCounterMode, i_MasterConfiguration; devpriv->tsk_Current = current; @@ -1471,7 +1471,7 @@ static int apci1500_timer_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_CommandAndStatusValue; switch (data[0]) { @@ -1731,7 +1731,7 @@ static int apci1500_timer_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; int i_CommandAndStatusValue; switch (data[0]) { @@ -1895,7 +1895,7 @@ static int apci1500_do_bits(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; unsigned int ui_Status; int i_RegValue; int i_Constant; @@ -2015,7 +2015,7 @@ static irqreturn_t apci1500_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct addi_private *devpriv = dev->private; + struct apci1500_private *devpriv = dev->private; unsigned int ui_InterruptStatus = 0; int i_RegValue = 0; @@ -2186,7 +2186,7 @@ static
[PATCH 16/34] staging: comedi: addi_apci_035: board has eeprom
As indicated in the boardinfo, the hardware has an eeprom. Simplify the board attach code and remove the boardinfo. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_035.c | 38 +- 1 file changed, 13 insertions(+), 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index a197f64..ed4ed17 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -15,7 +15,6 @@ static const struct addi_board apci035_boardtypes[] = { { .name = "apci035", - .i_PCIEeprom= 1, .pc_EepromChip = "S5920", .i_NbrAiChannel = 16, .i_NbrAiChannelDiff = 8, @@ -95,22 +94,15 @@ static int apci035_auto_attach(struct comedi_device *dev, dev->irq = pcidev->irq; } - /* Read eepeom and fill addi_board Structure */ + /* Set 3 wait stait */ + outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); - if (this_board->i_PCIEeprom) { - if (!(strcmp(this_board->pc_EepromChip, "S5920"))) { - /* Set 3 wait stait */ - if (!(strcmp(dev->board_name, "apci035"))) - outl(0x80808082, devpriv->i_IobaseAmcc + 0x60); - else - outl(0x83838383, devpriv->i_IobaseAmcc + 0x60); - - /* Enable the interrupt for the controller */ - dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); - outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); - } - addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); - } + /* Enable the interrupt for the controller */ + dw_Dummy = inl(devpriv->i_IobaseAmcc + 0x38); + outl(dw_Dummy | 0x2000, devpriv->i_IobaseAmcc + 0x38); + + /* Read eepeom and fill addi_board Structure */ + addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); ret = comedi_alloc_subdevices(dev, 3); if (ret) @@ -156,15 +148,11 @@ static int apci035_auto_attach(struct comedi_device *dev, /* EEPROM */ s = &dev->subdevices[2]; - if (this_board->i_PCIEeprom) { - s->type = COMEDI_SUBD_MEMORY; - s->subdev_flags = SDF_READABLE | SDF_INTERNAL; - s->n_chan = 256; - s->maxdata = 0x; - s->insn_read = i_ADDIDATA_InsnReadEeprom; - } else { - s->type = COMEDI_SUBD_UNUSED; - } + s->type = COMEDI_SUBD_MEMORY; + s->subdev_flags = SDF_READABLE | SDF_INTERNAL; + s->n_chan = 256; + s->maxdata = 0x; + s->insn_read = i_ADDIDATA_InsnReadEeprom; apci035_reset(dev); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 34/34] staging: comedi: addi_common.h: remove file
This header is no longer included by any of the addi-data drivers. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/addi-data/addi_common.h | 52 -- 1 file changed, 52 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_common.h diff --git a/drivers/staging/comedi/drivers/addi-data/addi_common.h b/drivers/staging/comedi/drivers/addi-data/addi_common.h deleted file mode 100644 index 52f35b4..000 --- a/drivers/staging/comedi/drivers/addi-data/addi_common.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2004,2005 ADDI-DATA GmbH for the source code of this module. - * - * ADDI-DATA GmbH - * Dieselstrasse 3 - * D-77833 Ottersweier - * Tel: +19(0)7223/9493-0 - * Fax: +49(0)7223/9493-92 - * http://www.addi-data.com - * i...@addi-data.com - * - * 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. - */ - -#include -#include - -struct addi_private { - int iobase; - int i_IobaseAmcc; /* base+size for AMCC chip */ - int i_IobaseAddon; /* addon base address */ - int i_IobaseReserved; - unsigned int ui_AiActualScan; /* how many scans we finished */ - unsigned int ui_AiNbrofChannels;/* how many channels is measured */ - unsigned int ui_AiChannelList[32]; /* actual chanlist */ - unsigned int ui_AiReadData[32]; - unsigned short us_UseDma; /* To use Dma or not */ - unsigned char b_DmaDoubleBuffer;/* we can use double buffering */ - unsigned int ui_DmaActualBuffer;/* which buffer is used now */ - unsigned short *ul_DmaBufferVirtual[2]; /* pointers to DMA buffer */ - dma_addr_t ul_DmaBufferHw[2]; /* hw address of DMA buff */ - unsigned int ui_DmaBufferSize[2]; /* size of dma buffer in bytes */ - unsigned int ui_DmaBufferUsesize[2];/* which size we may now used for transfer */ - unsigned char b_DigitalOutputRegister; /* Digital Output Register */ - unsigned char b_OutputMemoryStatus; - unsigned char b_TimerSelectMode;/* Contain data written at iobase + 0C */ - unsigned char b_ModeSelectRegister; /* Contain data written at iobase + 0E */ - unsigned short us_OutputRegister; /* Contain data written at iobase + 0 */ - unsigned char b_Timer2Mode; /* Specify the timer 2 mode */ - unsigned char b_Timer2Interrupt;/* Timer2 interrupt enable or disable */ - unsigned int ai_running:1; - unsigned char b_InterruptMode; /* eoc eos or dma */ - unsigned char b_EocEosInterrupt;/* Enable disable eoc eos interrupt */ - unsigned int ui_EocEosConversionTime; - unsigned char b_ExttrigEnable; /* To enable or disable external trigger */ - - /* Pointer to the current process */ - struct task_struct *tsk_Current; -}; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 00/34] staging: comedi: addi-data: remove "common" code bloat
The ADDI-DATA drivers all originally use some "common" code to provide the comedi driver attach/detach. This "common" code added a lot of bloat to the drivers due to the boardinfo and private data definitions. Most of the ADDI-DATA drivers have been separated from this "commont" code and now have private definitions for the boardinfo, if it's even needed, and the private data used by the driver. They also have private attach/detach functions and the bloat has been removed. This series separates the remaining ADDI-DATA drivers from the "common" code and removes the "common" code completely. It also removes the unneeded boardinfo from the addi_apci_035 and addi_apci_1500 drivers and trims down the boardinfo in the addi_apci_3120 driver. H Hartley Sweeten (34): staging: comedi: addi_common.c: remove i_ADDI_Detach() staging: comedi: addi_common.c: remove i_ADDI_Reset() staging: comedi: addi_common.c: remove addi_auto_attach() staging: comedi: addi_common.c: remove v_ADDI_Interrupt() staging: comedi: addi_common.c: remove included source file staging: comedi: addi_apci_035: remove subdevice callbacks from boardinfo staging: comedi: addi_apci_1500: remove subdevice callbacks from boardinfo staging: comedi: addi_common.h: remove subdevice callbacks from struct addi_board staging: comedi: addi_apci_035: remove unnecessary subdevice initialization staging: comedi: addi_apci_035: remove unused subdevices staging: comedi: addi_apci_1500: remove unnecessary subdevice initialization staging: comedi: addi_apci_1500: remove unused subdevices staging: comedi: addi_common.h: rename boardinfo 'pc_DriverName' staging: comedi: addi_common.h: remove boardinfo 'i_IorangeBase1' staging: comedi: addi_apci_1500: remove eeprom support staging: comedi: addi_apci_035: board has eeprom staging: comedi: addi_common.h: remove boardinfo member 'i_PCIEeprom' staging: comedi: addi_apci_1500: remove boardinfo staging: comedi: addi_apci_035: remove boardinfo staging: comedi: addi_eeprom: remove source file staging: comedi: hwdrv_apci3120: remove need for boardinfo access staging: comedi: addi_common.h: remove boardinfo definition staging: comedi: addi_common.h: remove unused members from addi_private staging: comedi: addi_apci_3120: remove boardinfo 'i_DoMaxdata' staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDoChannel' staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDiChannel' staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrAiChannel' staging: comedi: addi_apci_3120: remove boardinfo 'i_AiChannelList' staging: comedi: addi_apci_3120: simplify analog output boardinfo staging: comedi: addi_apci_3120: simplify analog input boardinfo staging: comedi: addi_apci_035: separate from addi_common.h staging: comedi: addi_apci_1500: separate from addi_common.h staging: comedi: addi_apci_3120: separate from addi_common.h staging: comedi: addi_common.h: remove file .../staging/comedi/drivers/addi-data/addi_common.c | 274 .../staging/comedi/drivers/addi-data/addi_common.h | 144 - .../staging/comedi/drivers/addi-data/addi_eeprom.c | 360 - .../comedi/drivers/addi-data/hwdrv_apci035.c | 18 +- .../comedi/drivers/addi-data/hwdrv_apci1500.c | 28 +- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 60 ++-- drivers/staging/comedi/drivers/addi_apci_035.c | 112 +-- drivers/staging/comedi/drivers/addi_apci_1500.c| 118 +-- drivers/staging/comedi/drivers/addi_apci_3120.c| 109 --- 9 files changed, 279 insertions(+), 944 deletions(-) delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_common.c delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_common.h delete mode 100644 drivers/staging/comedi/drivers/addi-data/addi_eeprom.c -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 33/34] staging: comedi: addi_apci_3120: separate from addi_common.h
Remove the need to include addi_common.h by introducing a new private data definition. Only include the members that are actually used by the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../comedi/drivers/addi-data/hwdrv_apci3120.c | 38 ++-- drivers/staging/comedi/drivers/addi_apci_3120.c| 42 ++ 2 files changed, 55 insertions(+), 25 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c index e120d62..a2db2fa 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci3120.c @@ -246,7 +246,7 @@ static int apci3120_ai_insn_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; unsigned int i; if ((data[0] != APCI3120_EOC_MODE) && (data[0] != APCI3120_EOS_MODE)) @@ -300,7 +300,7 @@ static int apci3120_setup_chan_list(struct comedi_device *dev, unsigned int *chanlist, char check) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; unsigned int i; unsigned int gain; unsigned short us_TmpValue; @@ -349,7 +349,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; unsigned short us_ConvertTiming, us_TmpValue, i; unsigned char b_Tmp; @@ -585,7 +585,7 @@ static int apci3120_ai_insn_read(struct comedi_device *dev, static int apci3120_reset(struct comedi_device *dev) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; unsigned int i; unsigned short us_TmpValue; @@ -638,7 +638,7 @@ static int apci3120_reset(struct comedi_device *dev) static int apci3120_exttrig_enable(struct comedi_device *dev) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; devpriv->us_OutputRegister |= APCI3120_ENABLE_EXT_TRIGGER; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); @@ -647,7 +647,7 @@ static int apci3120_exttrig_enable(struct comedi_device *dev) static int apci3120_exttrig_disable(struct comedi_device *dev) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; devpriv->us_OutputRegister &= ~APCI3120_ENABLE_EXT_TRIGGER; outw(devpriv->us_OutputRegister, dev->iobase + APCI3120_WR_ADDRESS); @@ -657,7 +657,7 @@ static int apci3120_exttrig_disable(struct comedi_device *dev) static int apci3120_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; /* Disable A2P Fifo write and AMWEN signal */ outw(0, devpriv->i_IobaseAddon + 4); @@ -778,7 +778,7 @@ static int apci3120_cyclic_ai(int mode, struct comedi_device *dev, struct comedi_subdevice *s) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; unsigned char b_Tmp; unsigned int ui_Tmp, ui_DelayTiming = 0, ui_TimerValue1 = 0, dmalen0 = @@ -1200,7 +1200,7 @@ static int apci3120_cyclic_ai(int mode, static int apci3120_ai_cmd(struct comedi_device *dev, struct comedi_subdevice *s) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; /* loading private structure with cmd structure inputs */ @@ -1225,7 +1225,7 @@ static void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, unsigned short *dma_buffer, unsigned int num_samples) { - struct addi_private *devpriv = dev->private; + struct apci3120_private *devpriv = dev->private; struct comedi_cmd *cmd = &s->async->cmd; devpriv->ui_AiActualScan += @@ -1245,7 +1245,7 @@ static void v_APCI3120_InterruptDmaMoveBlock16bit(struct comedi_device *dev, static void apci3120_interrupt_dma(int irq, void *d) { struct comedi_device *dev = d; - struct addi_private *devpriv = dev->p
[PATCH 25/34] staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrDoChannel'
All boardinfo entries have this member set as '4'. Remove the member and initialize the Digial Output 'n_chan' with 4 directly. Also, remove the initialization of 'len_chanlist'. This member is only used with subdevices that support async commands. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 6 +- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 9f5d7a5..fd6f64a 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -23,7 +23,6 @@ struct apci3120_board { int i_AiMaxdata; int i_AoMaxdata; int i_NbrDiChannel; - int i_NbrDoChannel; }; static const struct apci3120_board apci3120_boardtypes[] = { @@ -36,7 +35,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_AiMaxdata= 0x, .i_AoMaxdata= 0x3fff, .i_NbrDiChannel = 4, - .i_NbrDoChannel = 4, }, [BOARD_APCI3001] = { .name = "apci3001", @@ -45,7 +43,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_AiChannelList= 16, .i_AiMaxdata= 0xfff, .i_NbrDiChannel = 4, - .i_NbrDoChannel = 4, }, }; @@ -162,9 +159,8 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_DO; s->subdev_flags = SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; - s->n_chan = this_board->i_NbrDoChannel; + s->n_chan = 4; s->maxdata = 1; - s->len_chanlist = this_board->i_NbrDoChannel; s->range_table = &range_digital; s->insn_bits = apci3120_do_insn_bits; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 27/34] staging: comedi: addi_apci_3120: remove boardinfo 'i_NbrAiChannel'
All boardinfo entries have this member set as '16'. This will initialize the Analog Input 'n_chan' and cause the 'i_NbrAiChannelDiff' member to never get used. Remove both members and initialize the Analog Input 'n_chan' with 16 directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 11 +-- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 18e0b13..32e5ad4 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -16,8 +16,6 @@ enum apci3120_boardid { struct apci3120_board { const char *name; - int i_NbrAiChannel; - int i_NbrAiChannelDiff; int i_AiChannelList; int i_NbrAoChannel; int i_AiMaxdata; @@ -27,8 +25,6 @@ struct apci3120_board { static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { .name = "apci3120", - .i_NbrAiChannel = 16, - .i_NbrAiChannelDiff = 8, .i_AiChannelList= 16, .i_NbrAoChannel = 8, .i_AiMaxdata= 0x, @@ -36,8 +32,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { }, [BOARD_APCI3001] = { .name = "apci3001", - .i_NbrAiChannel = 16, - .i_NbrAiChannelDiff = 8, .i_AiChannelList= 16, .i_AiMaxdata= 0xfff, }, @@ -113,10 +107,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->subdev_flags = SDF_READABLE | SDF_COMMON | SDF_GROUND | SDF_DIFF; - if (this_board->i_NbrAiChannel) - s->n_chan = this_board->i_NbrAiChannel; - else - s->n_chan = this_board->i_NbrAiChannelDiff; + s->n_chan = 16; s->maxdata = this_board->i_AiMaxdata; s->len_chanlist = this_board->i_AiChannelList; s->range_table = &range_apci3120_ai; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 31/34] staging: comedi: addi_apci_035: separate from addi_common.h
Remove the need to include addi_common.h by introducing a new private data definition. Only include the members that are actually used by the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c | 14 +++--- drivers/staging/comedi/drivers/addi_apci_035.c | 13 +++-- 2 files changed, 18 insertions(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c index a07ee1b..d833da2 100644 --- a/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c +++ b/drivers/staging/comedi/drivers/addi-data/hwdrv_apci035.c @@ -118,7 +118,7 @@ static int apci035_timer_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; unsigned int ui_Status; unsigned int ui_Command; unsigned int ui_Mode; @@ -248,7 +248,7 @@ static int apci035_timer_write(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; unsigned int ui_Command; int i_Count; @@ -345,7 +345,7 @@ static int apci035_timer_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; unsigned int ui_Status; /* Status register */ i_WatchdogNbr = insn->unused[0]; @@ -380,7 +380,7 @@ static int apci035_ai_config(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; devpriv->tsk_Current = current; outl(0x200 | 0, devpriv->iobase + 128 + 0x4); @@ -404,7 +404,7 @@ static int apci035_ai_read(struct comedi_device *dev, struct comedi_insn *insn, unsigned int *data) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; unsigned int ui_CommandRegister; /* Set the start */ @@ -420,7 +420,7 @@ static int apci035_ai_read(struct comedi_device *dev, static int apci035_reset(struct comedi_device *dev) { - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; int i_Count; for (i_Count = 1; i_Count <= 4; i_Count++) { @@ -437,7 +437,7 @@ static int apci035_reset(struct comedi_device *dev) static irqreturn_t apci035_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct addi_private *devpriv = dev->private; + struct apci035_private *devpriv = dev->private; unsigned int ui_StatusRegister1; unsigned int ui_StatusRegister2; unsigned int ui_ReadCommand; diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index 37b5884..d7b7e1a 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -1,11 +1,20 @@ #include #include +#include +#include #include "../comedidev.h" #include "comedi_fc.h" #include "amcc_s5933.h" -#include "addi-data/addi_common.h" +struct apci035_private { + int iobase; + int i_IobaseAmcc; + int i_IobaseAddon; + int i_IobaseReserved; + unsigned char b_TimerSelectMode; + struct task_struct *tsk_Current; +}; #define ADDIDATA_WATCHDOG 2/* Or shold it be something else */ @@ -15,7 +24,7 @@ static int apci035_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); - struct addi_private *devpriv; + struct apci035_private *devpriv; struct comedi_subdevice *s; unsigned int dw_Dummy; int ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/34] staging: comedi: addi_apci_1500: remove unused subdevices
Only allocate space for the subdevicess used by the driver. Remove all the COMEDI_SUBD_UNUSED subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_1500.c | 22 +- 1 file changed, 5 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_1500.c b/drivers/staging/comedi/drivers/addi_apci_1500.c index 13b31ab..7da0c35 100644 --- a/drivers/staging/comedi/drivers/addi_apci_1500.c +++ b/drivers/staging/comedi/drivers/addi_apci_1500.c @@ -110,20 +110,12 @@ static int apci1500_auto_attach(struct comedi_device *dev, addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); } - ret = comedi_alloc_subdevices(dev, 7); + ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; - /* Allocate and Initialise AI Subdevice Structures */ - s = &dev->subdevices[0]; - s->type = COMEDI_SUBD_UNUSED; - - /* Allocate and Initialise AO Subdevice Structures */ - s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_UNUSED; - /* Allocate and Initialise DI Subdevice Structures */ - s = &dev->subdevices[2]; + s = &dev->subdevices[0]; if (devpriv->s_EeParameters.i_NbrDiChannel) { s->type = COMEDI_SUBD_DI; s->subdev_flags = SDF_READABLE | SDF_GROUND | SDF_COMMON; @@ -140,7 +132,7 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } /* Allocate and Initialise DO Subdevice Structures */ - s = &dev->subdevices[3]; + s = &dev->subdevices[1]; if (devpriv->s_EeParameters.i_NbrDoChannel) { s->type = COMEDI_SUBD_DO; s->subdev_flags = @@ -158,7 +150,7 @@ static int apci1500_auto_attach(struct comedi_device *dev, } /* Allocate and Initialise Timer Subdevice Structures */ - s = &dev->subdevices[4]; + s = &dev->subdevices[2]; if (devpriv->s_EeParameters.i_Timer) { s->type = COMEDI_SUBD_TIMER; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; @@ -174,12 +166,8 @@ static int apci1500_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - /* Allocate and Initialise TTL */ - s = &dev->subdevices[5]; - s->type = COMEDI_SUBD_UNUSED; - /* EEPROM */ - s = &dev->subdevices[6]; + s = &dev->subdevices[3]; if (this_board->i_PCIEeprom) { s->type = COMEDI_SUBD_MEMORY; s->subdev_flags = SDF_READABLE | SDF_INTERNAL; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 28/34] staging: comedi: addi_apci_3120: remove boardinfo 'i_AiChannelList'
All boardinfo entries have this member set as '16'. This is also the Analog Input 'n_chan'. For aesthetics, initialize the Analog Input 'len_chanlist' with s->n_chan and remove the boardinfo member. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index 32e5ad4..d555427 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -16,7 +16,6 @@ enum apci3120_boardid { struct apci3120_board { const char *name; - int i_AiChannelList; int i_NbrAoChannel; int i_AiMaxdata; int i_AoMaxdata; @@ -25,14 +24,12 @@ struct apci3120_board { static const struct apci3120_board apci3120_boardtypes[] = { [BOARD_APCI3120] = { .name = "apci3120", - .i_AiChannelList= 16, .i_NbrAoChannel = 8, .i_AiMaxdata= 0x, .i_AoMaxdata= 0x3fff, }, [BOARD_APCI3001] = { .name = "apci3001", - .i_AiChannelList= 16, .i_AiMaxdata= 0xfff, }, }; @@ -109,7 +106,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, | SDF_DIFF; s->n_chan = 16; s->maxdata = this_board->i_AiMaxdata; - s->len_chanlist = this_board->i_AiChannelList; + s->len_chanlist = s->n_chan; s->range_table = &range_apci3120_ai; s->insn_config = apci3120_ai_insn_config; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/34] staging: comedi: addi_apci_035: remove unused subdevices
Only allocate space for the subdevicess used by the driver. Remove all the COMEDI_SUBD_UNUSED subdevices. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_035.c | 22 +++--- 1 file changed, 3 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_035.c b/drivers/staging/comedi/drivers/addi_apci_035.c index f2cc95a..3eeb244 100644 --- a/drivers/staging/comedi/drivers/addi_apci_035.c +++ b/drivers/staging/comedi/drivers/addi_apci_035.c @@ -117,7 +117,7 @@ static int apci035_auto_attach(struct comedi_device *dev, addi_eeprom_read_info(dev, pci_resource_start(pcidev, 0)); } - ret = comedi_alloc_subdevices(dev, 7); + ret = comedi_alloc_subdevices(dev, 3); if (ret) return ret; @@ -143,20 +143,8 @@ static int apci035_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - /* Allocate and Initialise AO Subdevice Structures */ - s = &dev->subdevices[1]; - s->type = COMEDI_SUBD_UNUSED; - - /* Allocate and Initialise DI Subdevice Structures */ - s = &dev->subdevices[2]; - s->type = COMEDI_SUBD_UNUSED; - - /* Allocate and Initialise DO Subdevice Structures */ - s = &dev->subdevices[3]; - s->type = COMEDI_SUBD_UNUSED; - /* Allocate and Initialise Timer Subdevice Structures */ - s = &dev->subdevices[4]; + s = &dev->subdevices[1]; if (devpriv->s_EeParameters.i_Timer) { s->type = COMEDI_SUBD_TIMER; s->subdev_flags = SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; @@ -171,12 +159,8 @@ static int apci035_auto_attach(struct comedi_device *dev, s->type = COMEDI_SUBD_UNUSED; } - /* Allocate and Initialise TTL */ - s = &dev->subdevices[5]; - s->type = COMEDI_SUBD_UNUSED; - /* EEPROM */ - s = &dev->subdevices[6]; + s = &dev->subdevices[2]; if (this_board->i_PCIEeprom) { s->type = COMEDI_SUBD_MEMORY; s->subdev_flags = SDF_READABLE | SDF_INTERNAL; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 24/34] staging: comedi: addi_apci_3120: remove boardinfo 'i_DoMaxdata'
The maxdata for a Digital Output subdevice is always '1'. Remove this incorrect boardinfo. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/addi_apci_3120.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/addi_apci_3120.c b/drivers/staging/comedi/drivers/addi_apci_3120.c index ae81fdb..9f5d7a5 100644 --- a/drivers/staging/comedi/drivers/addi_apci_3120.c +++ b/drivers/staging/comedi/drivers/addi_apci_3120.c @@ -24,7 +24,6 @@ struct apci3120_board { int i_AoMaxdata; int i_NbrDiChannel; int i_NbrDoChannel; - int i_DoMaxdata; }; static const struct apci3120_board apci3120_boardtypes[] = { @@ -38,7 +37,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_AoMaxdata= 0x3fff, .i_NbrDiChannel = 4, .i_NbrDoChannel = 4, - .i_DoMaxdata= 0x0f, }, [BOARD_APCI3001] = { .name = "apci3001", @@ -48,7 +46,6 @@ static const struct apci3120_board apci3120_boardtypes[] = { .i_AiMaxdata= 0xfff, .i_NbrDiChannel = 4, .i_NbrDoChannel = 4, - .i_DoMaxdata= 0x0f, }, }; @@ -166,7 +163,7 @@ static int apci3120_auto_attach(struct comedi_device *dev, s->subdev_flags = SDF_READABLE | SDF_WRITEABLE | SDF_GROUND | SDF_COMMON; s->n_chan = this_board->i_NbrDoChannel; - s->maxdata = this_board->i_DoMaxdata; + s->maxdata = 1; s->len_chanlist = this_board->i_NbrDoChannel; s->range_table = &range_digital; s->insn_bits = apci3120_do_insn_bits; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] hyperv: Implement Time Synchronization using host time sample
On Tue, 2014-10-14 at 14:19 +0300, Dan Carpenter wrote: > I had a couple small style nits. > > On Tue, Oct 14, 2014 at 04:11:18AM -0700, Thomas Shao wrote: > > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c > > index 3b9c9ef..1d8390c 100644 > > --- a/drivers/hv/hv_util.c > > +++ b/drivers/hv/hv_util.c > > @@ -51,11 +51,30 @@ > > #define HB_WS2008_MAJOR1 > > #define HB_WS2008_VERSION (HB_WS2008_MAJOR << 16 | HB_MINOR) > > > > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ > > If you wanted you could say: > > #define TIMESAMPLE_INTERVAL (5 * NSEC_PER_SEC) ULL ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/5] staging: comedi: usbdux: introduce usbduxsub_ao_handle_urb()
Factor the urb handling and resubmit out of the analog output urb completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Bernd Porr Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 130 +++- 1 file changed, 62 insertions(+), 68 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 89f6ece..5fdbf26 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -399,69 +399,25 @@ static int usbdux_ao_cancel(struct comedi_device *dev, return 0; } -static void usbduxsub_ao_isoc_irq(struct urb *urb) +static void usbduxsub_ao_handle_urb(struct comedi_device *dev, + struct comedi_subdevice *s, + struct urb *urb) { - struct comedi_device *dev = urb->context; - struct comedi_subdevice *s = dev->write_subdev; struct usbdux_private *devpriv = dev->private; - struct comedi_cmd *cmd = &s->async->cmd; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; uint8_t *datap; int ret; int i; - switch (urb->status) { - case 0: - /* success */ - break; - - case -ECONNRESET: - case -ENOENT: - case -ESHUTDOWN: - case -ECONNABORTED: - /* after an unlink command, unplug, ... etc */ - /* no unlink needed here. Already shutting down. */ - if (devpriv->ao_cmd_running) { - s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s); - usbdux_ao_stop(dev, 0); - } - return; - - default: - /* a real error */ - if (devpriv->ao_cmd_running) { - dev_err(dev->class_dev, - "Non-zero urb status received in ao intr context: %d\n", - urb->status); - s->async->events |= COMEDI_CB_ERROR; - s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s); - /* we do an unlink if we are in the high speed mode */ - usbdux_ao_stop(dev, 0); - } - return; - } - - /* are we actually running? */ - if (!devpriv->ao_cmd_running) - return; - - /* normal operation: executing a command in this subdevice */ devpriv->ao_counter--; - if ((int)devpriv->ao_counter <= 0) { - /* timer zero */ + if (devpriv->ao_counter == 0) { devpriv->ao_counter = devpriv->ao_timer; - /* handle non continous acquisition */ if (cmd->stop_src == TRIG_COUNT) { - /* fixed number of samples */ devpriv->ao_sample_count--; if (devpriv->ao_sample_count < 0) { - /* all samples transmitted */ - usbdux_ao_stop(dev, 0); - s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s); - /* no resubmit of the urb */ + async->events |= COMEDI_CB_EOA; return; } } @@ -473,26 +429,26 @@ static void usbduxsub_ao_isoc_irq(struct urb *urb) unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned short val; - ret = comedi_buf_get(s, &val); - if (ret < 0) { + if (!comedi_buf_get(s, &val)) { dev_err(dev->class_dev, "buffer underflow\n"); - s->async->events |= (COMEDI_CB_EOA | -COMEDI_CB_OVERFLOW); + async->events |= COMEDI_CB_OVERFLOW; + return; } + /* pointer to the DA */ *datap++ = val & 0xff; *datap++ = (val >> 8) & 0xff; *datap++ = chan << 6; s->readback[chan] = val; - - s->async->events |= COMEDI_CB_BLOCK; - comedi_event(dev, s); } + async->events |= COMEDI_CB_BLOCK; } - urb->transfer_buffer_length = SIZEOUTBUF; - urb->dev = comedi_to_usb_dev(dev); - urb->status = 0; - if (devpriv->ao_cmd_running) { + + /* if command is still running, r
[PATCH 2/5] staging: comedi: usbdux: introduce usbduxsub_ai_handle_urb()
Factor the urb handling and resubmit out of the analog input urb completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Bernd Porr Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbdux.c | 174 +++- 1 file changed, 79 insertions(+), 95 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbdux.c b/drivers/staging/comedi/drivers/usbdux.c index 5fdbf26..eae441f 100644 --- a/drivers/staging/comedi/drivers/usbdux.c +++ b/drivers/staging/comedi/drivers/usbdux.c @@ -250,128 +250,112 @@ static int usbdux_ai_cancel(struct comedi_device *dev, return 0; } -/* analogue IN - interrupt service routine */ +static void usbduxsub_ai_handle_urb(struct comedi_device *dev, + struct comedi_subdevice *s, + struct urb *urb) +{ + struct usbdux_private *devpriv = dev->private; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + int ret; + int i; + + devpriv->ai_counter--; + if (devpriv->ai_counter == 0) { + devpriv->ai_counter = devpriv->ai_timer; + + if (cmd->stop_src == TRIG_COUNT) { + devpriv->ai_sample_count--; + if (devpriv->ai_sample_count < 0) { + async->events |= COMEDI_CB_EOA; + return; + } + } + + /* get the data from the USB bus and hand it over to comedi */ + for (i = 0; i < cmd->chanlist_len; i++) { + unsigned int range = CR_RANGE(cmd->chanlist[i]); + uint16_t val = le16_to_cpu(devpriv->in_buf[i]); + + /* bipolar data is two's-complement */ + if (comedi_range_is_bipolar(s, range)) + val ^= ((s->maxdata + 1) >> 1); + + /* transfer data */ + if (!comedi_buf_put(s, val)) + return; + } + async->events |= COMEDI_CB_BLOCK | COMEDI_CB_EOS; + } + + /* if command is still running, resubmit urb */ + if (!(async->events & COMEDI_CB_CANCEL_MASK)) { + urb->dev = comedi_to_usb_dev(dev); + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret < 0) { + dev_err(dev->class_dev, + "urb resubmit failed in int-context! err=%d\n", + ret); + if (ret == -EL2NSYNC) + dev_err(dev->class_dev, + "buggy USB host controller or bug in IRQ handler!\n"); + async->events |= COMEDI_CB_ERROR; + } + } +} + static void usbduxsub_ai_isoc_irq(struct urb *urb) { struct comedi_device *dev = urb->context; struct comedi_subdevice *s = dev->read_subdev; + struct comedi_async *async = s->async; struct usbdux_private *devpriv = dev->private; - struct comedi_cmd *cmd = &s->async->cmd; - int i, err; - /* first we test if something unusual has just happened */ + /* exit if not running a command, do not resubmit urb */ + if (!devpriv->ai_cmd_running) + return; + switch (urb->status) { case 0: /* copy the result in the transfer buffer */ memcpy(devpriv->in_buf, urb->transfer_buffer, SIZEINBUF); + usbduxsub_ai_handle_urb(dev, s, urb); break; + case -EILSEQ: - /* error in the ISOchronous data */ - /* we don't copy the data into the transfer buffer */ - /* and recycle the last data byte */ + /* +* error in the ISOchronous data +* we don't copy the data into the transfer buffer +* and recycle the last data byte +*/ dev_dbg(dev->class_dev, "CRC error in ISO IN stream\n"); + usbduxsub_ai_handle_urb(dev, s, urb); break; case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: case -ECONNABORTED: - /* happens after an unlink command */ - if (devpriv->ai_cmd_running) { - s->async->events |= COMEDI_CB_EOA; - s->async->events |= COMEDI_CB_ERROR; - comedi_event(dev, s); - /* stop the transfer w/o unlink */ - usbdux_ai_stop(dev, 0); - } - return; + /* after an unlink command, unplug, ... etc */ + async->events |= COMEDI_CB
[PATCH 3/5] staging: comedi: usbduxfast: introduce usbduxfast_ai_handle_urb()
Factor the urb handling and resubmit out of the completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Bernd Porr Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxfast.c | 131 +++- 1 file changed, 52 insertions(+), 79 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxfast.c b/drivers/staging/comedi/drivers/usbduxfast.c index cddc2ba..95c2ec7 100644 --- a/drivers/staging/comedi/drivers/usbduxfast.c +++ b/drivers/staging/comedi/drivers/usbduxfast.c @@ -236,114 +236,87 @@ static int usbduxfast_ai_cancel(struct comedi_device *dev, return ret; } -/* - * analogue IN - * interrupt service routine - */ +static void usbduxfast_ai_handle_urb(struct comedi_device *dev, +struct comedi_subdevice *s, +struct urb *urb) +{ + struct usbduxfast_private *devpriv = dev->private; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + int ret; + + if (devpriv->ignore) { + devpriv->ignore--; + } else { + unsigned int nbytes = urb->actual_length; + + if (cmd->stop_src == TRIG_COUNT) { + unsigned int nsamples = nbytes / bytes_per_sample(s); + + if (devpriv->ai_sample_count < nsamples) { + nsamples = devpriv->ai_sample_count; + async->events |= COMEDI_CB_EOA; + } + devpriv->ai_sample_count -= nsamples; + nbytes = nsamples * bytes_per_sample(s); + } + + cfc_write_array_to_buffer(s, urb->transfer_buffer, nbytes); + } + + /* if command is still running, resubmit urb for BULK transfer */ + if (!(async->events & COMEDI_CB_CANCEL_MASK)) { + urb->dev = comedi_to_usb_dev(dev); + urb->status = 0; + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret < 0) { + dev_err(dev->class_dev, "urb resubm failed: %d", ret); + async->events |= COMEDI_CB_ERROR; + } + } +} + static void usbduxfast_ai_interrupt(struct urb *urb) { struct comedi_device *dev = urb->context; struct comedi_subdevice *s = dev->read_subdev; struct comedi_async *async = s->async; - struct comedi_cmd *cmd = &async->cmd; - struct usb_device *usb = comedi_to_usb_dev(dev); struct usbduxfast_private *devpriv = dev->private; - int n, err; - /* are we running a command? */ - if (unlikely(!devpriv->ai_cmd_running)) { - /* -* not running a command -* do not continue execution if no asynchronous command -* is running in particular not resubmit -*/ + /* exit if not running a command, do not resubmit urb */ + if (!devpriv->ai_cmd_running) return; - } - /* first we test if something unusual has just happened */ switch (urb->status) { case 0: + usbduxfast_ai_handle_urb(dev, s, urb); break; - /* -* happens after an unlink command or when the device -* is plugged out -*/ case -ECONNRESET: case -ENOENT: case -ESHUTDOWN: case -ECONNABORTED: - /* tell this comedi */ - async->events |= COMEDI_CB_EOA; + /* after an unlink command, unplug, ... etc */ async->events |= COMEDI_CB_ERROR; - comedi_event(dev, s); - /* stop the transfer w/o unlink */ - usbduxfast_ai_stop(dev, 0); - return; + break; default: + /* a real error */ dev_err(dev->class_dev, "non-zero urb status received in ai intr context: %d\n", urb->status); - async->events |= COMEDI_CB_EOA; async->events |= COMEDI_CB_ERROR; - comedi_event(dev, s); - usbduxfast_ai_stop(dev, 0); - return; - } - - if (!devpriv->ignore) { - if (cmd->stop_src == TRIG_COUNT) { - /* not continuous, fixed number of samples */ - n = urb->actual_length / sizeof(uint16_t); - if (unlikely(devpriv->ai_sample_count < n)) { - unsigned int num_bytes; - - /* partial sample received */ - num_bytes = devpriv->ai_sample_count * - sizeof(ui
[PATCH 0/5] staging: comedi: usbdux drivers: tidy up urb completion
Tidy up the usb completion functions in the usbdux drivers by introducing some helper functions to handle and resubmit the successful urbs. This allows a common exit path to be used in the completion handler to stop the async command, if necessary, and handle the events. This series applies after: [PATCH 0/2] staging: comedi: tidy up the async event defines H Hartley Sweeten (5): staging: comedi: usbdux: introduce usbduxsub_ao_handle_urb() staging: comedi: usbdux: introduce usbduxsub_ai_handle_urb() staging: comedi: usbduxfast: introduce usbduxfast_ai_handle_urb() staging: comedi: usbduxsigma: introduce usbduxsigma_ao_handle_urb() staging: comedi: usbduxsigma: introduce usbduxsigma_ai_handle_urb() drivers/staging/comedi/drivers/usbdux.c | 304 +- drivers/staging/comedi/drivers/usbduxfast.c | 131 +--- drivers/staging/comedi/drivers/usbduxsigma.c | 305 +-- 3 files changed, 345 insertions(+), 395 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/5] staging: comedi: usbduxsigma: introduce usbduxsigma_ai_handle_urb()
Factor the urb handling and resubmit out of the analog input urb completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Bernd Porr Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 157 +-- 1 file changed, 76 insertions(+), 81 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index 985c6f0..1d12cc6 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -211,23 +211,80 @@ static int usbduxsigma_ai_cancel(struct comedi_device *dev, return 0; } -static void usbduxsigma_ai_urb_complete(struct urb *urb) +static void usbduxsigma_ai_handle_urb(struct comedi_device *dev, + struct comedi_subdevice *s, + struct urb *urb) { - struct comedi_device *dev = urb->context; struct usbduxsigma_private *devpriv = dev->private; - struct comedi_subdevice *s = dev->read_subdev; - struct comedi_cmd *cmd = &s->async->cmd; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; unsigned int dio_state; uint32_t val; int ret; int i; - /* first we test if something unusual has just happened */ + devpriv->ai_counter--; + if (devpriv->ai_counter == 0) { + devpriv->ai_counter = devpriv->ai_timer; + + if (cmd->stop_src == TRIG_COUNT) { + devpriv->ai_sample_count--; + if (devpriv->ai_sample_count < 0) { + async->events |= COMEDI_CB_EOA; + return; + } + } + + /* get the state of the dio pins to allow external trigger */ + dio_state = be32_to_cpu(devpriv->in_buf[0]); + + /* get the data from the USB bus and hand it over to comedi */ + for (i = 0; i < cmd->chanlist_len; i++) { + /* transfer data, note first byte is the DIO state */ + val = be32_to_cpu(devpriv->in_buf[i+1]); + val &= 0x00ff; /* strip status byte */ + val ^= 0x0080; /* convert to unsigned */ + + if (!cfc_write_array_to_buffer(s, &val, + sizeof(uint32_t))) + return; + } + } + + /* if command is still running, resubmit urb */ + if (!(async->events & COMEDI_CB_CANCEL_MASK)) { + urb->dev = comedi_to_usb_dev(dev); + ret = usb_submit_urb(urb, GFP_ATOMIC); + if (ret < 0) { + dev_err(dev->class_dev, + "%s: urb resubmit failed (%d)\n", + __func__, ret); + if (ret == -EL2NSYNC) + dev_err(dev->class_dev, + "buggy USB host controller or bug in IRQ handler\n"); + async->events |= COMEDI_CB_ERROR; + } + } +} + +static void usbduxsigma_ai_urb_complete(struct urb *urb) +{ + struct comedi_device *dev = urb->context; + struct usbduxsigma_private *devpriv = dev->private; + struct comedi_subdevice *s = dev->read_subdev; + struct comedi_async *async = s->async; + + /* exit if not running a command, do not resubmit urb */ + if (!devpriv->ai_cmd_running) + return; + switch (urb->status) { case 0: /* copy the result in the transfer buffer */ memcpy(devpriv->in_buf, urb->transfer_buffer, SIZEINBUF); + usbduxsigma_ai_handle_urb(dev, s, urb); break; + case -EILSEQ: /* * error in the ISOchronous data @@ -235,7 +292,7 @@ static void usbduxsigma_ai_urb_complete(struct urb *urb) * and recycle the last data byte */ dev_dbg(dev->class_dev, "CRC error in ISO IN stream\n"); - + usbduxsigma_ai_handle_urb(dev, s, urb); break; case -ECONNRESET: @@ -243,86 +300,24 @@ static void usbduxsigma_ai_urb_complete(struct urb *urb) case -ESHUTDOWN: case -ECONNABORTED: /* happens after an unlink command */ - if (devpriv->ai_cmd_running) { - usbduxsigma_ai_stop(dev, 0);/* w/o unlink */ - /* we are still running a command, tell comedi */ - s->async->events |= (COMEDI_CB_EOA | COMEDI_CB_ERROR); - comedi_event(
[PATCH 4/5] staging: comedi: usbduxsigma: introduce usbduxsigma_ao_handle_urb()
Factor the urb handling and resubmit out of the analog output urb completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Bernd Porr Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/usbduxsigma.c | 148 ++- 1 file changed, 76 insertions(+), 72 deletions(-) diff --git a/drivers/staging/comedi/drivers/usbduxsigma.c b/drivers/staging/comedi/drivers/usbduxsigma.c index a869e38..985c6f0 100644 --- a/drivers/staging/comedi/drivers/usbduxsigma.c +++ b/drivers/staging/comedi/drivers/usbduxsigma.c @@ -349,62 +349,25 @@ static int usbduxsigma_ao_cancel(struct comedi_device *dev, return 0; } -static void usbduxsigma_ao_urb_complete(struct urb *urb) +static void usbduxsigma_ao_handle_urb(struct comedi_device *dev, + struct comedi_subdevice *s, + struct urb *urb) { - struct comedi_device *dev = urb->context; struct usbduxsigma_private *devpriv = dev->private; - struct comedi_subdevice *s = dev->write_subdev; - struct comedi_cmd *cmd = &s->async->cmd; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; uint8_t *datap; int ret; int i; - switch (urb->status) { - case 0: - /* success */ - break; - - case -ECONNRESET: - case -ENOENT: - case -ESHUTDOWN: - case -ECONNABORTED: - /* happens after an unlink command */ - if (devpriv->ao_cmd_running) { - usbduxsigma_ao_stop(dev, 0);/* w/o unlink */ - s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s); - } - return; - - default: - /* a real error */ - if (devpriv->ao_cmd_running) { - dev_err(dev->class_dev, - "%s: non-zero urb status (%d)\n", - __func__, urb->status); - usbduxsigma_ao_stop(dev, 0);/* w/o unlink */ - s->async->events |= (COMEDI_CB_ERROR | COMEDI_CB_EOA); - comedi_event(dev, s); - } - return; - } - - if (!devpriv->ao_cmd_running) - return; - devpriv->ao_counter--; - if ((int)devpriv->ao_counter <= 0) { - /* timer zero, transfer from comedi */ + if (devpriv->ao_counter == 0) { devpriv->ao_counter = devpriv->ao_timer; if (cmd->stop_src == TRIG_COUNT) { - /* not continuous, fixed number of samples */ devpriv->ao_sample_count--; if (devpriv->ao_sample_count < 0) { - usbduxsigma_ao_stop(dev, 0);/* w/o unlink */ - /* acquistion is over, tell comedi */ - s->async->events |= COMEDI_CB_EOA; - comedi_event(dev, s); + async->events |= COMEDI_CB_EOA; return; } } @@ -416,44 +379,85 @@ static void usbduxsigma_ao_urb_complete(struct urb *urb) unsigned int chan = CR_CHAN(cmd->chanlist[i]); unsigned short val; - ret = comedi_buf_get(s, &val); - if (ret < 0) { + if (!comedi_buf_get(s, &val)) { dev_err(dev->class_dev, "buffer underflow\n"); - s->async->events |= (COMEDI_CB_EOA | -COMEDI_CB_OVERFLOW); + async->events |= COMEDI_CB_OVERFLOW; + return; } + *datap++ = val; *datap++ = chan; s->readback[chan] = val; - - s->async->events |= COMEDI_CB_BLOCK; - comedi_event(dev, s); } + async->events |= COMEDI_CB_BLOCK; } - urb->transfer_buffer_length = SIZEOUTBUF; - urb->dev = comedi_to_usb_dev(dev); - urb->status = 0; - if (devpriv->high_speed) - urb->interval = 8; /* uframes */ - else - urb->interval = 1; /* frames */ - urb->number_of_packets = 1; - urb->iso_frame_desc[0].offset = 0; - urb->iso_frame_desc[0].length = SIZEOUTBUF; - urb->iso_frame_desc[0].status = 0; - ret = usb_submit_urb(urb, GFP_ATOMIC); - if (ret < 0) { - dev_err(dev->class_dev, -
[PATCH net-next, v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
In case that the IP header has optional field at the end, this patch will get the port numbers after that field, and compute the hash. Signed-off-by: Haiyang Zhang Reviewed-by: K. Y. Srinivasan --- drivers/net/hyperv/netvsc_drv.c | 16 ++-- 1 files changed, 10 insertions(+), 6 deletions(-) diff --git a/drivers/net/hyperv/netvsc_drv.c b/drivers/net/hyperv/netvsc_drv.c index 0fcb5e7..0d60c91 100644 --- a/drivers/net/hyperv/netvsc_drv.c +++ b/drivers/net/hyperv/netvsc_drv.c @@ -162,7 +162,7 @@ union sub_key { * data: network byte order * return: host byte order */ -static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) +static u32 comp_hash(u8 *key, int klen, void *data, int dlen) { union sub_key subk; int k_next = 4; @@ -176,7 +176,7 @@ static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) for (i = 0; i < dlen; i++) { subk.kb = key[k_next]; k_next = (k_next + 1) % klen; - dt = data[i]; + dt = ((u8 *)data)[i]; for (j = 0; j < 8; j++) { if (dt & 0x80) ret ^= subk.ka; @@ -191,6 +191,7 @@ static u32 comp_hash(u8 *key, int klen, u8 *data, int dlen) static bool netvsc_set_hash(u32 *hash, struct sk_buff *skb) { struct iphdr *iphdr; + __be32 dbuf[3]; int data_len; bool ret = false; @@ -200,12 +201,15 @@ static bool netvsc_set_hash(u32 *hash, struct sk_buff *skb) iphdr = ip_hdr(skb); if (iphdr->version == 4) { - if (iphdr->protocol == IPPROTO_TCP) + dbuf[0] = iphdr->saddr; + dbuf[1] = iphdr->daddr; + if (iphdr->protocol == IPPROTO_TCP) { + dbuf[2] = *(__be32 *)&tcp_hdr(skb)->source; data_len = 12; - else + } else { data_len = 8; - *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, - (u8 *)&iphdr->saddr, data_len); + } + *hash = comp_hash(netvsc_hash_key, HASH_KEYLEN, dbuf, data_len); ret = true; } -- 1.7.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: lustre: lustre: libcfs: debug.c: Cleaning up unnecessary use of memset in conjunction with strncpy
2014-09-19 0:39 GMT+02:00 Dan Carpenter : > On Thu, Sep 18, 2014 at 09:57:17PM +0200, Rickard Strandqvist wrote: >> >> Should I add this as a patch in lib/string.c or email him first.. What >> is customary in these situations? >> > > Just write up a normal patch and try to merge it through the normal > methods. > > It's not that controversial to do: > > strncpy(dest, src, n); > dest[n] = '\0'; > > That's what we have been open coding all over the place anyway already. Hi Dan! I have tried the function strzcpy that we talk about, but it has not happened anything:-( Is there anything else I can do? Kind regards Rickard Strandqvist ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next,v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
From: Haiyang Zhang Date: Tue, 14 Oct 2014 15:16:28 -0700 > In case that the IP header has optional field at the end, this patch will > get the port numbers after that field, and compute the hash. > > Signed-off-by: Haiyang Zhang > Reviewed-by: K. Y. Srinivasan Instead of adding hack after hack after hack to your internal header parser, just use the generic flow dissector we already have in the kernel to fetch out the values you need. __skb_flow_get_ports() etc. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/5] staging: comedi: usbdux: introduce usbduxsub_ao_handle_urb()
On 14/10/2014 20:14, H Hartley Sweeten wrote: Factor the urb handling and resubmit out of the analog output urb completion handler and tidy it up. This allows a common exit path to be used in the completion handler to stop the async command and handle the events. Signed-off-by: H Hartley Sweeten Reviewed-by: Bernd Porr ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/5] staging: comedi: usbdux: introduce usbduxsub_ai_handle_urb()
Signed-off-by: H Hartley Sweeten Reviewed-by: Bernd Porr ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/5] staging: comedi: usbduxfast: introduce usbduxfast_ai_handle_urb()
Signed-off-by: H Hartley Sweeten Reviewed-by: Bernd Porr ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 5/5] staging: comedi: usbduxsigma: introduce usbduxsigma_ai_handle_urb()
Signed-off-by: H Hartley Sweeten Reviewed-by: Bernd Porr ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/5] staging: comedi: usbduxsigma: introduce usbduxsigma_ao_handle_urb()
Signed-off-by: H Hartley Sweeten Reviewed-by: Bernd Porr ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next, v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
> -Original Message- > From: Haiyang Zhang [mailto:haiya...@microsoft.com] > Sent: Tuesday, October 14, 2014 4:05 PM > To: da...@davemloft.net; net...@vger.kernel.org > Cc: Haiyang Zhang; KY Srinivasan; o...@aepfle.de; jasow...@redhat.com; > linux-ker...@vger.kernel.org; driverdev-devel@linuxdriverproject.org > Subject: [PATCH net-next,v2] hyperv: Add handling of IP header with > option field in netvsc_set_hash() > This is a duplicate of a patch submitted earlier today. Please ignore. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/3] scsi: Add Hyper-V logical block provisioning quirks
> "Sitsofe" == Sitsofe Wheeler writes: Sitsofe> A previous patch attempted to add a quirk to workaround this Sitsofe> but the quirk was only enabled after the features had been Sitsofe> scanned for, wouldn't work for "small" disks What does that mean, exactly? -- Martin K. Petersen Oracle Linux Engineering ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/3] scsi: add try_rc16 blacklist flag
> "Sitsofe" == Sitsofe Wheeler writes: Sitsofe> Microsoft Hyper-V virtual disks currently only claim SPC-2 Sitsofe> compliance causing the kernel skip checks for features such as Sitsofe> thin provisioning even though the virtual disk advertises them. Last time around we identified this as a problem with Microsoft's interpretation of the T10 SBC spec. And they promised that they are going to fix that. -- Martin K. Petersen Oracle Linux Engineering ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH net-next, v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
> -Original Message- > From: David Miller [mailto:da...@davemloft.net] > Sent: Tuesday, October 14, 2014 5:37 PM > To: Haiyang Zhang > Cc: net...@vger.kernel.org; KY Srinivasan; o...@aepfle.de; > jasow...@redhat.com; linux-ker...@vger.kernel.org; driverdev- > de...@linuxdriverproject.org > Subject: Re: [PATCH net-next,v2] hyperv: Add handling of IP header with option > field in netvsc_set_hash() > > From: Haiyang Zhang > Date: Tue, 14 Oct 2014 15:16:28 -0700 > > > In case that the IP header has optional field at the end, this patch > > will get the port numbers after that field, and compute the hash. > > > > Signed-off-by: Haiyang Zhang > > Reviewed-by: K. Y. Srinivasan > > Instead of adding hack after hack after hack to your internal header parser, > just > use the generic flow dissector we already have in the kernel to fetch out the > values you need. > > __skb_flow_get_ports() etc. Thanks. I will update the patch. - Haiyang ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next,v2] hyperv: Add handling of IP header with option field in netvsc_set_hash()
From: Haiyang Zhang Date: Tue, 14 Oct 2014 20:05:17 + > In case that the IP header has optional field at the end, this patch will > get the port numbers after that field, and compute the hash. > > Signed-off-by: Haiyang Zhang > Reviewed-by: K. Y. Srinivasan This isn't even close to what I asked for. I said to remove all of this by-hand header parsing code in the hyperv driver, and use the generic code networking facilities that exist already to do this. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 2/3] scsi: add try_rc16 blacklist flag
> -Original Message- > From: Martin K. Petersen [mailto:martin.peter...@oracle.com] > Sent: Tuesday, October 14, 2014 6:08 PM > To: Sitsofe Wheeler > Cc: KY Srinivasan; Haiyang Zhang; Christoph Hellwig; Hannes Reinecke; linux- > s...@vger.kernel.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; James E.J. Bottomley > Subject: Re: [PATCH 2/3] scsi: add try_rc16 blacklist flag > > > "Sitsofe" == Sitsofe Wheeler writes: > > Sitsofe> Microsoft Hyper-V virtual disks currently only claim SPC-2 > Sitsofe> compliance causing the kernel skip checks for features such as > Sitsofe> thin provisioning even though the virtual disk advertises them. > > Last time around we identified this as a problem with Microsoft's > interpretation of the T10 SBC spec. And they promised that they are going to > fix that. It has been fixed in windows 10 and a bug has been opened for earlier hosts. K. Y > > -- > Martin K. PetersenOracle Linux Engineering ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] hyperv: Implement Time Synchronization using host time sample
These old duplicated patches are accidentally send by the mail server... Sorry for that. > -Original Message- > From: Thomas Shao [mailto:huis...@microsoft.com] > Sent: Tuesday, October 14, 2014 1:49 PM > To: t...@linutronix.de; gre...@linuxfoundation.org; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; o...@aepfle.de; > a...@canonical.com; jasow...@redhat.com; KY Srinivasan > Cc: Thomas Shao > Subject: [PATCH] hyperv: Implement Time Synchronization using host time > sample > > In current hyper-v time sync service,it only gets the initial clock time from > the > host. It didn't process the following time samples. This change introduced a > module parameter called host_time_sync. If it is set to true, the guest will > periodically sychronize it's time with the host clock using host time sample. > By > default it is disabled, because we still recommend user to configure NTP for > time synchronization. > > Signed-off-by: Thomas Shao > Reviewed-by: K. Y. Srinivasan > --- > drivers/hv/hv_util.c | 114 > +--- > kernel/time/timekeeping.c |1 + > 2 files changed, 107 insertions(+), 8 deletions(-) > > diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index > 3b9c9ef..1d8390c > 100644 > --- a/drivers/hv/hv_util.c > +++ b/drivers/hv/hv_util.c > @@ -51,11 +51,30 @@ > #define HB_WS2008_MAJOR 1 > #define HB_WS2008_VERSION(HB_WS2008_MAJOR << 16 | HB_MINOR) > > +#define TIMESAMPLE_INTERVAL 50L /* 5s in nanosecond */ > + > +/*host sends time sample for every 5s.So the max polling interval *is > +128*5 = 640s. > +*/ > +#define TIME_ADJ_MAX_INTERVAL 128 /*Max polling interval */ > + > static int sd_srv_version; > static int ts_srv_version; > static int hb_srv_version; > static int util_fw_version; > > +/*host sends time sample for every 5s.So the initial polling interval > +*is 5s. > +*/ > +static s32 adj_interval = 1; > + > +/*The host_time_sync module parameter is used to control the time > + sync between host and guest. > +*/ > +static bool host_time_sync; > +module_param(host_time_sync, bool, (S_IRUGO | S_IWUSR)); > +MODULE_PARM_DESC(host_time_sync, "If the guest sync time with host"); > + > static void shutdown_onchannelcallback(void *context); static struct > hv_util_service util_shutdown = { > .util_cb = shutdown_onchannelcallback, @@ -163,15 +182,61 @@ > static void shutdown_onchannelcallback(void *context) > /* > * Set guest time to host UTC time. > */ > -static inline void do_adj_guesttime(u64 hosttime) > +static inline void do_adj_guesttime(u64 hosttime, bool forceSync) > { > - s64 host_tns; > - struct timespec host_ts; > + s64 host_tns, guest_tns, diff; > + struct timespec host_ts, guest_ts; > + struct timex txc; > + s64 tickchg; > + int diff_sign; > > host_tns = (hosttime - WLTIMEDELTA) * 100; > host_ts = ns_to_timespec(host_tns); > > - do_settimeofday(&host_ts); > + if (forceSync) { > + do_settimeofday(&host_ts); > + } else { > + guest_ts = CURRENT_TIME; > + guest_tns = timespec_to_ns(&guest_ts); > + diff = host_tns - guest_tns; > + if (diff >= 0) { > + diff_sign = 1; > + } else { > + diff_sign = -1; > + diff = -diff; > + } > + > + /*1s in nanosecond */ > + if (diff > 10 || diff < -10) { > + do_settimeofday(&host_ts); > + return; > + } > + > + /*1ms in nanosecond */ > + if (diff > 100 || diff < -100) { > + /* get the current tick value */ > + txc.modes = 0; > + do_adjtimex(&txc); > + > + tickchg = diff * TICK_USEC / > + (TIMESAMPLE_INTERVAL * > adj_interval); > + > + if (tickchg > TICK_USEC/10) > + tickchg = TICK_USEC/10; > + > + if (txc.tick == TICK_USEC + diff_sign * tickchg) > + return; > + > + txc.modes = ADJ_TICK; > + txc.tick = TICK_USEC + diff_sign * tickchg; > + > + do_adjtimex(&txc); > + } else { > + /* double the polling interval*/ > + if (adj_interval < TIME_ADJ_MAX_INTERVAL) > + adj_interval = adj_interval * 2; > + } > + } > } > > /* > @@ -179,8 +244,9 @@ static inline void do_adj_guesttime(u64 hosttime) > */ > > struct adj_time_work { > - struct work_struct work; > + struct work_struct work; > u64 host_time; > + boolforceSync; > }; > > static void hv_set_host_time(struct work_struct *work) @@ -188,7 +254,7 > @@ static void hv_set_host_time(struct work