Re: [PATCH net-next 4/5] treewide: replace dev->trans_start update with helper
Hi, Florian Westphal writes: > Replace all trans_start updates with netif_trans_update helper. > change was done via spatch: > > struct net_device *d; > @@ > - d->trans_start = jiffies > + netif_trans_update(d) > > Compile tested only. > > Cc: user-mode-linux-de...@lists.sourceforge.net > Cc: linux-xte...@linux-xtensa.org > Cc: linux1394-de...@lists.sourceforge.net > Cc: linux-r...@vger.kernel.org > Cc: net...@vger.kernel.org > Cc: mpt-fusionlinux@broadcom.com > Cc: linux-s...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-par...@vger.kernel.org > Cc: linux-o...@vger.kernel.org > Cc: linux-h...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-wirel...@vger.kernel.org > Cc: linux-s...@vger.kernel.org > Cc: de...@driverdev.osuosl.org > Cc: b.a.t.m@lists.open-mesh.org > Cc: linux-blueto...@vger.kernel.org > Signed-off-by: Florian Westphal > --- for u_ether.c: Acked-by: Felipe Balbi > diff --git a/drivers/usb/gadget/function/u_ether.c > b/drivers/usb/gadget/function/u_ether.c > index 637809e..a3f7e7c 100644 > --- a/drivers/usb/gadget/function/u_ether.c > +++ b/drivers/usb/gadget/function/u_ether.c > @@ -597,7 +597,7 @@ static netdev_tx_t eth_start_xmit(struct sk_buff *skb, > DBG(dev, "tx queue err %d\n", retval); > break; > case 0: > - net->trans_start = jiffies; > + netif_trans_update(net); > atomic_inc(&dev->tx_qlen); > } -- balbi signature.asc Description: PGP signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/6] Intel Secure Guard Extensions
On Tue, May 03, 2016 at 05:38:40PM +0200, Pavel Machek wrote: > Hi! Good morning, I hope everyone's day is starting out well. > > I told my associates the first time I reviewed this technology that > > SGX has the ability to be a bit of a Pandora's box and it seems to be > > following that course. > Can you elaborate on the Pandora's box? System administrator should > be able to disable SGX on the system, and use system to do anything > that could be done with the older CPUs, right? Correct, there is certainly the on/off switch. I viewed it as a Pandora's box secondary to the fact that it was the first commodity based shrouded TEE that had the opportunity for significant market penetration. As such and secondary to its technical characteristics, it has the potential for both good and bad and like TXT in the last decade it was/is bound to induce significant debate secondary to software freedom and potential monopolistic practices. > > Intel is obviously cognizant of the risk surrounding illicit uses of > > this technology since it clearly calls out that, by agreeing to have > > their key signed, a developer agrees to not implement nefarious or > > privacy invasive software. Given the known issues that Certificate > Yeah, that's likely to work ... not :-(. "It is not spyware, it is > just collecting some anonymous statistics." The notion that an enclave can look out but could not be looked into introduces privacy issues into the conversation, see my reflections on Pandoras box... :-) > > domination and control. They probably have enough on their hands with > > attempting to convert humanity to FPGA's and away from devices which > > are capable of maintaining a context of exection... :-) > Heh. FPGAs are not designed to replace CPUs anytime soon... And > probably never. Never is a long time. Intel has clearly drawn a very significant line in the sand with respect to FPGA technology if you read Krzanich's reflections regarding his re-organization of Intel. Whether or not they are successful, they are going to declare a demarcation point with respect to IOT devices which has the potential to impact the industry in general and security in particular. On one side are going to be FPGA based devices and on the other side devices with a context of execution. I doesn't require a long stretch of the imagination to see hordes of IOT devices with specific behaviors burned into them which export sensor or telemetry data upstream. Depending on how successful they are with the Altera acquisition there are potentially positive economic security factors which could be in play. All of that is certainly not a conversation specific to SGX though. > > In the TL;DR department I would highly recommend that anyone > > interested in all of this read MIT's 170+ page review of the > > technology before jumping to any conclusions :-) > Would you have links for 1-5? First off my apologies to the list as I loathe personal inaccuracy, the MIT review paper is only 117 pages long. I was typing the last e-mail at 0405 in the morning and was scrambling for the opportunity to get 50 minutes of sleep so my proofreading was sloppy... :-) The following should provide ample bedstand reading material for those interested in SGX and TEE's: 1.) HASP/SGX paper: https://software.intel.com/sites/default/files/article/413939/hasp-2013-innovative-technology-for-attestation-and-sealing.pdf 2.) IAGO threat model: https://cseweb.ucsd.edu/~hovav/dist/iago.pdf 3.) Haven paper: http://research.microsoft.com/pubs/223450/osdi2014-haven.pdf 4.) Controlled sidechannel attacks: http://research.microsoft.com/pubs/246400/ctrlchannels-oakland-2015.pdf https://software.intel.com/en-us/blogs/2015/05/19/look-both-ways-and-watch-out-for-side-channels 5.) MIT/SGX analysis: https://eprint.iacr.org/2016/086.pdf > Thanks, > Pavel No problem, enjoy the reading :-) Have a good day. Greg As always, Dr. G.W. Wettstein, Ph.D. Enjellic Systems Development, LLC. 4206 N. 19th Ave. Specializing in information infra-structure Fargo, ND 58102development. PH: 701-281-1686 FAX: 701-281-3949 EMAIL: g...@enjellic.com -- "One problem with monolithic business structures is losing sight of the fundamental importance of mathematics. Consider committees; commonly forgotten is the relationship that given a projection of N individuals to complete an assignment the most effective number of people to assign to the committee is given by f(N) = N - (N-1)." -- Dr. G.W. Wettstein Guerrilla Tactics for Corporate Survival ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/6] Intel Secure Guard Extensions
Hi! > Good morning, I hope everyone's day is starting out well. :-). Rainy day here. > > > In the TL;DR department I would highly recommend that anyone > > > interested in all of this read MIT's 170+ page review of the > > > technology before jumping to any conclusions :-) > > > Would you have links for 1-5? > > First off my apologies to the list as I loathe personal inaccuracy, > the MIT review paper is only 117 pages long. I was typing the last > e-mail at 0405 in the morning and was scrambling for the opportunity > to get 50 minutes of sleep so my proofreading was sloppy... :-) Thanks a lot for the links, I'd still say it was more accurate than average for the lkml. Best regards, Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next 4/5] treewide: replace dev->trans_start update with helper
On Tuesday 03 May 2016 08:03 PM, Florian Westphal wrote: > Replace all trans_start updates with netif_trans_update helper. > change was done via spatch: > > struct net_device *d; > @@ > - d->trans_start = jiffies > + netif_trans_update(d) > > Compile tested only. > > Cc: user-mode-linux-de...@lists.sourceforge.net > Cc: linux-xte...@linux-xtensa.org > Cc: linux1394-de...@lists.sourceforge.net > Cc: linux-r...@vger.kernel.org > Cc: net...@vger.kernel.org > Cc: mpt-fusionlinux@broadcom.com > Cc: linux-s...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-par...@vger.kernel.org > Cc: linux-o...@vger.kernel.org > Cc: linux-h...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-wirel...@vger.kernel.org > Cc: linux-s...@vger.kernel.org > Cc: de...@driverdev.osuosl.org > Cc: b.a.t.m@lists.open-mesh.org > Cc: linux-blueto...@vger.kernel.org > Signed-off-by: Florian Westphal > --- snip... > diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c > index 0fa75a8..3d4662d 100644 > --- a/drivers/net/ethernet/ti/cpsw.c > +++ b/drivers/net/ethernet/ti/cpsw.c > @@ -1381,7 +1381,7 @@ static netdev_tx_t cpsw_ndo_start_xmit(struct sk_buff > *skb, > struct cpsw_priv *priv = netdev_priv(ndev); > int ret; > > - ndev->trans_start = jiffies; > + netif_trans_update(ndev); > > if (skb_padto(skb, CPSW_MIN_PACKET_SIZE)) { > cpsw_err(priv, tx_err, "packet pad failed\n"); for cpsw Acked-by: Mugunthan V N Regards Mugunthan V N ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Driver for Magewell PCIe capture cards
Hi There Magewell are a manufacturer of video-capture devices. They have both USB and PCIe devices. The USB devices use the upstream uvcvideo driver and Magewell currently provide proprietary drivers for their PCIe products. http://www.magewell.com/ I've approached Magewell about having upstream Linux drivers for these PCIe devices and they are open to sharing hardware documentation and the sources to their proprietary drivers under an NDA for the purpose of developing an upstream Linux driver. This is where I'm hoping that the linux driver project can help out. My interest in this is that I want to be using Magewell PCIe capture cards in my company's products ( https://stb-tester.com/ ), but I don't want to be stuck with proprietary drivers. I'm hoping I can facilitate because I have some limited kernel developer experience, but I wouldn't be confident enough to write an entire v4l driver myself. Please let me know what additional information I can provide to get this process started. Thanks Will --- William Manley stb-tester.com ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] vme: change LM callback argument to void pointer
Dan, Aaron, On 3 May 2016 at 15:18, Dan Carpenter wrote: > On Tue, May 03, 2016 at 02:52:54PM +0200, Alessio Igor Bogani wrote: [...] >> It would be great since we have a lot of VME drivers (for devices not >> for bridges) which we would like see mainlined. >> Unfortunately, considering the limitations of the current VME stack >> implementation, submit these is almost useless. > > What do we need to do to make it better? We tend to put a single VME master (with Linux) into the 21 slots (which it is maximum for the standard) VME crate and fill remaining 20 slots with VME slave boards (serial ports, DAQ cards and so on). Every VME master can allocate 7/8 (memory) windows to communicate with VME slaves but, using current VME API, we can't control more than 7/8 boards at the same time unless we use VME_USER (aka VME in user-space). Unfortunately: 1) We fear that VME_USER could add unbound latencies (sorry I don't have any number) 2) VME_USER isn't usable if VME slave boards implements "release on register access" interrupt style 3) Inside an allocated memory windows there are also registers which we don't like have exposed to user-space In very briefly current VME stack don't handle (limited) resources in any way but let drivers use it. I would like to try to convert the static resource management approach to a dynamic one but I don't found the time yet. Ciao, Alessio ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/9] staging: lustre: lov: remove lov and lod stuff from obd.h
From: "John L. Hammond" Remove QOS related data structures from obd.h to the lov_internal.h. Remove the declarations of several functions that no longer exist. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/8687 Reviewed-by: Andreas Dilger Reviewed-by: Jinshan Xiong Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd.h | 60 drivers/staging/lustre/lustre/lov/lov_internal.h | 21 +++-- drivers/staging/lustre/lustre/lov/lov_obd.c | 2 - drivers/staging/lustre/lustre/lov/lov_pool.c | 15 +- 4 files changed, 18 insertions(+), 80 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/obd.h b/drivers/staging/lustre/lustre/include/obd.h index d0c0c26..2d926e0 100644 --- a/drivers/staging/lustre/lustre/include/obd.h +++ b/drivers/staging/lustre/lustre/include/obd.h @@ -166,9 +166,6 @@ struct obd_info { obd_enqueue_update_foi_cb_up; }; -void lov_stripe_lock(struct lov_stripe_md *md); -void lov_stripe_unlock(struct lov_stripe_md *md); - struct obd_type { struct list_head typ_chain; struct obd_ops *typ_dt_ops; @@ -390,45 +387,9 @@ struct ost_pool { struct rw_semaphore op_rw_sem; /* to protect ost_pool use */ }; -/* Round-robin allocator data */ -struct lov_qos_rr { - __u32 lqr_start_idx; /* start index of new inode */ - __u32 lqr_offset_idx; /* aliasing for start_idx */ - int lqr_start_count; /* reseed counter */ - struct ost_pool lqr_pool; /* round-robin optimized list */ - unsigned long lqr_dirty:1; /* recalc round-robin list */ -}; - /* allow statfs data caching for 1 second */ #define OBD_STATFS_CACHE_SECONDS 1 -struct lov_statfs_data { - struct obd_info lsd_oi; - struct obd_statfs lsd_statfs; -}; - -/* Stripe placement optimization */ -struct lov_qos { - struct list_headlq_oss_list; /* list of OSSs that targets use */ - struct rw_semaphore lq_rw_sem; - __u32 lq_active_oss_count; - unsigned intlq_prio_free; /* priority for free space */ - unsigned intlq_threshold_rr;/* priority for rr */ - struct lov_qos_rr lq_rr;/* round robin qos data */ - unsigned long lq_dirty:1, /* recalc qos data */ - lq_same_space:1,/* the ost's all have approx. -* the same space avail -*/ - lq_reset:1, /* zero current penalties */ - lq_statfs_in_progress:1; /* statfs op in - progress */ - /* qos statfs data */ - struct lov_statfs_data *lq_statfs_data; - wait_queue_head_t lq_statfs_waitq; /* waitqueue to notify statfs - * requests completion - */ -}; - struct lov_tgt_desc { struct list_head ltd_kill; struct obd_uuid ltd_uuid; @@ -441,25 +402,6 @@ struct lov_tgt_desc { ltd_reap:1; /* should this target be deleted */ }; -/* Pool metadata */ -#define pool_tgt_size(_p) _p->pool_obds.op_size -#define pool_tgt_count(_p) _p->pool_obds.op_count -#define pool_tgt_array(_p) _p->pool_obds.op_array -#define pool_tgt_rw_sem(_p) _p->pool_obds.op_rw_sem - -struct pool_desc { - char pool_name[LOV_MAXPOOLNAME + 1]; /* name of pool */ - struct ost_pool pool_obds; /* pool members */ - atomic_t pool_refcount; /* pool ref. counter */ - struct lov_qos_rr pool_rr; /* round robin qos */ - struct hlist_node pool_hash; /* access by poolname */ - struct list_headpool_list;/* serial access */ - struct dentry *pool_debugfs_entry;/* file in debugfs */ - struct obd_device*pool_lobd;/* obd of the lov/lod to which -* this pool belongs -*/ -}; - struct lov_obd { struct lov_desc desc; struct lov_tgt_desc **lov_tgts; /* sparse array */ @@ -467,8 +409,6 @@ struct lov_obd { struct mutexlov_lock; struct obd_connect_data lov_ocd; atomic_tlov_refcount; - __u32 lov_tgt_count;/* how many OBD's */ - __u32 lov_active_tgt_count; /* how many active */ __u32 lov_death_row;/* tgts scheduled to be deleted */ __u32 lov_tgt_size; /* size of tgts array */ int lov_connects; diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/l
[PATCH 6/9] staging: lustre: debug: clean up console messages
From: Andreas Dilger Clean up overly verbose console error messages, improve others. Signed-off-by: Andreas Dilger Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-1095 Reviewed-on: http://review.whamcloud.com/8617 Reviewed-by: Faccini Bruno Reviewed-by: Bob Glossman Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c| 4 +--- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 44dd3f3..96c7e9f 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -897,10 +897,8 @@ int ll_fill_super(struct super_block *sb, struct vfsmount *mnt) cfg->cfg_callback = class_config_llog_handler; /* set up client obds */ err = lustre_process_log(sb, profilenm, cfg); - if (err < 0) { - CERROR("Unable to process log: %d\n", err); + if (err < 0) goto out_free; - } /* Profile set with LCFG_MOUNTOPT so we can find our mdc and osc obds */ lprof = class_get_profile(profilenm); diff --git a/drivers/staging/lustre/lustre/obdclass/obd_mount.c b/drivers/staging/lustre/lustre/obdclass/obd_mount.c index 9474aa9..e0c90ad 100644 --- a/drivers/staging/lustre/lustre/obdclass/obd_mount.c +++ b/drivers/staging/lustre/lustre/obdclass/obd_mount.c @@ -102,7 +102,7 @@ int lustre_process_log(struct super_block *sb, char *logname, LCONSOLE_ERROR_MSG(0x15b, "%s: The configuration from log '%s' failed from the MGS (%d). Make sure this client and the MGS are running compatible versions of Lustre.\n", mgc->obd_name, logname, rc); - if (rc) + else if (rc) LCONSOLE_ERROR_MSG(0x15c, "%s: The configuration from log '%s' failed (%d). This may be the result of communication errors between this node and the MGS, a bad configuration, or other errors. See the syslog for more information.\n", mgc->obd_name, logname, rc); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/9] staging: lustre: mdt: extra checking for getattr RPC.
From: wang di Check whether getattr RPC can hold layout MD(RMF_MDT_MD), in case the client sends some invalid RPC, which can cause panic on MDT. Client will retrieve cl_max_md_size/cl_default_md_size from MDS during mount process, so it will initialize cl_max_md_size/cl_default_md_size before sending getattr to MDS. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-4222 Reviewed-on: http://review.whamcloud.com/8599 Reviewed-by: Fan Yong Reviewed-by: Andreas Dilger Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_lib.c | 2 +- drivers/staging/lustre/lustre/mdc/mdc_request.c | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_lib.c b/drivers/staging/lustre/lustre/llite/llite_lib.c index 64be2c1..44dd3f3 100644 --- a/drivers/staging/lustre/lustre/llite/llite_lib.c +++ b/drivers/staging/lustre/lustre/llite/llite_lib.c @@ -445,7 +445,7 @@ static int client_common_fill_super(struct super_block *sb, char *md, char *dt, /* make root inode * XXX: move this to after cbd setup? */ - valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS; + valid = OBD_MD_FLGETATTR | OBD_MD_FLBLOCKS | OBD_MD_FLMODEASIZE; if (sbi->ll_flags & LL_SBI_RMT_CLIENT) valid |= OBD_MD_FLRMTPERM; else if (sbi->ll_flags & LL_SBI_ACL) diff --git a/drivers/staging/lustre/lustre/mdc/mdc_request.c b/drivers/staging/lustre/lustre/mdc/mdc_request.c index 46e3a7506..86b7445 100644 --- a/drivers/staging/lustre/lustre/mdc/mdc_request.c +++ b/drivers/staging/lustre/lustre/mdc/mdc_request.c @@ -142,9 +142,8 @@ static int mdc_getattr_common(struct obd_export *exp, CDEBUG(D_NET, "mode: %o\n", body->mode); + mdc_update_max_ea_from_body(exp, body); if (body->eadatasize != 0) { - mdc_update_max_ea_from_body(exp, body); - eadata = req_capsule_server_sized_get(pill, &RMF_MDT_MD, body->eadatasize); if (!eadata) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/9] staging: lustre: fid: packing ost_idx in IDIF
From: Fan Yong For a normal FID, we can know on which target the related object is allocated via querying FLDB; but it is not true for an IDIF. To locate the OST via the given IDIF, when the IDIF is generated, we pack the OST index in it. Then for any given FID, in spite of t is a normal FID or not, we has the method to know which target it belongs to. That is useful for LFSCK. For old IDIF, the OST index is not part of the IDIF, means that ifferent OSTs may have the same IDIFs, that may cause the IFID in LMA does not match the read FID. Under such case, we need to make some compatible check to avoid to trigger unexpected. tgt_validate_obdo() converts the ostid contained in the RPC body to fid and changes the "struct ost_id" union, then the users can access ost_id::oi_fid directly without call ostid_to_fid() again. It also contains some other fixing and cleanup. Signed-off-by: wang di Signed-off-by: Fan Yong Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3569 Reviewed-on: http://review.whamcloud.com/7053 Reviewed-by: Andreas Dilger Reviewed-by: Alex Zhuravlev Signed-off-by: James Simmons --- .../lustre/lustre/include/lustre/lustre_idl.h | 76 +++--- drivers/staging/lustre/lustre/include/lustre_fid.h | 22 ++- 2 files changed, 57 insertions(+), 41 deletions(-) diff --git a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h index a70545a..9c53c17 100644 --- a/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h +++ b/drivers/staging/lustre/lustre/include/lustre/lustre_idl.h @@ -584,7 +584,7 @@ static inline __u64 ostid_seq(const struct ost_id *ostid) if (fid_seq_is_mdt0(ostid->oi.oi_seq)) return FID_SEQ_OST_MDT0; - if (fid_seq_is_default(ostid->oi.oi_seq)) + if (unlikely(fid_seq_is_default(ostid->oi.oi_seq))) return FID_SEQ_LOV_DEFAULT; if (fid_is_idif(&ostid->oi_fid)) @@ -596,9 +596,12 @@ static inline __u64 ostid_seq(const struct ost_id *ostid) /* extract OST objid from a wire ost_id (id/seq) pair */ static inline __u64 ostid_id(const struct ost_id *ostid) { - if (fid_seq_is_mdt0(ostid_seq(ostid))) + if (fid_seq_is_mdt0(ostid->oi.oi_seq)) return ostid->oi.oi_id & IDIF_OID_MASK; + if (unlikely(fid_seq_is_default(ostid->oi.oi_seq))) + return ostid->oi.oi_id; + if (fid_is_idif(&ostid->oi_fid)) return fid_idif_id(fid_seq(&ostid->oi_fid), fid_oid(&ostid->oi_fid), 0); @@ -642,12 +645,22 @@ static inline void ostid_set_seq_llog(struct ost_id *oi) */ static inline void ostid_set_id(struct ost_id *oi, __u64 oid) { - if (fid_seq_is_mdt0(ostid_seq(oi))) { + if (fid_seq_is_mdt0(oi->oi.oi_seq)) { if (oid >= IDIF_MAX_OID) { CERROR("Bad %llu to set " DOSTID "\n", oid, POSTID(oi)); return; } oi->oi.oi_id = oid; + } else if (fid_is_idif(&oi->oi_fid)) { + if (oid >= IDIF_MAX_OID) { + CERROR("Bad %llu to set "DOSTID"\n", + oid, POSTID(oi)); + return; + } + oi->oi_fid.f_seq = fid_idif_seq(oid, + fid_idif_ost_idx(&oi->oi_fid)); + oi->oi_fid.f_oid = oid; + oi->oi_fid.f_ver = oid >> 48; } else { if (oid > OBIF_MAX_OID) { CERROR("Bad %llu to set " DOSTID "\n", oid, POSTID(oi)); @@ -657,25 +670,31 @@ static inline void ostid_set_id(struct ost_id *oi, __u64 oid) } } -static inline void ostid_inc_id(struct ost_id *oi) +static inline int fid_set_id(struct lu_fid *fid, __u64 oid) { - if (fid_seq_is_mdt0(ostid_seq(oi))) { - if (unlikely(ostid_id(oi) + 1 > IDIF_MAX_OID)) { - CERROR("Bad inc "DOSTID"\n", POSTID(oi)); - return; + if (unlikely(fid_seq_is_igif(fid->f_seq))) { + CERROR("bad IGIF, "DFID"\n", PFID(fid)); + return -EBADF; + } + + if (fid_is_idif(fid)) { + if (oid >= IDIF_MAX_OID) { + CERROR("Too large OID %#llx to set IDIF "DFID"\n", + (unsigned long long)oid, PFID(fid)); + return -EBADF; } - oi->oi.oi_id++; + fid->f_seq = fid_idif_seq(oid, fid_idif_ost_idx(fid)); + fid->f_oid = oid; + fid->f_ver = oid >> 48; } else { - oi->oi_fid.f_oid++; + if (oid > OBIF_MAX_OID) { + CERROR("Too large OID %#llx to set REG "DFID"\n", + (unsigned long long)oid, PFID(fid)); + return -EBADF; + } + fi
[PATCH 2/9] staging: lustre: osc: Allow lock to be canceled at ENQ time
From: Alexander Boyko A cl_lock can be canceled when it's in CLS_ENQUEUED state. We can't unuse this kind of lock in lov_lock_unuse() because it will bring this lock into CLS_NEW state and then confuse osc_lock_upcall(). Add a regression test case by Alexander Boyko. Signed-off-by: Jinshan Xiong Signed-off-by: Alexander Boyko Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3889 Reviewed-on: http://review.whamcloud.com/8405 Reviewed-by: Bobi Jam Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/include/obd_support.h | 1 + drivers/staging/lustre/lustre/osc/osc_request.c | 3 +++ 2 files changed, 4 insertions(+) diff --git a/drivers/staging/lustre/lustre/include/obd_support.h b/drivers/staging/lustre/lustre/include/obd_support.h index 1358af1..60034d3 100644 --- a/drivers/staging/lustre/lustre/include/obd_support.h +++ b/drivers/staging/lustre/lustre/include/obd_support.h @@ -321,6 +321,7 @@ extern char obd_jobid_var[]; #define OBD_FAIL_LDLM_AGL_DELAY 0x31a #define OBD_FAIL_LDLM_AGL_NOLOCK0x31b #define OBD_FAIL_LDLM_OST_LVB 0x31c +#define OBD_FAIL_LDLM_ENQUEUE_HANG 0x31d /* LOCKLESS IO */ #define OBD_FAIL_LDLM_SET_CONTENTION 0x385 diff --git a/drivers/staging/lustre/lustre/osc/osc_request.c b/drivers/staging/lustre/lustre/osc/osc_request.c index df06f4f..47417f8 100644 --- a/drivers/staging/lustre/lustre/osc/osc_request.c +++ b/drivers/staging/lustre/lustre/osc/osc_request.c @@ -2201,6 +2201,9 @@ static int osc_enqueue_interpret(const struct lu_env *env, */ ldlm_lock_addref(lockh, mode); + /* Let cl_lock_state_wait fail with -ERESTARTSYS to unuse sublocks. */ + OBD_FAIL_TIMEOUT(OBD_FAIL_LDLM_ENQUEUE_HANG, 2); + /* Let CP AST to grant the lock first. */ OBD_FAIL_TIMEOUT(OBD_FAIL_OSC_CP_ENQ_RACE, 1); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/9] staging: lustre: fid: init FID client for OSP on MDT.
From: wang di Initialize FID client for OSP on MDT. Signed-off-by: wang di Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3529 Reviewed-on: http://review.whamcloud.com/7158 Reviewed-by: John L. Hammond Reviewed-by: Alex Zhuravlev Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/fid/fid_request.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/drivers/staging/lustre/lustre/fid/fid_request.c b/drivers/staging/lustre/lustre/fid/fid_request.c index 32e4d95..3a4df62 100644 --- a/drivers/staging/lustre/lustre/fid/fid_request.c +++ b/drivers/staging/lustre/lustre/fid/fid_request.c @@ -102,10 +102,13 @@ static int seq_client_rpc(struct lu_client_seq *seq, req->rq_no_delay = req->rq_no_resend = 1; debug_mask = D_CONSOLE; } else { - if (seq->lcs_type == LUSTRE_SEQ_METADATA) + if (seq->lcs_type == LUSTRE_SEQ_METADATA) { + req->rq_reply_portal = MDC_REPLY_PORTAL; req->rq_request_portal = SEQ_METADATA_PORTAL; - else + } else { + req->rq_reply_portal = OSC_REPLY_PORTAL; req->rq_request_portal = SEQ_DATA_PORTAL; + } debug_mask = D_INFO; } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/9] staging: lustre: nfs: don't panic NFS server if MDS fails to find FID
From: Bobi Jam When MDS fails to retrive the parent's fid, we'd handle it without crashing the NFS server. Signed-off-by: Bobi Jam Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3952 Reviewed-on: http://review.whamcloud.com/8459 Reviewed-by: Fan Yong Reviewed-by: wangdi Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/llite/llite_nfs.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/llite_nfs.c b/drivers/staging/lustre/lustre/llite/llite_nfs.c index 61cb5ff..c1eef61 100644 --- a/drivers/staging/lustre/lustre/llite/llite_nfs.c +++ b/drivers/staging/lustre/lustre/llite/llite_nfs.c @@ -322,11 +322,14 @@ static struct dentry *ll_get_parent(struct dentry *dchild) return ERR_PTR(rc); } body = req_capsule_server_get(&req->rq_pill, &RMF_MDT_BODY); - LASSERT(body->valid & OBD_MD_FLID); - - CDEBUG(D_INFO, "parent for " DFID " is " DFID "\n", - PFID(ll_inode2fid(dir)), PFID(&body->fid1)); - + /* +* LU-3952: MDT may lost the FID of its parent, we should not crash +* the NFS server, ll_iget_for_nfs() will handle the error. +*/ + if (body->valid & OBD_MD_FLID) { + CDEBUG(D_INFO, "parent for " DFID " is " DFID "\n", + PFID(ll_inode2fid(dir)), PFID(&body->fid1)); + } result = ll_iget_for_nfs(dir->i_sb, &body->fid1, NULL); ptlrpc_req_finished(req); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/9] staging: lustre: bug fixes from the lustre 2.5.[54-55] release
Here is the next batch of fixes and cleanups that went into Lustre versions 2.5.54 and 2.5.55 except for the work done for LU-3531. The changes for LU-3531 are large so they belong in their own special patch set. Most of the patches here are minor fixes and some removal of dead or obsolete code. Alexander Boyko (1): staging: lustre: osc: Allow lock to be canceled at ENQ time Andreas Dilger (1): staging: lustre: debug: clean up console messages Bobi Jam (1): staging: lustre: nfs: don't panic NFS server if MDS fails to find FID Fan Yong (1): staging: lustre: fid: packing ost_idx in IDIF John L. Hammond (2): staging: lustre: lov: remove lov and lod stuff from obd.h staging: lustre: lov: remove unused lov obd functions Niu Yawei (1): staging: lustre: ptlrpc: fix nrs cleanup wang di (2): staging: lustre: mdt: extra checking for getattr RPC. staging: lustre: fid: init FID client for OSP on MDT. drivers/staging/lustre/lustre/fid/fid_request.c| 7 +- .../lustre/lustre/include/lustre/lustre_idl.h | 76 +++--- drivers/staging/lustre/lustre/include/lustre_fid.h | 22 ++- drivers/staging/lustre/lustre/include/obd.h| 60 - .../staging/lustre/lustre/include/obd_support.h| 1 + drivers/staging/lustre/lustre/llite/llite_lib.c| 6 +- drivers/staging/lustre/lustre/llite/llite_nfs.c| 13 ++-- drivers/staging/lustre/lustre/lov/lov_ea.c | 5 -- drivers/staging/lustre/lustre/lov/lov_internal.h | 32 - drivers/staging/lustre/lustre/lov/lov_obd.c| 3 - drivers/staging/lustre/lustre/lov/lov_pool.c | 62 +- drivers/staging/lustre/lustre/lov/lov_request.c| 3 - drivers/staging/lustre/lustre/mdc/mdc_request.c| 3 +- drivers/staging/lustre/lustre/obdclass/obd_mount.c | 2 +- drivers/staging/lustre/lustre/osc/osc_request.c| 3 + drivers/staging/lustre/lustre/ptlrpc/nrs.c | 6 +- 16 files changed, 101 insertions(+), 203 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 9/9] staging: lustre: lov: remove unused lov obd functions
From: "John L. Hammond" Remove the unused lov functions lov_get_reqset, lov_check_index_in_pool, and lov_find_pool functions. Remove unused data structures. Signed-off-by: John L. Hammond Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-2675 Reviewed-on: http://review.whamcloud.com/5581 Reviewed-by: Alex Zhuravlev Reviewed-by: Andreas Dilger Reviewed-by: James Simmons Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/lov/lov_ea.c | 5 --- drivers/staging/lustre/lustre/lov/lov_internal.h | 11 -- drivers/staging/lustre/lustre/lov/lov_obd.c | 1 - drivers/staging/lustre/lustre/lov/lov_pool.c | 47 drivers/staging/lustre/lustre/lov/lov_request.c | 3 -- 5 files changed, 67 deletions(-) diff --git a/drivers/staging/lustre/lustre/lov/lov_ea.c b/drivers/staging/lustre/lustre/lov/lov_ea.c index b652940..460f0fa 100644 --- a/drivers/staging/lustre/lustre/lov/lov_ea.c +++ b/drivers/staging/lustre/lustre/lov/lov_ea.c @@ -48,11 +48,6 @@ #include "lov_internal.h" -struct lovea_unpack_args { - struct lov_stripe_md *lsm; - intcursor; -}; - static int lsm_lmm_verify_common(struct lov_mds_md *lmm, int lmm_bytes, __u16 stripe_count) { diff --git a/drivers/staging/lustre/lustre/lov/lov_internal.h b/drivers/staging/lustre/lustre/lov/lov_internal.h index ff01fe9..eef9afa 100644 --- a/drivers/staging/lustre/lustre/lov/lov_internal.h +++ b/drivers/staging/lustre/lustre/lov/lov_internal.h @@ -103,7 +103,6 @@ struct lov_request { }; struct lov_request_set { - struct ldlm_enqueue_info*set_ei; struct obd_info *set_oi; atomic_tset_refcount; struct obd_export *set_exp; @@ -117,10 +116,8 @@ struct lov_request_set { atomic_tset_finish_checked; struct llog_cookie *set_cookies; int set_cookie_sent; - struct obd_trans_info *set_oti; struct list_headset_list; wait_queue_head_t set_waitq; - spinlock_t set_lock; }; extern struct kmem_cache *lov_oinfo_slab; @@ -129,12 +126,6 @@ extern struct lu_kmem_descr lov_caches[]; void lov_finish_set(struct lov_request_set *set); -static inline void lov_get_reqset(struct lov_request_set *set) -{ - LASSERT(atomic_read(&set->set_refcount) > 0); - atomic_inc(&set->set_refcount); -} - static inline void lov_put_reqset(struct lov_request_set *set) { if (atomic_dec_and_test(&set->set_refcount)) @@ -246,8 +237,6 @@ int lov_pool_new(struct obd_device *obd, char *poolname); int lov_pool_del(struct obd_device *obd, char *poolname); int lov_pool_add(struct obd_device *obd, char *poolname, char *ostname); int lov_pool_remove(struct obd_device *obd, char *poolname, char *ostname); -struct pool_desc *lov_find_pool(struct lov_obd *lov, char *poolname); -int lov_check_index_in_pool(__u32 idx, struct pool_desc *pool); void lov_pool_putref(struct pool_desc *pool); static inline struct lov_stripe_md *lsm_addref(struct lov_stripe_md *lsm) diff --git a/drivers/staging/lustre/lustre/lov/lov_obd.c b/drivers/staging/lustre/lustre/lov/lov_obd.c index bc9135a..e15ef2e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_obd.c +++ b/drivers/staging/lustre/lustre/lov/lov_obd.c @@ -123,7 +123,6 @@ static int lov_set_osc_active(struct obd_device *obd, struct obd_uuid *uuid, static int lov_notify(struct obd_device *obd, struct obd_device *watched, enum obd_notify_event ev, void *data); -#define MAX_STRING_SIZE 128 int lov_connect_obd(struct obd_device *obd, __u32 index, int activate, struct obd_connect_data *data) { diff --git a/drivers/staging/lustre/lustre/lov/lov_pool.c b/drivers/staging/lustre/lustre/lov/lov_pool.c index 4254243..690292e 100644 --- a/drivers/staging/lustre/lustre/lov/lov_pool.c +++ b/drivers/staging/lustre/lustre/lov/lov_pool.c @@ -586,50 +586,3 @@ out: lov_pool_putref(pool); return rc; } - -int lov_check_index_in_pool(__u32 idx, struct pool_desc *pool) -{ - int i, rc; - - /* caller may no have a ref on pool if it got the pool -* without calling lov_find_pool() (e.g. go through the lov pool -* list) -*/ - lov_pool_getref(pool); - - down_read(&pool_tgt_rw_sem(pool)); - - for (i = 0; i < pool_tgt_count(pool); i++) { - if (pool_tgt_array(pool)[i] == idx) { - rc = 0; - goto out; - } - } - rc = -ENOENT; -out: - up_read(&pool_tgt_rw_sem(pool)); - - lov_pool_putref(pool); - return rc; -} - -struct pool_desc *lov_find_pool(struct lov_obd *lov, char *poolname) -{ - struct pool_desc *pool; - - pool = NULL; - if (poolname[0] !=
[PATCH 7/9] staging: lustre: ptlrpc: fix nrs cleanup
From: Niu Yawei When service start failed due to short of memory, the cleanup code could operate on uninitialized structure and cause crash at the end. This patch fix the nrs_svcpt_cleanup_locked() to perform cleanup only on the nrs which has been properly initialized. Signed-off-by: Niu Yawei Intel-bug-id: https://jira.hpdd.intel.com/browse/LU-3772 Reviewed-on: http://review.whamcloud.com/7410 Reviewed-by: Andreas Dilger Reviewed-by: Oleg Drokin Signed-off-by: James Simmons --- drivers/staging/lustre/lustre/ptlrpc/nrs.c | 6 +- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lustre/ptlrpc/nrs.c b/drivers/staging/lustre/lustre/ptlrpc/nrs.c index 99ff6e8..c444f51 100644 --- a/drivers/staging/lustre/lustre/ptlrpc/nrs.c +++ b/drivers/staging/lustre/lustre/ptlrpc/nrs.c @@ -975,7 +975,11 @@ static void nrs_svcpt_cleanup_locked(struct ptlrpc_service_part *svcpt) LASSERT(mutex_is_locked(&nrs_core.nrs_mutex)); again: - nrs = nrs_svcpt2nrs(svcpt, hp); + /* scp_nrs_hp could be NULL due to short of memory. */ + nrs = hp ? svcpt->scp_nrs_hp : &svcpt->scp_nrs_reg; + /* check the nrs_svcpt to see if nrs is initialized. */ + if (!nrs || !nrs->nrs_svcpt) + return; nrs->nrs_stopping = 1; list_for_each_entry_safe(policy, tmp, &nrs->nrs_policy_list, pol_list) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v9 net-next 0/2] introduce Hyper-V VM Sockets(hv_sock)
Hyper-V Sockets (hv_sock) supplies a byte-stream based communication mechanism between the host and the guest. It's somewhat like TCP over VMBus, but the transportation layer (VMBus) is much simpler than IP. With Hyper-V Sockets, applications between the host and the guest can talk to each other directly by the traditional BSD-style socket APIs. Hyper-V Sockets is only available on new Windows hosts, like Windows Server 2016. More info is in this article "Make your own integration services": https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/develop/make_mgmt_service The patch implements the necessary support in the guest side by introducing a new socket address family AF_HYPERV. You can also get the patch by: https://github.com/dcui/linux/commits/decui/hv_sock/net-next/20160502_v09 Note: the VMBus driver side's supporting patches have been in the mainline tree. I know the kernel has already had a VM Sockets driver (AF_VSOCK) based on VMware VMCI (net/vmw_vsock/, drivers/misc/vmw_vmci), and KVM is proposing AF_VSOCK of virtio version: http://marc.info/?l=linux-netdev&m=145952064004765&w=2 However, though Hyper-V Sockets may seem conceptually similar to AF_VOSCK, there are differences in the transportation layer, and IMO these make the direct code reusing impractical: 1. In AF_VSOCK, the endpoint type is: , but in AF_HYPERV, the endpoint type is: . Here GUID is 128-bit. 2. AF_VSOCK supports SOCK_DGRAM, while AF_HYPERV doesn't. 3. AF_VSOCK supports some special sock opts, like SO_VM_SOCKETS_BUFFER_SIZE, SO_VM_SOCKETS_BUFFER_MIN/MAX_SIZE and SO_VM_SOCKETS_CONNECT_TIMEOUT. These are meaningless to AF_HYPERV. 4. Some AF_VSOCK's VMCI transportation ops are meanless to AF_HYPERV/VMBus, like .notify_recv_init .notify_recv_pre_block .notify_recv_pre_dequeue .notify_recv_post_dequeue .notify_send_init .notify_send_pre_block .notify_send_pre_enqueue .notify_send_post_enqueue etc. So I think we'd better introduce a new address family: AF_HYPERV. Please review the patch. Looking forward to your comments, especially comments from David. :-) Changes since v1: - updated "[PATCH 6/7] hvsock: introduce Hyper-V VM Sockets feature" - added __init and __exit for the module init/exit functions - net/hv_sock/Kconfig: "default m" -> "default m if HYPERV" - MODULE_LICENSE: "Dual MIT/GPL" -> "Dual BSD/GPL" Changes since v2: - fixed various coding issue pointed out by David Miller - fixed indentation issues - removed pr_debug in net/hv_sock/af_hvsock.c - used reverse-Chrismas-tree style for local variables. - EXPORT_SYMBOL -> EXPORT_SYMBOL_GPL Changes since v3: - fixed a few coding issue pointed by Vitaly Kuznetsov and Dan Carpenter - fixed the ret value in vmbus_recvpacket_hvsock on error - fixed the style of multi-line comment: vmbus_get_hvsock_rw_status() Changes since v4 (https://lkml.org/lkml/2015/7/28/404): - addressed all the comments about V4. - treat the hvsock offers/channels as special VMBus devices - add a mechanism to pass hvsock events to the hvsock driver - fixed some corner cases with proper locking when a connection is closed - rebased to the latest Greg's tree Changes since v5 (https://lkml.org/lkml/2015/12/24/103): - addressed the coding style issues (Vitaly Kuznetsov & David Miller, thanks!) - used a better coding for the per-channel rescind callback (Thank Vitaly!) - avoided the introduction of new VMBUS driver APIs vmbus_sendpacket_hvsock() and vmbus_recvpacket_hvsock() and used vmbus_sendpacket()/vmbus_recvpacket() in the higher level (i.e., the vmsock driver). Thank Vitaly! Changes since v6 (http://lkml.iu.edu/hypermail/linux/kernel/1601.3/01813.html) - only a few minor changes of coding style and comments Changes since v7 - a few minor changes of coding style: thanks, Joe Perches! - added some lines of comments about GUID/UUID before the struct sockaddr_hv. Changes since v8 - removed the unnecessary __packed for some definitions: thanks, David! - hvsock_open_connection: use offer.u.pipe.user_def[0] to know the connection and reorganized the function direction - reorganized the code according to suggestions from Cathy Avery: split big functions into small ones, set .setsockopt and getsockopt to sock_no_setsockopt/sock_no_getsockopt - inline'd some small list helper functions Dexuan Cui (2): hv_sock: introduce Hyper-V Sockets net: add the AF_HYPERV entries to family name tables MAINTAINERS |2 + include/linux/hyperv.h | 16 + include/linux/socket.h |5 +- include/net/af_hvsock.h | 55 ++ include/uapi/linux/hyperv.h | 25 + net/Kconfig |1 + net/Makefile|1 + net/core/sock.c |6 +- net/hv_sock/Kconfig | 10 + net/hv_sock/Makefile|3 + net/hv_sock/af_hvsock.c | 1434 +++ 11 files changed, 1553 insertions(+), 5 deletions(-) create mode 100644 include/net/af_hvsock.h create mode 100644 net/hv_sock/Kconfi
[PATCH v9 net-next 1/2] hv_sock: introduce Hyper-V Sockets
Hyper-V Sockets (hv_sock) supplies a byte-stream based communication mechanism between the host and the guest. It's somewhat like TCP over VMBus, but the transportation layer (VMBus) is much simpler than IP. With Hyper-V Sockets, applications between the host and the guest can talk to each other directly by the traditional BSD-style socket APIs. Hyper-V Sockets is only available on new Windows hosts, like Windows Server 2016. More info is in this article "Make your own integration services": https://msdn.microsoft.com/en-us/virtualization/hyperv_on_windows/develop/make_mgmt_service The patch implements the necessary support in the guest side by introducing a new socket address family AF_HYPERV. Signed-off-by: Dexuan Cui Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Vitaly Kuznetsov Cc: Cathy Avery --- MAINTAINERS |2 + include/linux/hyperv.h | 16 + include/linux/socket.h |5 +- include/net/af_hvsock.h | 55 ++ include/uapi/linux/hyperv.h | 25 + net/Kconfig |1 + net/Makefile|1 + net/hv_sock/Kconfig | 10 + net/hv_sock/Makefile|3 + net/hv_sock/af_hvsock.c | 1434 +++ 10 files changed, 1550 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index fa02825..b32716f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -5268,7 +5268,9 @@ F:drivers/pci/host/pci-hyperv.c F: drivers/net/hyperv/ F: drivers/scsi/storvsc_drv.c F: drivers/video/fbdev/hyperv_fb.c +F: net/hv_sock/ F: include/linux/hyperv.h +F: include/net/af_hvsock.h F: tools/hv/ F: Documentation/ABI/stable/sysfs-bus-vmbus diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index aa0fadc..e756719 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1338,4 +1338,20 @@ extern __u32 vmbus_proto_version; int vmbus_send_tl_connect_request(const uuid_le *shv_guest_servie_id, const uuid_le *shv_host_servie_id); +struct vmpipe_proto_header { + u32 pkt_type; + u32 data_size; +}; + +#define HVSOCK_HEADER_LEN (sizeof(struct vmpacket_descriptor) + \ +sizeof(struct vmpipe_proto_header)) + +/* See 'prev_indices' in hv_ringbuffer_read(), hv_ringbuffer_write() */ +#define PREV_INDICES_LEN (sizeof(u64)) + +#define HVSOCK_PKT_LEN(payload_len)(HVSOCK_HEADER_LEN + \ + ALIGN((payload_len), 8) + \ + PREV_INDICES_LEN) +#define HVSOCK_MIN_PKT_LEN HVSOCK_PKT_LEN(1) + #endif /* _HYPERV_H */ diff --git a/include/linux/socket.h b/include/linux/socket.h index 73bf6c6..88b1ccd 100644 --- a/include/linux/socket.h +++ b/include/linux/socket.h @@ -201,8 +201,8 @@ struct ucred { #define AF_NFC 39 /* NFC sockets */ #define AF_VSOCK 40 /* vSockets */ #define AF_KCM 41 /* Kernel Connection Multiplexor*/ - -#define AF_MAX 42 /* For now.. */ +#define AF_HYPERV 42 /* Hyper-V Sockets */ +#define AF_MAX 43 /* For now.. */ /* Protocol families, same as address families. */ #define PF_UNSPEC AF_UNSPEC @@ -249,6 +249,7 @@ struct ucred { #define PF_NFC AF_NFC #define PF_VSOCK AF_VSOCK #define PF_KCM AF_KCM +#define PF_HYPERV AF_HYPERV #define PF_MAX AF_MAX /* Maximum queue length specifiable by listen. */ diff --git a/include/net/af_hvsock.h b/include/net/af_hvsock.h new file mode 100644 index 000..04bc40c --- /dev/null +++ b/include/net/af_hvsock.h @@ -0,0 +1,55 @@ +#ifndef __AF_HVSOCK_H__ +#define __AF_HVSOCK_H__ + +#include +#include +#include + +#define VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV (5 * PAGE_SIZE) +#define VMBUS_RINGBUFFER_SIZE_HVSOCK_SEND (5 * PAGE_SIZE) + +#define HVSOCK_RCV_BUF_SZ VMBUS_RINGBUFFER_SIZE_HVSOCK_RECV +#define HVSOCK_SND_BUF_SZ PAGE_SIZE + +#define sk_to_hvsock(__sk)((struct hvsock_sock *)(__sk)) +#define hvsock_to_sk(__hvsk) ((struct sock *)(__hvsk)) + +struct hvsock_sock { + /* sk must be the first member. */ + struct sock sk; + + struct sockaddr_hv local_addr; + struct sockaddr_hv remote_addr; + + /* protected by the global hvsock_mutex */ + struct list_head bound_list; + struct list_head connected_list; + + struct list_head accept_queue; + /* used by enqueue and dequeue */ + struct mutex accept_queue_mutex; + + struct delayed_work dwork; + + u32 peer_shutdown; + + struct vmbus_channel *channel; + + /* The 'hdr' and 'buf' in the below 'send' and 'recv' definitions must +* be consecutive: see hvsock_send_data() and hvsock_recv_data(). +*/ + struct { + struct vmpipe_proto_header hdr; + u8 buf[HVSOCK_SND_BUF_SZ]; + } send;
[PATCH v9 net-next 2/2] net: add the AF_HYPERV entries to family name tables
This is for the hv_sock driver, which introduces AF_HYPERV(42). Signed-off-by: Dexuan Cui Cc: "K. Y. Srinivasan" Cc: Haiyang Zhang Cc: Vitaly Kuznetsov Cc: Cathy Avery --- net/core/sock.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/core/sock.c b/net/core/sock.c index e16a5db..c0884c7 100644 --- a/net/core/sock.c +++ b/net/core/sock.c @@ -222,7 +222,7 @@ static const char *const af_family_key_strings[AF_MAX+1] = { "sk_lock-AF_RXRPC" , "sk_lock-AF_ISDN" , "sk_lock-AF_PHONET" , "sk_lock-AF_IEEE802154", "sk_lock-AF_CAIF" , "sk_lock-AF_ALG" , "sk_lock-AF_NFC" , "sk_lock-AF_VSOCK", "sk_lock-AF_KCM" , - "sk_lock-AF_MAX" + "sk_lock-AF_HYPERV", "sk_lock-AF_MAX" }; static const char *const af_family_slock_key_strings[AF_MAX+1] = { "slock-AF_UNSPEC", "slock-AF_UNIX" , "slock-AF_INET" , @@ -239,7 +239,7 @@ static const char *const af_family_slock_key_strings[AF_MAX+1] = { "slock-AF_RXRPC" , "slock-AF_ISDN" , "slock-AF_PHONET" , "slock-AF_IEEE802154", "slock-AF_CAIF" , "slock-AF_ALG" , "slock-AF_NFC" , "slock-AF_VSOCK","slock-AF_KCM" , - "slock-AF_MAX" + "slock-AF_HYPERV", "slock-AF_MAX" }; static const char *const af_family_clock_key_strings[AF_MAX+1] = { "clock-AF_UNSPEC", "clock-AF_UNIX" , "clock-AF_INET" , @@ -256,7 +256,7 @@ static const char *const af_family_clock_key_strings[AF_MAX+1] = { "clock-AF_RXRPC" , "clock-AF_ISDN" , "clock-AF_PHONET" , "clock-AF_IEEE802154", "clock-AF_CAIF" , "clock-AF_ALG" , "clock-AF_NFC" , "clock-AF_VSOCK", "clock-AF_KCM" , - "clock-AF_MAX" + "clock-AF_HYPERV", "clock-AF_MAX" }; /* -- 2.1.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 00/25] staging: comedi: das16m1: cleanup driver
On 03/05/16 20:29, H Hartley Sweeten wrote: Fixe all the checkpatch.pl issues and tidy up the driver. H Hartley Sweeten (25): staging: comedi: das16m1: tidy up copyright and comedi comments staging: comedi: das16m1: tidy up comments in das16m1_handler() staging: comedi: das16m1: tidy up comment in das16m1_cmd_exec() staging: comedi: das16m1: remove unnecessary private data comments staging: comedi: das16m1: tidy up register map comment staging: comedi: das16m1: tidy up analog input data register defines staging: comedi: das16m1: tidy up control/status register defines staging: comedi: das16m1: tidy up digital input/output register defines staging: comedi: das16m1: tidy up clear interrupt register define staging: comedi: das16m1: remove unnecessary ai 'cancel' operations staging: comedi: das16m1: tidy up interrupt control register defines staging: comedi: das16m1: tidy up queue register defines staging: comedi: das16m1: introduce das16m1_ai_set_queue() staging: comedi: das16m1: tidy up analog input subdevice init staging: comedi: das16m1: tidy up digital input subdevice init staging: comedi: das16m1: tidy up das16m1_di_insn_bits() staging: comedi: das16m1: tidy up digital output subdevice init staging: comedi: das16m1: tidy up 8254/8255 register defines staging: comedi: das16m1: tidy up misc. defines staging: comedi: das16m1: remove an unnecessery comment staging: comedi: das16m1: init local variables when declared staging: comedi: das16m1: minor cleanup to das16m1_ai_insn_read() staging: comedi: das16m1: convert munge_sample_array() into a subdevice (*munge) staging: comedi: das16m1: rename struct das16m1_private_struct staging: comedi: das16m1: update the MODULE_DESCRIPTION drivers/staging/comedi/drivers/das16m1.c | 482 +++ 1 file changed, 233 insertions(+), 249 deletions(-) Thanks! Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 15/19] staging: comedi: dt2811: simplify analog input range options
On 04/05/16 01:25, H Hartley Sweeten wrote: The A/D ranges are not programmable but the gain is. Currently this driver uses a configuration option to select the comedi_lrange that will be used for the analog input subdevice. This requires that the user makes sure the correct option value is used. The user space library uses the range information to convert between raw values and physical units. If the user passed an incorrect option when attaching the driver the conversion will be incorrect. A previous patch allowed the gain to be set based on the chanspec range. Prior to that the gain was always set to 1 so any conversion with a gain that is not 1 would be incorrect anyway. Simplify the analog input ranges by providing a range_table for the pgh and pgl boards that contain all the possible range/gain options. The user can then select the correct range (and gain) when converting values or reading the analog inputs. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 143 ++-- 1 file changed, 61 insertions(+), 82 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 379b7d5..acc9db8 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -33,14 +33,17 @@ * 0 = single-ended (16 channels) * 1 = differential (8 channels) * 2 = pseudo-differential (16 channels) - * [3] - A/D range - *0 = [-5, 5] - *1 = [-2.5, 2.5] - *2 = [0, 5] + * [3] - A/D range (deprecated, see below) * [4] - D/A 0 range (deprecated, see below) * [5] - D/A 1 range (deprecated, see below) * * Notes: + * - A/D ranges are not programmable but the gain is. The AI subdevice has + * a range_table containing all the possible analog input range/gain + * options for the dt2811-pgh or dt2811-pgl. Use the range that matches + * your board configuration and the desired gain to correctly convert + * between data values and physical units and to set the correct output + * gain. * - D/A ranges are not programmable. The AO subdevice has a range_table * containing all the possible analog output ranges. Use the range * that matches your board configuration to convert between data @@ -99,57 +102,52 @@ #define DT2811_TMRCTR_MANTISSA(x) (((x) & 0x7) << 3) #define DT2811_TMRCTR_EXPONENT(x) (((x) & 0x7) << 0) -static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { - 4, { - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - UNI_RANGE(0.625) - } -}; - -static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { - 4, { - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125) - } -}; - -static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { - 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } -}; - -static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { - 4, { - UNI_RANGE(5), - UNI_RANGE(0.5), - UNI_RANGE(0.05), - UNI_RANGE(0.01) - } -}; - -static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { - 4, { - BIP_RANGE(2.5), - BIP_RANGE(0.25), - BIP_RANGE(0.025), - BIP_RANGE(0.005) +/* + * The Analog Input range is set using jumpers on the board. + * + * Input Range W9 W10 + * 0V to +5V Out In + * -5V to +5V In Out + * -2.5V to +2.5V In In + * + * The gain may be set to 1, 2, 4, or 8 (on the dt2811-pgh) or to + * 1, 10, 100, 500 (on the dt2811-pgl). + */ +static const struct comedi_lrange dt2811_pgh_ai_ranges = { + 12, { + UNI_RANGE(5), /* range 0: gain=1 */ + UNI_RANGE(2.5), /* range 1: gain=2 */ + UNI_RANGE(1.25),/* range 2: gain=4 */ + UNI_RANGE(0.625), /* range 3: gain=8 */ + + BIP_RANGE(5), /* range 0+4: gain=1 */ + BIP_RANGE(2.5), /* range 1+4: gain=2 */ + BIP_RANGE(1.25),/* range 2+4: gain=4 */ + BIP_RANGE(0.625), /* range 3+4: gain=8 */ + + BIP_RANGE(2.5), /* range 0+8: gain=1 */ + BIP_RANGE(1.25),/* range 1+8: gain=2 */ + BIP_RANGE(0.625), /* range 2+8: gain=4 */ + BIP_RANGE(0.3125) /* range 3+8: gain=8 */ } }; I think it will be better to put the UNI_RANGE entries at the bottom. Then, if the user previously defaulted option[3] to 0, the first four ranges in the table would be the s
RE: [PATCH 15/19] staging: comedi: dt2811: simplify analog input range options
On Wednesday, May 04, 2016 9:01 AM, Ian Abbott wrote: > On 04/05/16 01:25, H Hartley Sweeten wrote: >> The A/D ranges are not programmable but the gain is. Currently this driver >> uses a configuration option to select the comedi_lrange that will be used >> for the analog input subdevice. This requires that the user makes sure the >> correct option value is used. >> >> The user space library uses the range information to convert between raw >> values and physical units. If the user passed an incorrect option when >> attaching the driver the conversion will be incorrect. >> >> A previous patch allowed the gain to be set based on the chanspec range. >> Prior to that the gain was always set to 1 so any conversion with a gain >> that is not 1 would be incorrect anyway. >> >> Simplify the analog input ranges by providing a range_table for the pgh and >> pgl boards that contain all the possible range/gain options. The user can >> then select the correct range (and gain) when converting values or reading >> the analog inputs. >> >> Signed-off-by: H Hartley Sweeten >> Cc: Ian Abbott >> Cc: Greg Kroah-Hartman [snip] > I think it will be better to put the UNI_RANGE entries at the bottom. > Then, if the user previously defaulted option[3] to 0, the first four > ranges in the table would be the same as they were before (not that the > ranges worked properly before anyway!). The manual I found for the dt2811 (actually it's for a PC-74 board that is register compatible), lists the "default factory" settings for the D/A jumpers but not for the A/D jumpers so I created the combined table in the order the manual describes the input ranges. But changing it to match how the configuration options were listed is not a problem. I'll fix this up and repost the series shortly. Thanks, Hartley ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Driver for Magewell PCIe capture cards
On Wed, May 04, 2016 at 12:44:46PM +0100, Will Manley wrote: > Hi There > > Magewell are a manufacturer of video-capture devices. They have both > USB and PCIe devices. The USB devices use the upstream uvcvideo driver > and Magewell currently provide proprietary drivers for their PCIe > products. > > http://www.magewell.com/ > > I've approached Magewell about having upstream Linux drivers for these > PCIe devices and they are open to sharing hardware documentation and the > sources to their proprietary drivers under an NDA for the purpose of > developing an upstream Linux driver. This is where I'm hoping that the > linux driver project can help out. > > My interest in this is that I want to be using Magewell PCIe capture > cards in my company's products ( https://stb-tester.com/ ), but I don't > want to be stuck with proprietary drivers. I'm hoping I can facilitate > because I have some limited kernel developer experience, but I wouldn't > be confident enough to write an entire v4l driver myself. > > Please let me know what additional information I can provide to get this > process started. That's great, thanks for working to get the specs for these. I suggest resending this to the linux-me...@vger.kernel.org mailing list. The developers there should be able to help you out better than we can as the number of v4l developers here are pretty slim. If you don't get any response there, let me know and I'll go poke people individually. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH net-next 4/5] treewide: replace dev->trans_start update with helper
On Tue, May 03, 2016 at 04:33:13PM +0200, Florian Westphal wrote: > Replace all trans_start updates with netif_trans_update helper. > change was done via spatch: > > struct net_device *d; > @@ > - d->trans_start = jiffies > + netif_trans_update(d) > > Compile tested only. > > Cc: user-mode-linux-de...@lists.sourceforge.net > Cc: linux-xte...@linux-xtensa.org > Cc: linux1394-de...@lists.sourceforge.net > Cc: linux-r...@vger.kernel.org > Cc: net...@vger.kernel.org > Cc: mpt-fusionlinux@broadcom.com > Cc: linux-s...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-par...@vger.kernel.org > Cc: linux-o...@vger.kernel.org > Cc: linux-h...@vger.kernel.org > Cc: linux-...@vger.kernel.org > Cc: linux-wirel...@vger.kernel.org > Cc: linux-s...@vger.kernel.org > Cc: de...@driverdev.osuosl.org > Cc: b.a.t.m@lists.open-mesh.org > Cc: linux-blueto...@vger.kernel.org > Signed-off-by: Florian Westphal > --- [...] > net/batman-adv/soft-interface.c| 2 +- [...] > diff --git a/net/batman-adv/soft-interface.c b/net/batman-adv/soft-interface.c > index 0710379..bae1397 100644 > --- a/net/batman-adv/soft-interface.c > +++ b/net/batman-adv/soft-interface.c > @@ -208,7 +208,7 @@ static int batadv_interface_tx(struct sk_buff *skb, > if (atomic_read(&bat_priv->mesh_state) != BATADV_MESH_ACTIVE) > goto dropped; > > - soft_iface->trans_start = jiffies; > + netif_trans_update(soft_iface); > vid = batadv_get_vid(skb, 0); > ethhdr = eth_hdr(skb); > Acked-by: Antonio Quartulli -- Antonio Quartulli signature.asc Description: Digital signature ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 06/19] staging: comedi: dt2811: tidy up A/D Data register defines
Cleanup the defines for these registers and and remove the redundant information in the comment. Tidy up the reading of the data registers in the (*insn_read). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 17 +++-- 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index f72d6c8..0c0b7b7 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -67,6 +67,9 @@ #define DT2811_ADGCR_GAIN(x) (((x) & 0x3) << 6) #define DT2811_ADGCR_CHAN(x) (((x) & 0xf) << 0) +#define DT2811_ADDATA_LO_REG 0x02/* r A/D Data low byte */ +#define DT2811_ADDATA_HI_REG 0x03/* r A/D Data high byte */ + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -123,7 +126,7 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { /* - 0x02,0x03 (R) ADDAT A/D Data Register + 0x02,0x03 (W) DADAT0 D/A Data Register 0 0x02 low byte 0x03 high byte @@ -160,8 +163,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define TIMEOUT 1 -#define DT2811_ADDATLO 2 -#define DT2811_ADDATHI 3 #define DT2811_DADAT0LO 2 #define DT2811_DADAT0HI 3 #define DT2811_DADAT1LO 4 @@ -218,6 +219,8 @@ static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, int i; for (i = 0; i < insn->n; i++) { + unsigned int val; + /* select channel/gain and trigger conversion */ outb(DT2811_ADGCR_CHAN(chan) | DT2811_ADGCR_GAIN(range), dev->iobase + DT2811_ADGCR_REG); @@ -226,9 +229,11 @@ static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, if (ret) return ret; - data[i] = inb(dev->iobase + DT2811_ADDATLO); - data[i] |= inb(dev->iobase + DT2811_ADDATHI) << 8; - data[i] &= 0xfff; + val = inb(dev->iobase + DT2811_ADDATA_LO_REG) | + (inb(dev->iobase + DT2811_ADDATA_HI_REG) << 8); + val &= s->maxdata; + + data[i] = val; } return i; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 02/19] staging: comedi: dt2811: remove redundant block comment
The configuration options are listed in the comedi comment block. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 20 1 file changed, 20 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 499637b..5d550d1 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -297,26 +297,6 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, return insn->n; } -/* - options[0] Board base address - options[1] IRQ - options[2] Input configuration -0 == single-ended -1 == differential -2 == pseudo-differential - options[3] Analog input range configuration -0 == bipolar 5 (-5V -- +5V) -1 == bipolar 2.5V (-2.5V -- +2.5V) -2 == unipolar 5V (0V -- +5V) - options[4] Analog output 0 range configuration -0 == bipolar 5 (-5V -- +5V) -1 == bipolar 2.5V (-2.5V -- +2.5V) -2 == unipolar 5V (0V -- +5V) - options[5] Analog output 1 range configuration -0 == bipolar 5 (-5V -- +5V) -1 == bipolar 2.5V (-2.5V -- +2.5V) -2 == unipolar 5V (0V -- +5V) -*/ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) { /* int i; */ -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 03/19] staging: comedi: dt2811: remove disabled code
There is no reason the (*attach) should be trying to read an analog input sample. Remove this disabled code. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 10 +- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 5d550d1..3cd9fe5 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -299,23 +299,15 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - /* int i; */ const struct dt2811_board *board = dev->board_ptr; struct dt2811_private *devpriv; - int ret; struct comedi_subdevice *s; + int ret; ret = comedi_request_region(dev, it->options[0], 0x8); if (ret) return ret; -#if 0 - outb(0, dev->iobase + DT2811_ADCSR); - udelay(100); - i = inb(dev->iobase + DT2811_ADDATLO); - i = inb(dev->iobase + DT2811_ADDATHI); -#endif - ret = comedi_alloc_subdevices(dev, 4); if (ret) return ret; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 12/19] staging: comedi: dt2811: tidy up analog output subdevice init
Add some whitespace to the analog output subdevice initialization. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 6850eb8..b60ee74 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -328,14 +328,14 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) break; } + /* Analog Output subdevice */ s = &dev->subdevices[1]; - /* ao subdevice */ - s->type = COMEDI_SUBD_AO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 2; - s->maxdata = 0xfff; - s->range_table = &dt2811_ao_ranges; - s->insn_write = dt2811_ao_insn_write; + s->type = COMEDI_SUBD_AO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 2; + s->maxdata = 0x0fff; + s->range_table = &dt2811_ao_ranges; + s->insn_write = dt2811_ao_insn_write; ret = comedi_alloc_subdev_readback(s); if (ret) -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 00/19] staging: comedi: dt2811: cleanup driver
Fix all the checkpatch.pl isses and tidy up the driver. v2: sort the analog input range table to match the old configuration option scheme, as requested by Ian Abbott, in patch 15/19. H Hartley Sweeten (19): staging: comedi: dt2811: tidy up copyright and comedi comments staging: comedi: dt2811: remove redundant block comment staging: comedi: dt2811: remove disabled code staging: comedi: dt2811: tidy up A/D Control/Status register defines staging: comedi: dt2811: tidy up A/D Gain/Channel register defines staging: comedi: dt2811: tidy up A/D Data register defines staging: comedi: dt2811: tidy up D/A Data register defines staging: comedi: dt2811: tidy up Digital Input/Output register defines staging: comedi: dt2811: tidy up Timer/Counter register defines staging: comedi: dt2811: tidy up the digital subdevices staging: comedi: dt2811: simplify analog output range options staging: comedi: dt2811: tidy up analog output subdevice init staging: comedi: dt2811: simplify A/D reference configuration staging: comedi: dt2811: remove private data staging: comedi: dt2811: simplify analog input range options staging: comedi: dt2811: tidy up analog input subdevice init staging: comedi: dt2811: remove unused define staging: comedi: dt2811: rename 'boardtypes' staging: comedi: dt2811: update the MODULE_DESCRIPTION drivers/staging/comedi/drivers/dt2811.c | 569 1 file changed, 220 insertions(+), 349 deletions(-) -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 09/19] staging: comedi: dt2811: tidy up Timer/Counter register defines
This register currently is not being used. For aesthetics, cleanup the define and the comment about the frequency control. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 45 + 1 file changed, 17 insertions(+), 28 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 61aa323..6ea1ad4 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -76,6 +76,23 @@ #define DT2811_DI_REG 0x06/* r Digital Input Port 0 */ #define DT2811_DO_REG 0x06/* w Digital Output Port 1 */ +/* + * Timer frequency control: + * DT2811_TMRCTR_MANTISSADT2811_TMRCTR_EXPONENT + * val divisor frequency val multiply divisor/divide frequency by + *0 1 600 kHz 0 1 + *1 10 60 kHz 1 10 + *2 2 300 kHz 2 100 + *3 3 200 kHz 3 1000 + *4 4 150 kHz 4 1 + *5 5 120 kHz 5 10 + *6 6 100 kHz 6 100 + *7 12 50 kHz 7 1000 + */ +#define DT2811_TMRCTR_REG 0x07/* r/w Timer/Counter */ +#define DT2811_TMRCTR_MANTISSA(x) (((x) & 0x7) << 3) +#define DT2811_TMRCTR_EXPONENT(x) (((x) & 0x7) << 0) + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -130,36 +147,8 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { } }; -/* - 0x07 TMRCTR (R/W) Timer/Counter Register - bits 6,7 - reserved - bits 5-3 - Timer frequency control (mantissa) - 543 divisor freqency (kHz) - 000 1600 - 001 10 60 - 010 2300 - 011 3200 - 100 4150 - 101 5120 - 110 6100 - 111 12 50 - bits 2-0 - Timer frequency control (exponent) - 210 multiply divisor/divide frequency by - 000 1 - 001 10 - 010 100 - 011 1000 - 100 1 - 101 10 - 110 100 - 111 1000 - - */ - #define TIMEOUT 1 -#define DT2811_TMRCTR 7 - struct dt2811_board { const char *name; const struct comedi_lrange *bip_5; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 07/19] staging: comedi: dt2811: tidy up D/A Data register defines
Cleanup the defines for these registers and and remove the redundant information in the comment. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 19 +-- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 0c0b7b7..1717281 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -70,6 +70,9 @@ #define DT2811_ADDATA_LO_REG 0x02/* r A/D Data low byte */ #define DT2811_ADDATA_HI_REG 0x03/* r A/D Data high byte */ +#define DT2811_DADATA_LO_REG(x)(0x02 + ((x) * 2)) /* w D/A Data low */ +#define DT2811_DADATA_HI_REG(x)(0x03 + ((x) * 2)) /* w D/A Data high */ + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -125,14 +128,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { }; /* - - 0x02,0x03 - (W) DADAT0 D/A Data Register 0 - 0x02 low byte - 0x03 high byte - - 0x04,0x05 (W) DADAT0 D/A Data Register 1 - 0x06 (R) DIO0 Digital Input Port 0 (W) DIO1 Digital Output Port 1 @@ -163,10 +158,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define TIMEOUT 1 -#define DT2811_DADAT0LO 2 -#define DT2811_DADAT0HI 3 -#define DT2811_DADAT1LO 4 -#define DT2811_DADAT1HI 5 #define DT2811_DIO 6 #define DT2811_TMRCTR 7 @@ -250,9 +241,9 @@ static int dt2811_ao_insn_write(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { val = data[i]; - outb(val & 0xff, dev->iobase + DT2811_DADAT0LO + 2 * chan); + outb(val & 0xff, dev->iobase + DT2811_DADATA_LO_REG(chan)); outb((val >> 8) & 0xff, -dev->iobase + DT2811_DADAT0HI + 2 * chan); +dev->iobase + DT2811_DADATA_HI_REG(chan)); } s->readback[chan] = val; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 13/19] staging: comedi: dt2811: simplify A/D reference configuration
The analog inputs are confgured with jumpers on the board to be: * 16 single-ended inputs * 8 differential inputs * 16 pseudo-differential inputs (common ground) Simplify the handling of this configuration option and properly set the subdev_flags based on the selected input mode. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 32 1 file changed, 8 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index b60ee74..1fe657c 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -29,10 +29,10 @@ * Configuration options: * [0] - I/O port base address * [1] - IRQ, although this is currently unused - * [2] - A/D reference - *0 = single-ended - *1 = differential - *2 = pseudo-differential (common reference) + * [2] - A/D reference (# of analog inputs) + *0 = single-ended (16 channels) + *1 = differential (8 channels) + *2 = pseudo-differential (16 channels) * [3] - A/D range *0 = [-5, 5] *1 = [-2.5, 2.5] @@ -184,9 +184,6 @@ enum { card_2811_pgh, card_2811_pgl }; struct dt2811_private { int ntrig; int curadchan; - enum { - adc_singleended, adc_diff, adc_pseudo_diff - } adc_mux; }; static int dt2811_ai_eoc(struct comedi_device *dev, @@ -293,26 +290,13 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (!devpriv) return -ENOMEM; - switch (it->options[2]) { - case 0: - devpriv->adc_mux = adc_singleended; - break; - case 1: - devpriv->adc_mux = adc_diff; - break; - case 2: - devpriv->adc_mux = adc_pseudo_diff; - break; - default: - devpriv->adc_mux = adc_singleended; - break; - } - s = &dev->subdevices[0]; /* initialize the ADC subdevice */ s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | SDF_GROUND; - s->n_chan = devpriv->adc_mux == adc_diff ? 8 : 16; + s->subdev_flags = SDF_READABLE | + (it->options[2] == 1) ? SDF_DIFF : + (it->options[2] == 2) ? SDF_COMMON : SDF_GROUND; + s->n_chan = (it->options[2] == 1) ? 8 : 16; s->insn_read = dt2811_ai_insn; s->maxdata = 0xfff; switch (it->options[3]) { -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 04/19] staging: comedi: dt2811: tidy up A/D Control/Status register defines
Cleanup the defines for this register and its bits and remove the redundant information in the comment. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 59 - 1 file changed, 21 insertions(+), 38 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 3cd9fe5..433cfd1 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -44,6 +44,25 @@ #include #include "../comedidev.h" +/* + * Register I/O map + */ +#define DT2811_ADCSR_REG 0x00/* r/w A/D Control/Status */ +#define DT2811_ADCSR_ADDONEBIT(7) /* r 1=A/D conv done */ +#define DT2811_ADCSR_ADERROR BIT(6) /* r 1=A/D error */ +#define DT2811_ADCSR_ADBUSYBIT(5) /* r 1=A/D busy */ +#define DT2811_ADCSR_CLRERROR BIT(4) +#define DT2811_ADCSR_INTENBBIT(2) /* r/w1=interupts ena */ +#define DT2811_ADCSR_ADMODE(x) (((x) & 0x3) << 0) +/* single conversion on ADGCR load */ +#define DT2811_ADCSR_ADMODE_SINGLE DT2811_ADCSR_ADMODE(0) +/* continuous conversion, internal clock, (clock enabled on ADGCR load) */ +#define DT2811_ADCSR_ADMODE_CONT DT2811_ADCSR_ADMODE(1) +/* continuous conversion, internal clock, external trigger */ +#define DT2811_ADCSR_ADMODE_EXT_TRIG DT2811_ADCSR_ADMODE(2) +/* continuous conversion, external clock, external trigger */ +#define DT2811_ADCSR_ADMODE_EXTDT2811_ADCSR_ADMODE(3) + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -100,28 +119,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { /* - 0x00ADCSR R/W A/D Control/Status Register - bit 7 - (R) 1 indicates A/D conversion done - reading ADDAT clears bit - (W) ignored - bit 6 - (R) 1 indicates A/D error - (W) ignored - bit 5 - (R) 1 indicates A/D busy, cleared at end - of conversion - (W) ignored - bit 4 - (R) 0 - (W) - bit 3 - (R) 0 - bit 2 - (R/W) 1 indicates interrupts enabled - bits 1,0 - (R/W) mode bits - 00 single conversion on ADGCR load - 01 continuous conversion, internal clock, - (clock enabled on ADGCR load) - 10 continuous conversion, internal clock, - external trigger - 11 continuous conversion, external clock, - external trigger - 0x01ADGCR R/W A/D Gain/Channel Register bit 6,7 - (R/W) gain select 00 gain=1, both PGH, PGL models @@ -169,7 +166,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define TIMEOUT 1 -#define DT2811_ADCSR 0 #define DT2811_ADGCR 1 #define DT2811_ADDATLO 2 #define DT2811_ADDATHI 3 @@ -180,19 +176,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define DT2811_DIO 6 #define DT2811_TMRCTR 7 -/* - * flags - */ - -/* ADCSR */ - -#define DT2811_ADDONE 0x80 -#define DT2811_ADERROR 0x40 -#define DT2811_ADBUSY 0x20 -#define DT2811_CLRERROR 0x10 -#define DT2811_INTENB 0x04 -#define DT2811_ADMODE 0x03 - struct dt2811_board { const char *name; const struct comedi_lrange *bip_5; @@ -227,8 +210,8 @@ static int dt2811_ai_eoc(struct comedi_device *dev, { unsigned int status; - status = inb(dev->iobase + DT2811_ADCSR); - if ((status & DT2811_ADBUSY) == 0) + status = inb(dev->iobase + DT2811_ADCSR_REG); + if ((status & DT2811_ADCSR_ADBUSY) == 0) return 0; return -EBUSY; } -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 19/19] staging: comedi: dt2811: update the MODULE_DESCRIPTION
Change the MODULE_DESCRIPTION to something more useful than the generic "Comedi low-level driver". Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 312403f..415512b 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -341,5 +341,5 @@ static struct comedi_driver dt2811_driver = { module_comedi_driver(dt2811_driver); MODULE_AUTHOR("Comedi http://www.comedi.org";); -MODULE_DESCRIPTION("Comedi low-level driver"); +MODULE_DESCRIPTION("Comedi driver for Data Translation DT2811 series boards"); MODULE_LICENSE("GPL"); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 15/19] staging: comedi: dt2811: simplify analog input range options
The A/D ranges are not programmable but the gain is. Currently this driver uses a configuration option to select the comedi_lrange that will be used for the analog input subdevice. This requires that the user makes sure the correct option value is used. The user space library uses the range information to convert between raw values and physical units. If the user passed an incorrect option when attaching the driver the conversion will be incorrect. A previous patch allowed the gain to be set based on the chanspec range. Prior to that the gain was always set to 1 so any conversion with a gain that is not 1 would be incorrect anyway. Simplify the analog input ranges by providing a range_table for the pgh and pgl boards that contain all the possible range/gain options. The user can then select the correct range (and gain) when converting values or reading the analog inputs. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 143 ++-- 1 file changed, 61 insertions(+), 82 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 379b7d5..f0b3c5e 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -33,14 +33,17 @@ *0 = single-ended (16 channels) *1 = differential (8 channels) *2 = pseudo-differential (16 channels) - * [3] - A/D range - *0 = [-5, 5] - *1 = [-2.5, 2.5] - *2 = [0, 5] + * [3] - A/D range (deprecated, see below) * [4] - D/A 0 range (deprecated, see below) * [5] - D/A 1 range (deprecated, see below) * * Notes: + * - A/D ranges are not programmable but the gain is. The AI subdevice has + * a range_table containing all the possible analog input range/gain + * options for the dt2811-pgh or dt2811-pgl. Use the range that matches + * your board configuration and the desired gain to correctly convert + * between data values and physical units and to set the correct output + * gain. * - D/A ranges are not programmable. The AO subdevice has a range_table * containing all the possible analog output ranges. Use the range * that matches your board configuration to convert between data @@ -99,57 +102,52 @@ #define DT2811_TMRCTR_MANTISSA(x) (((x) & 0x7) << 3) #define DT2811_TMRCTR_EXPONENT(x) (((x) & 0x7) << 0) -static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { - 4, { - UNI_RANGE(5), - UNI_RANGE(2.5), - UNI_RANGE(1.25), - UNI_RANGE(0.625) - } -}; - -static const struct comedi_lrange range_dt2811_pgh_ai_2_5_bipolar = { - 4, { - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625), - BIP_RANGE(0.3125) - } -}; - -static const struct comedi_lrange range_dt2811_pgh_ai_5_bipolar = { - 4, { - BIP_RANGE(5), - BIP_RANGE(2.5), - BIP_RANGE(1.25), - BIP_RANGE(0.625) - } -}; - -static const struct comedi_lrange range_dt2811_pgl_ai_5_unipolar = { - 4, { - UNI_RANGE(5), - UNI_RANGE(0.5), - UNI_RANGE(0.05), - UNI_RANGE(0.01) - } -}; - -static const struct comedi_lrange range_dt2811_pgl_ai_2_5_bipolar = { - 4, { - BIP_RANGE(2.5), - BIP_RANGE(0.25), - BIP_RANGE(0.025), - BIP_RANGE(0.005) +/* + * The Analog Input range is set using jumpers on the board. + * + * Input Range W9 W10 + * -5V to +5V In Out + * -2.5V to +2.5V In In + * 0V to +5V Out In + * + * The gain may be set to 1, 2, 4, or 8 (on the dt2811-pgh) or to + * 1, 10, 100, 500 (on the dt2811-pgl). + */ +static const struct comedi_lrange dt2811_pgh_ai_ranges = { + 12, { + BIP_RANGE(5), /* range 0: gain=1 */ + BIP_RANGE(2.5), /* range 1: gain=2 */ + BIP_RANGE(1.25),/* range 2: gain=4 */ + BIP_RANGE(0.625), /* range 3: gain=8 */ + + BIP_RANGE(2.5), /* range 0+4: gain=1 */ + BIP_RANGE(1.25),/* range 1+4: gain=2 */ + BIP_RANGE(0.625), /* range 2+4: gain=4 */ + BIP_RANGE(0.3125), /* range 3+4: gain=8 */ + + UNI_RANGE(5), /* range 0+8: gain=1 */ + UNI_RANGE(2.5), /* range 1+8: gain=2 */ + UNI_RANGE(1.25),/* range 2+8: gain=4 */ + UNI_RANGE(0.625)/* range 3+8: gain=8 */ } }; -static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { - 4, { - BIP_RANGE(5), - BIP_RANGE(0.5), - BIP_RANGE(0.05), - BIP_RANGE(0.01) +static const struct c
[PATCH v2 14/19] staging: comedi: dt2811: remove private data
The remaining members of the private data are not used by the driver. Remove it and the allocation. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 10 -- 1 file changed, 10 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 1fe657c..379b7d5 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -181,11 +181,6 @@ struct dt2811_board { enum { card_2811_pgh, card_2811_pgl }; -struct dt2811_private { - int ntrig; - int curadchan; -}; - static int dt2811_ai_eoc(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -274,7 +269,6 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dt2811_board *board = dev->board_ptr; - struct dt2811_private *devpriv; struct comedi_subdevice *s; int ret; @@ -286,10 +280,6 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - s = &dev->subdevices[0]; /* initialize the ADC subdevice */ s->type = COMEDI_SUBD_AI; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 17/19] staging: comedi: dt2811: remove unused define
This define is not used by the driver. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 44afa78..b1926e7 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -168,8 +168,6 @@ static const struct comedi_lrange dt2811_ao_ranges = { } }; -#define TIMEOUT 1 - struct dt2811_board { const char *name; unsigned int is_pgh:1; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 18/19] staging: comedi: dt2811: rename 'boardtypes'
Rename this array so it has namespace associated with the driver. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index b1926e7..312403f 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -173,7 +173,7 @@ struct dt2811_board { unsigned int is_pgh:1; }; -static const struct dt2811_board boardtypes[] = { +static const struct dt2811_board dt2811_boards[] = { { .name = "dt2811-pgh", .is_pgh = 1, @@ -334,8 +334,8 @@ static struct comedi_driver dt2811_driver = { .module = THIS_MODULE, .attach = dt2811_attach, .detach = comedi_legacy_detach, - .board_name = &boardtypes[0].name, - .num_names = ARRAY_SIZE(boardtypes), + .board_name = &dt2811_boards[0].name, + .num_names = ARRAY_SIZE(dt2811_boards), .offset = sizeof(struct dt2811_board), }; module_comedi_driver(dt2811_driver); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 10/19] staging: comedi: dt2811: tidy up the digital subdevices
Add some whitespace to the digital input and output subdevice initialization. Reorder the initialization a bit. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 34 - 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 6ea1ad4..0512d70 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -240,7 +240,8 @@ static int dt2811_ao_insn_write(struct comedi_device *dev, static int dt2811_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) + struct comedi_insn *insn, + unsigned int *data) { data[1] = inb(dev->iobase + DT2811_DI_REG); @@ -357,24 +358,23 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; + /* Digital Input subdevice */ s = &dev->subdevices[2]; - /* di subdevice */ - s->type = COMEDI_SUBD_DI; - s->subdev_flags = SDF_READABLE; - s->n_chan = 8; - s->insn_bits = dt2811_di_insn_bits; - s->maxdata = 1; - s->range_table = &range_digital; - + s->type = COMEDI_SUBD_DI; + s->subdev_flags = SDF_READABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= dt2811_di_insn_bits; + + /* Digital Output subdevice */ s = &dev->subdevices[3]; - /* do subdevice */ - s->type = COMEDI_SUBD_DO; - s->subdev_flags = SDF_WRITABLE; - s->n_chan = 8; - s->insn_bits = dt2811_do_insn_bits; - s->maxdata = 1; - s->state = 0; - s->range_table = &range_digital; + s->type = COMEDI_SUBD_DO; + s->subdev_flags = SDF_WRITABLE; + s->n_chan = 8; + s->maxdata = 1; + s->range_table = &range_digital; + s->insn_bits= dt2811_do_insn_bits; return 0; } -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 16/19] staging: comedi: dt2811: tidy up analog input subdevice init
Add some whitespace to the analog output subdevice initialization and rename the (*insn_read) function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index f0b3c5e..44afa78 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -197,8 +197,10 @@ static int dt2811_ai_eoc(struct comedi_device *dev, return -EBUSY; } -static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, - struct comedi_insn *insn, unsigned int *data) +static int dt2811_ai_insn_read(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { unsigned int chan = CR_CHAN(insn->chanspec); unsigned int range = CR_RANGE(insn->chanspec); @@ -283,17 +285,17 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) if (ret) return ret; + /* Analog Input subdevice */ s = &dev->subdevices[0]; - /* initialize the ADC subdevice */ - s->type = COMEDI_SUBD_AI; - s->subdev_flags = SDF_READABLE | + s->type = COMEDI_SUBD_AI; + s->subdev_flags = SDF_READABLE | (it->options[2] == 1) ? SDF_DIFF : (it->options[2] == 2) ? SDF_COMMON : SDF_GROUND; - s->n_chan = (it->options[2] == 1) ? 8 : 16; - s->insn_read = dt2811_ai_insn; - s->maxdata = 0xfff; + s->n_chan = (it->options[2] == 1) ? 8 : 16; + s->maxdata = 0x0fff; s->range_table = board->is_pgh ? &dt2811_pgh_ai_ranges : &dt2811_pgl_ai_ranges; + s->insn_read= dt2811_ai_insn_read; /* Analog Output subdevice */ s = &dev->subdevices[1]; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 01/19] staging: comedi: dt2811: tidy up copyright and comedi comments
Fix the checkpatch.pl issue: WARNING: Block comments use * on subsequent lines Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 78 - 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index a807732..499637b 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -1,45 +1,45 @@ /* - comedi/drivers/dt2811.c - Hardware driver for Data Translation DT2811 - - COMEDI - Linux Control and Measurement Device Interface - History: - Base Version - David A. Schleef - December 1998 - Updated to work. David does not have a DT2811 - board any longer so this was suffering from bitrot. - Updated performed by ... - - 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. + * Comedi driver for Data Translation DT2811 + * + * COMEDI - Linux Control and Measurement Device Interface + * History: + * Base Version - David A. Schleef + * December 1998 - Updated to work. David does not have a DT2811 + * board any longer so this was suffering from bitrot. + * Updated performed by ... + * + * 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. */ + /* -Driver: dt2811 -Description: Data Translation DT2811 -Author: ds -Devices: [Data Translation] DT2811-PGL (dt2811-pgl), DT2811-PGH (dt2811-pgh) -Status: works - -Configuration options: - [0] - I/O port base address - [1] - IRQ, although this is currently unused - [2] - A/D reference - 0 = signle-ended - 1 = differential - 2 = pseudo-differential (common reference) - [3] - A/D range - 0 = [-5, 5] - 1 = [-2.5, 2.5] - 2 = [0, 5] - [4] - D/A 0 range (same choices) - [4] - D/A 1 range (same choices) -*/ + * Driver: dt2811 + * Description: Data Translation DT2811 + * Author: ds + * Devices: [Data Translation] DT2811-PGL (dt2811-pgl), DT2811-PGH (dt2811-pgh) + * Status: works + * + * Configuration options: + * [0] - I/O port base address + * [1] - IRQ, although this is currently unused + * [2] - A/D reference + *0 = single-ended + *1 = differential + *2 = pseudo-differential (common reference) + * [3] - A/D range + *0 = [-5, 5] + *1 = [-2.5, 2.5] + *2 = [0, 5] + * [4] - D/A 0 range (same as A/D range) + * [5] - D/A 1 range (same as A/D range) + */ #include #include "../comedidev.h" -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 11/19] staging: comedi: dt2811: simplify analog output range options
The D/A ranges are not programmable. Currently this driver uses some configuration options to select the comedi_lrange for each channel. This is a bit messy and it requires the user to make sure the correct option value is used. The range information isn't used by the driver. The user space library uses it to convert between raw data values and physical units. If the user passed an incorrect option when attaching the driver the conversion will be incorrect. Simplify the analog output ranges by providing a range_table that contains all the possible output ranges. The user can then select the correct range when converting values. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 69 + 1 file changed, 26 insertions(+), 43 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 0512d70..6850eb8 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -37,8 +37,14 @@ *0 = [-5, 5] *1 = [-2.5, 2.5] *2 = [0, 5] - * [4] - D/A 0 range (same as A/D range) - * [5] - D/A 1 range (same as A/D range) + * [4] - D/A 0 range (deprecated, see below) + * [5] - D/A 1 range (deprecated, see below) + * + * Notes: + * - D/A ranges are not programmable. The AO subdevice has a range_table + * containing all the possible analog output ranges. Use the range + * that matches your board configuration to convert between data + * values and physical units. */ #include @@ -147,6 +153,23 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { } }; +/* + * The Analog Output range is set per-channel using jumpers on the board. + * + * DAC0 JumpersDAC1 Jumpers + * Output RangeW5 W6 W7 W8 W1 W2 W3 W4 + * -5V to +5V In Out In Out In Out In Out + * -2.5V to +2.5V In Out Out In In Out Out In + * 0 to +5VOut In Out In Out In Out In + */ +static const struct comedi_lrange dt2811_ao_ranges = { + 3, { + BIP_RANGE(5), /* default setting from factory */ + BIP_RANGE(2.5), + UNI_RANGE(5) + } +}; + #define TIMEOUT 1 struct dt2811_board { @@ -164,16 +187,6 @@ struct dt2811_private { enum { adc_singleended, adc_diff, adc_pseudo_diff } adc_mux; - enum { - dac_bipolar_5, dac_bipolar_2_5, dac_unipolar_5 - } dac_range[2]; - const struct comedi_lrange *range_type_list[2]; -}; - -static const struct comedi_lrange *dac_range_types[] = { - &range_bipolar5, - &range_bipolar2_5, - &range_unipolar5 }; static int dt2811_ai_eoc(struct comedi_device *dev, @@ -294,34 +307,6 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) devpriv->adc_mux = adc_singleended; break; } - switch (it->options[4]) { - case 0: - devpriv->dac_range[0] = dac_bipolar_5; - break; - case 1: - devpriv->dac_range[0] = dac_bipolar_2_5; - break; - case 2: - devpriv->dac_range[0] = dac_unipolar_5; - break; - default: - devpriv->dac_range[0] = dac_bipolar_5; - break; - } - switch (it->options[5]) { - case 0: - devpriv->dac_range[1] = dac_bipolar_5; - break; - case 1: - devpriv->dac_range[1] = dac_bipolar_2_5; - break; - case 2: - devpriv->dac_range[1] = dac_unipolar_5; - break; - default: - devpriv->dac_range[1] = dac_bipolar_5; - break; - } s = &dev->subdevices[0]; /* initialize the ADC subdevice */ @@ -349,9 +334,7 @@ static int dt2811_attach(struct comedi_device *dev, struct comedi_devconfig *it) s->subdev_flags = SDF_WRITABLE; s->n_chan = 2; s->maxdata = 0xfff; - s->range_table_list = devpriv->range_type_list; - devpriv->range_type_list[0] = dac_range_types[devpriv->dac_range[0]]; - devpriv->range_type_list[1] = dac_range_types[devpriv->dac_range[1]]; + s->range_table = &dt2811_ao_ranges; s->insn_write = dt2811_ao_insn_write; ret = comedi_alloc_subdev_readback(s); -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 05/19] staging: comedi: dt2811: tidy up A/D Gain/Channel register defines
Cleanup the defines for this register and its bits and remove the redundant information in the comment. Make the (*insn_read) use the range to set the gain bits correctly. Currently the gain is always set to 1. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 22 +- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 433cfd1..f72d6c8 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -63,6 +63,10 @@ /* continuous conversion, external clock, external trigger */ #define DT2811_ADCSR_ADMODE_EXTDT2811_ADCSR_ADMODE(3) +#define DT2811_ADGCR_REG 0x01/* r/w A/D Gain/Channel */ +#define DT2811_ADGCR_GAIN(x) (((x) & 0x3) << 6) +#define DT2811_ADGCR_CHAN(x) (((x) & 0xf) << 0) + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -119,16 +123,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { /* - 0x01ADGCR R/W A/D Gain/Channel Register - bit 6,7 - (R/W) gain select - 00 gain=1, both PGH, PGL models - 01 gain=2 PGH, 10 PGL - 10 gain=4 PGH, 100 PGL - 11 gain=8 PGH, 500 PGL - bit 4,5 - reserved - bit 3-0 - (R/W) channel select - channel number from 0-15 - 0x02,0x03 (R) ADDAT A/D Data Register (W) DADAT0 D/A Data Register 0 0x02 low byte @@ -166,7 +160,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define TIMEOUT 1 -#define DT2811_ADGCR 1 #define DT2811_ADDATLO 2 #define DT2811_ADDATHI 3 #define DT2811_DADAT0LO 2 @@ -219,12 +212,15 @@ static int dt2811_ai_eoc(struct comedi_device *dev, static int dt2811_ai_insn(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - int chan = CR_CHAN(insn->chanspec); + unsigned int chan = CR_CHAN(insn->chanspec); + unsigned int range = CR_RANGE(insn->chanspec); int ret; int i; for (i = 0; i < insn->n; i++) { - outb(chan, dev->iobase + DT2811_ADGCR); + /* select channel/gain and trigger conversion */ + outb(DT2811_ADGCR_CHAN(chan) | DT2811_ADGCR_GAIN(range), +dev->iobase + DT2811_ADGCR_REG); ret = comedi_timeout(dev, s, insn, dt2811_ai_eoc, 0); if (ret) -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 08/19] staging: comedi: dt2811: tidy up Digital Input/Output register defines
The digital input and outputs are separate ports even though they share the same register offset. For aesthetics, define then separately and remove the redundant information in the comment. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/dt2811.c | 11 +-- 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 1717281..61aa323 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -73,6 +73,9 @@ #define DT2811_DADATA_LO_REG(x)(0x02 + ((x) * 2)) /* w D/A Data low */ #define DT2811_DADATA_HI_REG(x)(0x03 + ((x) * 2)) /* w D/A Data high */ +#define DT2811_DI_REG 0x06/* r Digital Input Port 0 */ +#define DT2811_DO_REG 0x06/* w Digital Output Port 1 */ + static const struct comedi_lrange range_dt2811_pgh_ai_5_unipolar = { 4, { UNI_RANGE(5), @@ -128,9 +131,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { }; /* - 0x06 (R) DIO0 Digital Input Port 0 - (W) DIO1 Digital Output Port 1 - 0x07 TMRCTR (R/W) Timer/Counter Register bits 6,7 - reserved bits 5-3 - Timer frequency control (mantissa) @@ -158,7 +158,6 @@ static const struct comedi_lrange range_dt2811_pgl_ai_5_bipolar = { #define TIMEOUT 1 -#define DT2811_DIO 6 #define DT2811_TMRCTR 7 struct dt2811_board { @@ -254,7 +253,7 @@ static int dt2811_di_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, unsigned int *data) { - data[1] = inb(dev->iobase + DT2811_DIO); + data[1] = inb(dev->iobase + DT2811_DI_REG); return insn->n; } @@ -265,7 +264,7 @@ static int dt2811_do_insn_bits(struct comedi_device *dev, unsigned int *data) { if (comedi_dio_update_state(s, data)) - outb(s->state, dev->iobase + DT2811_DIO); + outb(s->state, dev->iobase + DT2811_DO_REG); data[1] = s->state; -- 2.6.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 00/19] staging: comedi: dt2811: cleanup driver
On 05/04/16 20:47, H Hartley Sweeten wrote: Fix all the checkpatch.pl isses and tidy up the driver. v2: sort the analog input range table to match the old configuration option scheme, as requested by Ian Abbott, in patch 15/19. H Hartley Sweeten (19): staging: comedi: dt2811: tidy up copyright and comedi comments staging: comedi: dt2811: remove redundant block comment staging: comedi: dt2811: remove disabled code staging: comedi: dt2811: tidy up A/D Control/Status register defines staging: comedi: dt2811: tidy up A/D Gain/Channel register defines staging: comedi: dt2811: tidy up A/D Data register defines staging: comedi: dt2811: tidy up D/A Data register defines staging: comedi: dt2811: tidy up Digital Input/Output register defines staging: comedi: dt2811: tidy up Timer/Counter register defines staging: comedi: dt2811: tidy up the digital subdevices staging: comedi: dt2811: simplify analog output range options staging: comedi: dt2811: tidy up analog output subdevice init staging: comedi: dt2811: simplify A/D reference configuration staging: comedi: dt2811: remove private data staging: comedi: dt2811: simplify analog input range options staging: comedi: dt2811: tidy up analog input subdevice init staging: comedi: dt2811: remove unused define staging: comedi: dt2811: rename 'boardtypes' staging: comedi: dt2811: update the MODULE_DESCRIPTION drivers/staging/comedi/drivers/dt2811.c | 569 1 file changed, 220 insertions(+), 349 deletions(-) Thanks! Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Web: http://www.mev.co.uk/ )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH [RFC]] PCI: hv: add explicit fencing to config space access
On Tue, May 03, 2016 at 02:22:00PM +0200, Vitaly Kuznetsov wrote: > I'm trying to pass-through Broadcom BCM5720 NIC (Dell Device 1f5b) on Dell > R720 server. Everything works fine when target VM has only one CPU, but > SMP guests reboot when NIC driver is trying to access PCI config space > (with hv_pcifront_read_config/hv_pcifront_write_config). The reboot > appears to be induced by the hypervisor and no crash is observed. Windows > event logs are not helpful at all ('Virtual machine ... has quit > unexpectedly'). The particular access point is always different and > putting debug between them (printk/mdelay/...) moves the issue further > away. The server model affects the issue as well: on Dell R420 I'm able to > pass-through BCM5720 NIC to SMP guests without issues. > > While I'm obviously failing to reveal the essence of the issue I was able > to come up with a (possible) solution: if explicit fencing is put to > hv_pcifront_read_config/hv_pcifront_write_config the issue goes away. The > essential minimum is rmb() at the end on _hv_pcifront_read_config() and > wmb() at the end of _hv_pcifront_write_config() but I'm not confident it > will be sufficient for all hardware. I suggest the following fencing: > 1) wmb()/mb() between choosing the function and writing to its space. > 2) mb() before releasing the spinlock in both _hv_pcifront_read_config()/ >_hv_pcifront_write_config to ensure that consecutive reads/writes to > the space won't get re-ordered as drivers may count on that. > Config space access is not supposed to be performance-critical so this > explicit fencing is not supposed to bring any slowdown. > > Signed-off-by: Vitaly Kuznetsov Applied with Jake's ack to pci/host-hv for v4.7, thanks, Vitaly. I changed "fence" to "barrier" in the changelog to follow the common Linux terminology. > --- > drivers/pci/host/pci-hyperv.c | 14 ++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/pci/host/pci-hyperv.c b/drivers/pci/host/pci-hyperv.c > index c17e792..7e9b2de 100644 > --- a/drivers/pci/host/pci-hyperv.c > +++ b/drivers/pci/host/pci-hyperv.c > @@ -553,6 +553,8 @@ static void _hv_pcifront_read_config(struct hv_pci_dev > *hpdev, int where, > spin_lock_irqsave(&hpdev->hbus->config_lock, flags); > /* Choose the function to be read. (See comment above) */ > writel(hpdev->desc.win_slot.slot, hpdev->hbus->cfg_addr); > + /* Make sure the function was chosen before we start reading. */ > + mb(); > /* Read from that function's config space. */ > switch (size) { > case 1: > @@ -565,6 +567,11 @@ static void _hv_pcifront_read_config(struct hv_pci_dev > *hpdev, int where, > *val = readl(addr); > break; > } > + /* > + * Make sure the write was done before we release the spinlock > + * allowing consecutive reads/writes. > + */ > + mb(); > spin_unlock_irqrestore(&hpdev->hbus->config_lock, flags); > } else { > dev_err(&hpdev->hbus->hdev->device, > @@ -592,6 +599,8 @@ static void _hv_pcifront_write_config(struct hv_pci_dev > *hpdev, int where, > spin_lock_irqsave(&hpdev->hbus->config_lock, flags); > /* Choose the function to be written. (See comment above) */ > writel(hpdev->desc.win_slot.slot, hpdev->hbus->cfg_addr); > + /* Make sure the function was chosen before we start writing. */ > + wmb(); > /* Write to that function's config space. */ > switch (size) { > case 1: > @@ -604,6 +613,11 @@ static void _hv_pcifront_write_config(struct hv_pci_dev > *hpdev, int where, > writel(val, addr); > break; > } > + /* > + * Make sure the write was done before we release the spinlock > + * allowing consecutive reads/writes. > + */ > + mb(); > spin_unlock_irqrestore(&hpdev->hbus->config_lock, flags); > } else { > dev_err(&hpdev->hbus->hdev->device, > -- > 2.5.5 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: dt2811: add async command support for AI subdevice
The interrupt support available on this board is pretty limited but its simple enough to give basic async command support. This allows reading a single channel continuously using either the internal or an external clock to trigger each conversion. The command can also use the external trigger input to start the command if the external clock is being used for conversions. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- This is a follow up to: [PATCH v2 00/19] staging: comedi: dt2811: cleanup driver According to Data Translation's website, this ISA board _just_ went EOL on May 1, 2016. Who knows, there might actually be someone out there that is using it. drivers/staging/comedi/drivers/dt2811.c | 371 +--- 1 file changed, 340 insertions(+), 31 deletions(-) diff --git a/drivers/staging/comedi/drivers/dt2811.c b/drivers/staging/comedi/drivers/dt2811.c index 415512b..904f6377 100644 --- a/drivers/staging/comedi/drivers/dt2811.c +++ b/drivers/staging/comedi/drivers/dt2811.c @@ -2,11 +2,7 @@ * Comedi driver for Data Translation DT2811 * * COMEDI - Linux Control and Measurement Device Interface - * History: - * Base Version - David A. Schleef - * December 1998 - Updated to work. David does not have a DT2811 - * board any longer so this was suffering from bitrot. - * Updated performed by ... + * Copyright (C) David A. Schleef * * 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 @@ -28,7 +24,7 @@ * * Configuration options: * [0] - I/O port base address - * [1] - IRQ, although this is currently unused + * [1] - IRQ (optional, needed for async command support) * [2] - A/D reference (# of analog inputs) *0 = single-ended (16 channels) *1 = differential (8 channels) @@ -51,6 +47,9 @@ */ #include +#include +#include + #include "../comedidev.h" /* @@ -61,16 +60,9 @@ #define DT2811_ADCSR_ADERROR BIT(6) /* r 1=A/D error */ #define DT2811_ADCSR_ADBUSYBIT(5) /* r 1=A/D busy */ #define DT2811_ADCSR_CLRERROR BIT(4) -#define DT2811_ADCSR_INTENBBIT(2) /* r/w1=interupts ena */ +#define DT2811_ADCSR_DMAENBBIT(3) /* r/w1=dma ena */ +#define DT2811_ADCSR_INTENBBIT(2) /* r/w1=interupts ena */ #define DT2811_ADCSR_ADMODE(x) (((x) & 0x3) << 0) -/* single conversion on ADGCR load */ -#define DT2811_ADCSR_ADMODE_SINGLE DT2811_ADCSR_ADMODE(0) -/* continuous conversion, internal clock, (clock enabled on ADGCR load) */ -#define DT2811_ADCSR_ADMODE_CONT DT2811_ADCSR_ADMODE(1) -/* continuous conversion, internal clock, external trigger */ -#define DT2811_ADCSR_ADMODE_EXT_TRIG DT2811_ADCSR_ADMODE(2) -/* continuous conversion, external clock, external trigger */ -#define DT2811_ADCSR_ADMODE_EXTDT2811_ADCSR_ADMODE(3) #define DT2811_ADGCR_REG 0x01/* r/w A/D Gain/Channel */ #define DT2811_ADGCR_GAIN(x) (((x) & 0x3) << 6) @@ -85,6 +77,12 @@ #define DT2811_DI_REG 0x06/* r Digital Input Port 0 */ #define DT2811_DO_REG 0x06/* w Digital Output Port 1 */ +#define DT2811_TMRCTR_REG 0x07/* r/w Timer/Counter */ +#define DT2811_TMRCTR_MANTISSA(x) (((x) & 0x7) << 3) +#define DT2811_TMRCTR_EXPONENT(x) (((x) & 0x7) << 0) + +#define DT2811_OSC_BASE1666/* 600 kHz = 1666.6667ns */ + /* * Timer frequency control: * DT2811_TMRCTR_MANTISSADT2811_TMRCTR_EXPONENT @@ -98,9 +96,13 @@ *6 6 100 kHz 6 100 *7 12 50 kHz 7 1000 */ -#define DT2811_TMRCTR_REG 0x07/* r/w Timer/Counter */ -#define DT2811_TMRCTR_MANTISSA(x) (((x) & 0x7) << 3) -#define DT2811_TMRCTR_EXPONENT(x) (((x) & 0x7) << 0) +const unsigned int dt2811_clk_dividers[] = { + 1, 10, 2, 3, 4, 5, 6, 12 +}; + +const unsigned int dt2811_clk_multipliers[] = { + 1, 10, 100, 1000, 1, 10, 100, 1000 +}; /* * The Analog Input range is set using jumpers on the board. @@ -182,6 +184,287 @@ static const struct dt2811_board dt2811_boards[] = { }, }; +struct dt2811_private { + unsigned int ai_divisor; +}; + +static unsigned int dt2811_ai_read_sample(struct comedi_device *dev, + struct comedi_subdevice *s) +{ + unsigned int val; + + val = inb(dev->iobase + DT2811_ADDATA_LO_REG) | + (inb(dev->iobase + DT2811_ADDATA_HI_REG) << 8); + + return val & s->maxdata; +} + +static irqreturn_t dt2811_interrupt(int irq, void *d) +{ + struct comedi_device *dev = d; + struct comedi_subdevice *s = dev->read_subdev; + struct comedi_async *async = s->async; + struct comedi_cmd *cmd = &async->cmd; + unsigned int status; + +
给研发人员分派工作中容易出现的问题
558913579135680246 研发经理的领导力与执行力.xls Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] ION: Sys_heap: Makes ion buffer always alloc from page pool
Makes the ion buffer always alloced from page pool, no matter it's cached or not. In this way, it can improve the efficiency of it. Currently, there is no difference from cached or non-cached buffer for the page pool. Signed-off-by: Chen Feng --- drivers/staging/android/ion/ion_system_heap.c | 19 ++- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/drivers/staging/android/ion/ion_system_heap.c b/drivers/staging/android/ion/ion_system_heap.c index b69dfc7..caf11fc 100644 --- a/drivers/staging/android/ion/ion_system_heap.c +++ b/drivers/staging/android/ion/ion_system_heap.c @@ -56,24 +56,10 @@ static struct page *alloc_buffer_page(struct ion_system_heap *heap, struct ion_buffer *buffer, unsigned long order) { - bool cached = ion_buffer_cached(buffer); struct ion_page_pool *pool = heap->pools[order_to_index(order)]; struct page *page; - if (!cached) { - page = ion_page_pool_alloc(pool); - } else { - gfp_t gfp_flags = low_order_gfp_flags; - - if (order > 4) - gfp_flags = high_order_gfp_flags; - page = alloc_pages(gfp_flags | __GFP_COMP, order); - if (!page) - return NULL; - ion_pages_sync_for_device(NULL, page, PAGE_SIZE << order, - DMA_BIDIRECTIONAL); - } - + page = ion_page_pool_alloc(pool); return page; } @@ -81,9 +67,8 @@ static void free_buffer_page(struct ion_system_heap *heap, struct ion_buffer *buffer, struct page *page) { unsigned int order = compound_order(page); - bool cached = ion_buffer_cached(buffer); - if (!cached && !(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) { + if (!(buffer->private_flags & ION_PRIV_FLAG_SHRINKER_FREE)) { struct ion_page_pool *pool = heap->pools[order_to_index(order)]; ion_page_pool_free(pool, page); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: remove unused struct members
From: Erik Arfvidson The following struct members were never used: putfile_active_buffer::pnext putfile_request::file_request_number putfile_request::data_sequence_number Signed-off-by: Erik Arfvidson Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorchipset.c | 6 -- 1 file changed, 6 deletions(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index 6d9bbae..bb0ca31 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -150,8 +150,6 @@ static LIST_HEAD(putfile_request_list); struct putfile_active_buffer { /* a payload from a controlvm message, containing a file data buffer */ struct parser_context *parser_ctx; - /* points within data area of parser_ctx to next byte of data */ - u8 *pnext; /* # bytes left from to the end of this data buffer */ size_t bytes_remaining; }; @@ -166,14 +164,10 @@ struct putfile_request { /* header from original TransmitFile request */ struct controlvm_message_header controlvm_header; - u64 file_request_number;/* from original TransmitFile request */ /* link to next struct putfile_request */ struct list_head next_putfile_request; - /* most-recent sequence number supplied via a controlvm message */ - u64 data_sequence_number; - /* head of putfile_buffer_entry list, which describes the data to be * supplied as putfile data; * - this list is added to when controlvm messages come in that supply -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: unisys: visorhba: replace functionlike macro with function
From: Alexander Curtin The `set_no_disk_inquiry_request` function now uses the correct min macro. Also I removed an unnecessary conditional. Get rid of u8 casts, u32 len, and u32 lun (which is actually defined as a u64 in the scsidev->lun field from whence it originated). Signed-off-by: Alexander Curtin Signed-off-by: Tim Sell Signed-off-by: Erik Arfvidson Signed-off-by: David Kershner --- drivers/staging/unisys/include/iochannel.h | 42 - drivers/staging/unisys/visorhba/visorhba_main.c | 26 --- 2 files changed, 22 insertions(+), 46 deletions(-) diff --git a/drivers/staging/unisys/include/iochannel.h b/drivers/staging/unisys/include/iochannel.h index 880d9f0..5ccf814 100644 --- a/drivers/staging/unisys/include/iochannel.h +++ b/drivers/staging/unisys/include/iochannel.h @@ -253,48 +253,6 @@ struct uiscmdrsp_scsi { /* SCSI device version for no disk inquiry result */ #define SCSI_SPC2_VER 4/* indicates SCSI SPC2 (SPC3 is 5) */ -/* Windows and Linux want different things for a non-existent lun. So, we'll let - * caller pass in the peripheral qualifier and type. - * NOTE:[4] SCSI returns (n-4); so we return length-1-4 or length-5. - */ - -#define SET_NO_DISK_INQUIRY_RESULT(buf, len, lun, lun0notpresent, notpresent) \ - do {\ - memset(buf, 0, \ - MINNUM(len, \ - (unsigned int)NO_DISK_INQUIRY_RESULT_LEN)); \ - buf[2] = (u8)SCSI_SPC2_VER; \ - if (lun == 0) { \ - buf[0] = (u8)lun0notpresent;\ - buf[3] = (u8)DEV_HISUPPORT; \ - } else \ - buf[0] = (u8)notpresent;\ - buf[4] = (u8)( \ - MINNUM(len, \ - (unsigned int)NO_DISK_INQUIRY_RESULT_LEN) - 5);\ - if (len >= NO_DISK_INQUIRY_RESULT_LEN) {\ - buf[8] = 'D'; \ - buf[9] = 'E'; \ - buf[10] = 'L'; \ - buf[11] = 'L'; \ - buf[16] = 'P'; \ - buf[17] = 'S'; \ - buf[18] = 'E'; \ - buf[19] = 'U'; \ - buf[20] = 'D'; \ - buf[21] = 'O'; \ - buf[22] = ' '; \ - buf[23] = 'D'; \ - buf[24] = 'E'; \ - buf[25] = 'V'; \ - buf[26] = 'I'; \ - buf[27] = 'C'; \ - buf[28] = 'E'; \ - buf[30] = ' '; \ - buf[31] = '.'; \ - } \ - } while (0) - /* Struct & Defines to support sense information. */ /* The following struct is returned in sensebuf field in uiscmdrsp_scsi. It is diff --git a/drivers/staging/unisys/visorhba/visorhba_main.c b/drivers/staging/unisys/visorhba/visorhba_main.c index e93bb1d..6f53f3d 100644 --- a/drivers/staging/unisys/visorhba/visorhba_main.c +++ b/drivers/staging/unisys/visorhba/visorhba_main.c @@ -52,6 +52,8 @@ static int visorhba_resume(struct visor_device *dev, static ssize_t info_debugfs_read(struct file *file, char __user *buf, size_t len, loff_t *offset); +static int set_no_disk_inquiry_result(unsigned char *buf, + size_t len, bool is_lun0); static struct dentry *visorhba_debugfs_dir; static const struct file_operations debugfs_info_fops = { .read = info_debugfs_read, @@ -772,6 +774,24 @@ do_scsi_linuxstat(struct uiscmdrsp *cmdrsp, struct scsi_cmnd *scsicmd) } } +static int set_no_disk_inquiry_result(unsigned char *buf, + size_t len, bool is_lun0) +{ + if (!buf || len < NO_DISK_INQUIRY_RESULT_LEN) +
[PATCH] staging: unisys: visorchannel: correct variable misspelling
From: David Binder Fixes the spelling of a global variable passed into a kernel macro. Signed-off-by: David Binder Signed-off-by: David Kershner --- drivers/staging/unisys/visorbus/visorchipset.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/unisys/visorbus/visorchipset.c b/drivers/staging/unisys/visorbus/visorchipset.c index bb0ca31..83faf63 100644 --- a/drivers/staging/unisys/visorbus/visorchipset.c +++ b/drivers/staging/unisys/visorbus/visorchipset.c @@ -2342,7 +2342,7 @@ module_param_named(major, visorchipset_major, int, S_IRUGO); MODULE_PARM_DESC(visorchipset_major, "major device number to use for the device node"); module_param_named(visorbusregwait, visorchipset_visorbusregwait, int, S_IRUGO); -MODULE_PARM_DESC(visorchipset_visorbusreqwait, +MODULE_PARM_DESC(visorchipset_visorbusregwait, "1 to have the module wait for the visor bus to register"); module_init(init_unisys); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel