Re: [PATCH 2/2] staging: rlt8192u: conditional compilation in r8192U_core.c
On Tue, Jun 24, 2014 at 02:46:55PM +0200, Antoine Schweitzer-Chaput wrote: > function dump_eprom is only used when DEBUG_EPROM is set. > function txqueue2outpipe is only used when USE_ONE_PIPE is unset. > function GetRxPacketShiftBytes819xUsb is only used when > USB_RX_AGGREGATION_SUPPORT is set. > Compile these functions only when they will actually be used. > > Signed-off-by: Antoine Schweitzer-Chaput > --- > drivers/staging/rtl8192u/r8192U_core.c | 8 ++-- > 1 file changed, 6 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c > b/drivers/staging/rtl8192u/r8192U_core.c > index 4536a87..b6718c0 100644 > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -667,12 +667,14 @@ static void tx_timeout(struct net_device *dev) > > > /* this is only for debug */ > +#ifdef DEBUG_EPROM how can this ever be set? If no one sets it, just remove the code entirely please. > static void dump_eprom(struct net_device *dev) > { > int i; > for (i = 0; i < 63; i++) > RT_TRACE(COMP_EPROM, "EEPROM addr %x : %x", i, eprom_read(dev, > i)); > } > +#endif > > void rtl8192_update_msr(struct net_device *dev) > { > @@ -1553,6 +1555,7 @@ u16 N_DBPSOfRate(u16 DataRate) > return N_DBPS; > } > > +#ifndef USE_ONE_PIPE Same here, if the option can never be selected, just delete the code. > static unsigned int txqueue2outpipe(struct r8192_priv *priv, > unsigned int tx_queue) > { > @@ -1562,6 +1565,7 @@ static unsigned int txqueue2outpipe(struct r8192_priv > *priv, > } > return priv->txqueue_to_outpipemap[tx_queue]; > } > +#endif > > short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) > { > @@ -4874,18 +4878,18 @@ static void query_rxdesc_status(struct sk_buff *skb, > > } > > +#ifdef USB_RX_AGGREGATION_SUPPORT Same here. Care to do this series all over, just delete the functions entirely. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: visorchipset: fix sparse warnings about static declaration
Some functions were prototyped as static but the actual definition wasn't. While this is valid (the function is static because the two declarations don't conflict and the first one is static), this makes sparse unhappy and cause confusion of normal people too. Signed-off-by: Vincent Bernat --- .../unisys/visorchipset/visorchipset_main.c| 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 58a441dd602e..65541dad014c 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -367,8 +367,9 @@ static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * msgHdr, int response, ULTRA_SEGMENT_STATE state); -ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t toolaction_show(struct device *dev, + struct device_attribute *attr, + char *buf) { U8 toolAction; @@ -378,8 +379,9 @@ ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); } -ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t toolaction_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { U8 toolAction; @@ -395,8 +397,9 @@ ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, return -EIO; } -ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t boottotool_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -408,8 +411,9 @@ ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, efiSparIndication.BootToTool); } -ssize_t boottotool_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t boottotool_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int val; ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -2003,7 +2007,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) return TRUE; } -HOSTADDRESS controlvm_get_channel_address(void) +static HOSTADDRESS controlvm_get_channel_address(void) { U64 addr = 0; U32 size = 0; -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: visorchipset: fix sparse warnings about static declaration
On Fri, Aug 01, 2014 at 10:10:22AM +0200, Vincent Bernat wrote: > Some functions were prototyped as static but the actual definition > wasn't. While this is valid (the function is static because the two > declarations don't conflict and the first one is static), this makes > sparse unhappy and cause confusion of normal people too. > > Signed-off-by: Vincent Bernat > --- > .../unisys/visorchipset/visorchipset_main.c| 22 > +- > 1 file changed, 13 insertions(+), 9 deletions(-) This no longer applies cleanly to my tree, can you please refresh it and resend so that I can apply it? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: visorchipset: fix sparse warnings about static declaration
Some functions were prototyped as static but the actual definition wasn't. While this is valid (the function is static because the two declarations don't conflict and the first one is static), this makes sparse unhappy and cause confusion of normal people too. Signed-off-by: Vincent Bernat --- .../unisys/visorchipset/visorchipset_main.c| 22 +- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/staging/unisys/visorchipset/visorchipset_main.c b/drivers/staging/unisys/visorchipset/visorchipset_main.c index 156a72fdabd9..c40ff24a30b9 100644 --- a/drivers/staging/unisys/visorchipset/visorchipset_main.c +++ b/drivers/staging/unisys/visorchipset/visorchipset_main.c @@ -339,8 +339,9 @@ static void controlvm_respond_physdev_changestate(CONTROLVM_MESSAGE_HEADER * msgHdr, int response, ULTRA_SEGMENT_STATE state); -ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t toolaction_show(struct device *dev, + struct device_attribute *attr, + char *buf) { u8 toolAction; @@ -350,8 +351,9 @@ ssize_t toolaction_show(struct device *dev, struct device_attribute *attr, return scnprintf(buf, PAGE_SIZE, "%u\n", toolAction); } -ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t toolaction_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { u8 toolAction; int ret; @@ -369,8 +371,9 @@ ssize_t toolaction_store(struct device *dev, struct device_attribute *attr, return count; } -ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, - char *buf) +static ssize_t boottotool_show(struct device *dev, + struct device_attribute *attr, + char *buf) { ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -382,8 +385,9 @@ ssize_t boottotool_show(struct device *dev, struct device_attribute *attr, efiSparIndication.BootToTool); } -ssize_t boottotool_store(struct device *dev, struct device_attribute *attr, - const char *buf, size_t count) +static ssize_t boottotool_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) { int val, ret; ULTRA_EFI_SPAR_INDICATION efiSparIndication; @@ -1932,7 +1936,7 @@ handle_command(CONTROLVM_MESSAGE inmsg, HOSTADDRESS channel_addr) return TRUE; } -HOSTADDRESS controlvm_get_channel_address(void) +static HOSTADDRESS controlvm_get_channel_address(void) { U64 addr = 0; U32 size = 0; -- 2.0.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] staging: rlt8192u: conditional compilation in r8192U_core.c
On Fri, Aug 01, 2014 at 12:59:43AM -0700, Greg KH wrote: > > /* this is only for debug */ > > +#ifdef DEBUG_EPROM > > how can this ever be set? If no one sets it, just remove the code > entirely please. I guess it's supposed to be set manually in the code (there's a large list around l.60). > > +#ifndef USE_ONE_PIPE > > Same here, if the option can never be selected, just delete the code. > > > +#ifdef USB_RX_AGGREGATION_SUPPORT > > Same here. These two are set in the Makefile, but not configurable from the outside. I'll remove all of these, and possibly other options in the same case. Antoine ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/1] staging: rtl8192u: remove unselectable options DEBUG_*, USE_ONE_PIPE, USB_RX_AGGREGATION_SUPPORT, USB_TX_DRIVER_AGGREGATION_ENABLE
The code which was only reachable using these options is also removed. Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/Makefile | 3 - drivers/staging/rtl8192u/r8192U_core.c | 482 ++--- 2 files changed, 16 insertions(+), 469 deletions(-) diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index eefc657..703c150 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -6,9 +6,6 @@ ccflags-y += -O2 ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO -#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE -#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT -ccflags-y += -DUSE_ONE_PIPE ccflags-y += -Idrivers/staging/rtl8192u/ieee80211 r8192u_usb-y := r8192U_core.o r8180_93cx6.o r8192U_wx.o\ diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 7640386..edd43e1 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -56,29 +56,6 @@ double __extendsfdf2(float a) } #endif -#undef LOOP_TEST -#undef DUMP_RX -#undef DUMP_TX -#undef DEBUG_TX_DESC2 -#undef RX_DONT_PASS_UL -#undef DEBUG_EPROM -#undef DEBUG_RX_VERBOSE -#undef DUMMY_RX -#undef DEBUG_ZERO_RX -#undef DEBUG_RX_SKB -#undef DEBUG_TX_FRAG -#undef DEBUG_RX_FRAG -#undef DEBUG_TX_FILLDESC -#undef DEBUG_TX -#undef DEBUG_IRQ -#undef DEBUG_RX -#undef DEBUG_RXALLOC -#undef DEBUG_REGISTERS -#undef DEBUG_RING -#undef DEBUG_IRQ_TASKLET -#undef DEBUG_TX_ALLOC -#undef DEBUG_TX_DESC - #define CONFIG_RTL8192_IO_MAP #include @@ -665,15 +642,6 @@ static void tx_timeout(struct net_device *dev) schedule_work(&priv->reset_wq); } - -/* this is only for debug */ -void dump_eprom(struct net_device *dev) -{ - int i; - for (i = 0; i < 63; i++) - RT_TRACE(COMP_EPROM, "EEPROM addr %x : %x", i, eprom_read(dev, i)); -} - void rtl8192_update_msr(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -711,13 +679,11 @@ void rtl8192_set_chan(struct net_device *dev, short ch) /* this hack should avoid frame TX during channel setting*/ -#ifndef LOOP_TEST //need to implement rf set channel here WB if (priv->rf_set_chan) priv->rf_set_chan(dev, priv->chan); mdelay(10); -#endif } static void rtl8192_rx_isr(struct urb *urb); @@ -725,14 +691,8 @@ static void rtl8192_rx_isr(struct urb *urb); static u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) { -#ifdef USB_RX_AGGREGATION_SUPPORT - if (pstats->bisrxaggrsubframe) - return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize - + pstats->RxBufShift + 8); - else -#endif - return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize - + pstats->RxBufShift); + return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize + + pstats->RxBufShift); } static int rtl8192_rx_initiate(struct net_device *dev) @@ -1043,197 +1003,8 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) return ret; } - void rtl8192_try_wake_queue(struct net_device *dev, int pri); -#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE -u16 DrvAggr_PaddingAdd(struct net_device *dev, struct sk_buff *skb) -{ - u16 PaddingNum = 256 - ((skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES) % 256); - return PaddingNum & 0xff; -} - -u8 MRateToHwRate8190Pci(u8 rate); -u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc); -u8 MapHwQueueToFirmwareQueue(u8 QueueID); -struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) -{ - struct ieee80211_device *ieee = netdev_priv(dev); - struct r8192_priv *priv = ieee80211_priv(dev); - cb_desc *tcb_desc = NULL; - u8 i; - u32 TotalLength; - struct sk_buff *skb; - struct sk_buff *agg_skb; - tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL; - tx_fwinfo_819x_usb *tx_fwinfo = NULL; - - // - // Local variable initialization. - // - /* first skb initialization */ - skb = pSendList->tx_agg_frames[0]; - TotalLength = skb->len; - - /* Get the total aggregation length including the padding space and -* sub frame header. -*/ - for (i = 1; i < pSendList->nr_drv_agg_frames; i++) { - TotalLength += DrvAggr_PaddingAdd(dev, skb); - skb = pSendList->tx_agg_frames[i]; - TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES); - } - - /* allocate skb to contain the aggregated packets */ - agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom); - memset(
RE: [PATCH v3] video: hyperv: hyperv_fb: refresh the VM screen by force on VM panic
> -Original Message- > From: Tomi Valkeinen [mailto:tomi.valkei...@ti.com] > Sent: Thursday, July 31, 2014 21:38 PM > > I think in hvfb_on_panic() we should be able to get the > > hvfb_info pointer by > > hvfb_info = container_of(nb, struct hv_fb_panic_nb, nb). > > > > If you like that or have a better idea, please let me know so > > I can make a new patch. > > Or maybe you can add the notifier_block and the synchronous_fb to > hvfb_par? From the notifier_block pointer you could then get hvfp_par, > and from there hvfb_info. > Tomi Hi Tomi, Thanks a lot for the suggestion! It's better. I'll send out a v4 patch for your review. Thanks, -- Dexuan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v4] video: hyperv: hyperv_fb: refresh the VM screen by force on VM panic
Currently the VSC has no chance to notify the VSP of the dirty rectangle on VM panic because the notification work is done in a workqueue, and in panic() the kernel typically ends up in an infinite loop, and a typical kernel config has CONFIG_PREEMPT_VOLUNTARY=y and CONFIG_PREEMPT is not set, so a context switch can't happen in panic() and the workqueue won't have a chance to run. As a result, the VM Connection window can't refresh until it's closed and we re-connect to the VM. We can register a handler on panic_notifier_list: the handler can notify the VSC and switch the framebuffer driver to a "synchronous mode", meaning the VSC flushes any future framebuffer change to the VSP immediately. v2: removed the MS-TFS line in the commit message v3: remove some 'unlikely' markings v4: avoid global variables as Tomi Valkeinen suggested Cc: Haiyang Zhang Signed-off-by: Dexuan Cui --- drivers/video/fbdev/hyperv_fb.c | 62 +++-- 1 file changed, 59 insertions(+), 3 deletions(-) diff --git a/drivers/video/fbdev/hyperv_fb.c b/drivers/video/fbdev/hyperv_fb.c index e23392e..569e756 100644 --- a/drivers/video/fbdev/hyperv_fb.c +++ b/drivers/video/fbdev/hyperv_fb.c @@ -224,6 +224,11 @@ struct hvfb_par { u32 pseudo_palette[16]; u8 init_buf[MAX_VMBUS_PKT_SIZE]; u8 recv_buf[MAX_VMBUS_PKT_SIZE]; + + /* If true, the VSC notifies the VSP on every framebuffer change */ + bool synchronous_fb; + + struct notifier_block hvfb_panic_nb; }; static uint screen_width = HVFB_WIDTH; @@ -532,6 +537,19 @@ static void hvfb_update_work(struct work_struct *w) schedule_delayed_work(&par->dwork, HVFB_UPDATE_DELAY); } +static int hvfb_on_panic(struct notifier_block *nb, +unsigned long e, void *p) +{ + struct hvfb_par *par; + struct fb_info *info; + + par = container_of(nb, struct hvfb_par, hvfb_panic_nb); + par->synchronous_fb = true; + info = par->info; + synthvid_update(info); + + return NOTIFY_DONE; +} /* Framebuffer operation handlers */ @@ -582,14 +600,44 @@ static int hvfb_blank(int blank, struct fb_info *info) return 1; /* get fb_blank to set the colormap to all black */ } +static void hvfb_cfb_fillrect(struct fb_info *p, + const struct fb_fillrect *rect) +{ + struct hvfb_par *par = p->par; + + cfb_fillrect(p, rect); + if (par->synchronous_fb) + synthvid_update(p); +} + +static void hvfb_cfb_copyarea(struct fb_info *p, + const struct fb_copyarea *area) +{ + struct hvfb_par *par = p->par; + + cfb_copyarea(p, area); + if (par->synchronous_fb) + synthvid_update(p); +} + +static void hvfb_cfb_imageblit(struct fb_info *p, + const struct fb_image *image) +{ + struct hvfb_par *par = p->par; + + cfb_imageblit(p, image); + if (par->synchronous_fb) + synthvid_update(p); +} + static struct fb_ops hvfb_ops = { .owner = THIS_MODULE, .fb_check_var = hvfb_check_var, .fb_set_par = hvfb_set_par, .fb_setcolreg = hvfb_setcolreg, - .fb_fillrect = cfb_fillrect, - .fb_copyarea = cfb_copyarea, - .fb_imageblit = cfb_imageblit, + .fb_fillrect = hvfb_cfb_fillrect, + .fb_copyarea = hvfb_cfb_copyarea, + .fb_imageblit = hvfb_cfb_imageblit, .fb_blank = hvfb_blank, }; @@ -801,6 +849,11 @@ static int hvfb_probe(struct hv_device *hdev, par->fb_ready = true; + par->synchronous_fb = false; + par->hvfb_panic_nb.notifier_call = hvfb_on_panic; + atomic_notifier_chain_register(&panic_notifier_list, + &par->hvfb_panic_nb); + return 0; error: @@ -820,6 +873,9 @@ static int hvfb_remove(struct hv_device *hdev) struct fb_info *info = hv_get_drvdata(hdev); struct hvfb_par *par = info->par; + atomic_notifier_chain_unregister(&panic_notifier_list, +&par->hvfb_panic_nb); + par->update = false; par->fb_ready = false; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723au: Fix static symbol sparse warning
Fix sparse warning: drivers/staging/rtl8723au/core/rtw_efuse.c:579:5: warning: symbol 'efuse_GetCurrentSize23a' was not declared. Should it be static? Signed-off-by: Miguel Oliveira --- drivers/staging/rtl8723au/include/rtw_efuse.h |1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/rtl8723au/include/rtw_efuse.h b/drivers/staging/rtl8723au/include/rtw_efuse.h index 07bdc34..304cc71 100644 --- a/drivers/staging/rtl8723au/include/rtw_efuse.h +++ b/drivers/staging/rtl8723au/include/rtw_efuse.h @@ -82,6 +82,7 @@ struct pg_pkt_struct { /*Export global variable*/ u16efuse_GetMaxSize23a(struct rtw_adapter *padapter); +intefuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size); intrtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 start_addr, u16 cnts, u8 *data); intrtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); u8 rtw_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data); -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8723au: Fix static symbol sparse warning
On Fri, 2014-08-01 at 14:06 +0100, Miguel Oliveira wrote: > Fix sparse warning: > drivers/staging/rtl8723au/core/rtw_efuse.c:579:5: warning: symbol > 'efuse_GetCurrentSize23a' was not declared. Should it be static? > > Signed-off-by: Miguel Oliveira > --- > drivers/staging/rtl8723au/include/rtw_efuse.h |1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/staging/rtl8723au/include/rtw_efuse.h > b/drivers/staging/rtl8723au/include/rtw_efuse.h > index 07bdc34..304cc71 100644 > --- a/drivers/staging/rtl8723au/include/rtw_efuse.h > +++ b/drivers/staging/rtl8723au/include/rtw_efuse.h > @@ -82,6 +82,7 @@ struct pg_pkt_struct { > /*Export global > variable*/ > > u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter); > +int efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size); > int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 > start_addr, u16 cnts, u8 *data); > int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, > u8 *data); > u8 rtw_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, > u8 *data); This function is never used in current linux-next. So I think it might as well be dropped. Note there's also Efuse_GetCurrentSize23a (with an uppercase 'E'). It's used just once. You could probably submit another patch to remove that from rtw_efuse.h and make it static in rtw_efuse.c The comment above that function needs and update too, but maybe it's also OK to drop that comment. Paul Bolle ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/2] staging: comedi: addi_apci_1564: provide interface to read diagnostic status
On 01/08/14 02:55, Chase Southwood wrote: This patchset creates a simple subdevice to allow for reading of the board's diagnostic status, and then removes any code which is related to diagnostic interrupts, as the driver will not support these at this time. Chase Southwood (2): staging: comedi: addi_apci_1564: add subdevice to check diagnostic status staging: comedi: addi_apci_1564: remove diagnostic interrupt support code .../comedi/drivers/addi-data/hwdrv_apci1564.c | 14 drivers/staging/comedi/drivers/addi_apci_1564.c| 41 -- 2 files changed, 22 insertions(+), 33 deletions(-) The Digital Output subdevice should behave more sanely now! Reviewed-by: Ian Abbott -- -=( Ian Abbott @ MEV Ltd.E-mail: )=- -=( Tel: +44 (0)161 477 1898 FAX: +44 (0)161 718 3587 )=- ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] HID: hyperv: register as a wakeup source
With this patch, we can move the mouse to wake up the VM after the VM executes "echo freeze > /sys/power/state". This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100 Cc: K. Y. Srinivasan Signed-off-by: Dexuan Cui --- drivers/hid/hid-hyperv.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index f52dbcb..31fad64 100644 --- a/drivers/hid/hid-hyperv.c +++ b/drivers/hid/hid-hyperv.c @@ -308,6 +308,9 @@ static void mousevsc_on_receive(struct hv_device *device, memcpy(input_dev->input_buf, input_report->buffer, len); hid_input_report(input_dev->hid_device, HID_INPUT_REPORT, input_dev->input_buf, len, 1); + + pm_wakeup_event(&input_dev->device->device, 0); + break; default: pr_err("unsupported hid msg type - type %d len %d", @@ -549,6 +552,8 @@ static int mousevsc_probe(struct hv_device *device, goto probe_err2; } + device_init_wakeup(&device->device, true); + input_dev->connected = true; input_dev->init_complete = true; @@ -571,6 +576,7 @@ static int mousevsc_remove(struct hv_device *dev) { struct mousevsc_dev *input_dev = hv_get_drvdata(dev); + device_init_wakeup(&dev->device, false); vmbus_close(dev->channel); hid_hw_stop(input_dev->hid_device); hid_destroy_device(input_dev->hid_device); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Input: hyperv-keyboard: register as a wakeup source
With this patch, we can press a key to wake up the VM after the VM executes "echo freeze > /sys/power/state". This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100 Cc: K. Y. Srinivasan Signed-off-by: Dexuan Cui --- drivers/input/serio/hyperv-keyboard.c | 13 + 1 file changed, 13 insertions(+) diff --git a/drivers/input/serio/hyperv-keyboard.c b/drivers/input/serio/hyperv-keyboard.c index 6132619..e74e5d6 100644 --- a/drivers/input/serio/hyperv-keyboard.c +++ b/drivers/input/serio/hyperv-keyboard.c @@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device *hv_dev, serio_interrupt(kbd_dev->hv_serio, scan_code, 0); } spin_unlock_irqrestore(&kbd_dev->lock, flags); + + /* +* Only trigger a wakeup on key down, otherwise +* "echo freeze > /sys/power/state" can't really enter the +* state because the Enter-UP can trigger a wakeup at once. +*/ + if (!(info & IS_BREAK)) + pm_wakeup_event(&hv_dev->device, 0); + break; default: @@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev, goto err_close_vmbus; serio_register_port(kbd_dev->hv_serio); + + device_init_wakeup(&hv_dev->device, true); + return 0; err_close_vmbus: @@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev) { struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev); + device_init_wakeup(&hv_dev->device, false); serio_unregister_port(kbd_dev->hv_serio); vmbus_close(hv_dev->channel); kfree(kbd_dev); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: rtl8723au: Fix static symbol sparse warning
On 08/01/2014 08:06 AM, Miguel Oliveira wrote: > Fix sparse warning: > drivers/staging/rtl8723au/core/rtw_efuse.c:579:5: warning: symbol > 'efuse_GetCurrentSize23a' was not declared. Should it be static? > > Signed-off-by: Miguel Oliveira > --- > drivers/staging/rtl8723au/include/rtw_efuse.h |1 + > 1 file changed, 1 insertion(+) > > diff --git a/drivers/staging/rtl8723au/include/rtw_efuse.h > b/drivers/staging/rtl8723au/include/rtw_efuse.h > index 07bdc34..304cc71 100644 > --- a/drivers/staging/rtl8723au/include/rtw_efuse.h > +++ b/drivers/staging/rtl8723au/include/rtw_efuse.h > @@ -82,6 +82,7 @@ struct pg_pkt_struct { > /*Export global > variable*/ > > u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter); > +int efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size); > int rtw_efuse_access23a(struct rtw_adapter *padapter, u8 bRead, u16 > start_addr, u16 cnts, u8 *data); > int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, > u8 *data); > u8 rtw_efuse_map_write(struct rtw_adapter *padapter, u16 addr, u16 cnts, > u8 *data); NACK. Whenever Sparse issues this warning, you should first check to see if it can be made static. Adding it to a header to make the Sparse warning go away is not correct unless some other routine needs it to be globally known. In this case, no other routine needs it. Of course, making it static will lead to the compilation warning that the routine is not used. The correct patch is to delete the entire routine as it is never called. Larry ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723au: Fix static symbol sparse warning
Fix sparse warning: drivers/staging/rtl8723au/core/rtw_efuse.c:579:5: warning: symbol 'efuse_GetCurrentSize23a' was not declared. Should it be static? by removing efuse_GetCurrentSize23a since its never used Signed-off-by: Miguel Oliveira --- drivers/staging/rtl8723au/core/rtw_efuse.c | 25 - 1 file changed, 25 deletions(-) diff --git a/drivers/staging/rtl8723au/core/rtw_efuse.c b/drivers/staging/rtl8723au/core/rtw_efuse.c index 345bff8..fe092c5 100644 --- a/drivers/staging/rtl8723au/core/rtw_efuse.c +++ b/drivers/staging/rtl8723au/core/rtw_efuse.c @@ -100,22 +100,6 @@ static void Efuse_PowerSwitch(struct rtw_adapter *padapter, } } -/*- - * Function: efuse_GetCurrentSize23a - * - * Overview: Get current efuse size!!! - * - * Input: NONE - * - * Output: NONE - * - * Return: NONE - * - * Revised History: - * WhenWho Remark - * 11/16/2008 MHC Create Version 0. - * - *---*/ u16 Efuse_GetCurrentSize23a(struct rtw_adapter *pAdapter, u8 efuseType) { @@ -576,15 +560,6 @@ u16 efuse_GetMaxSize23a(struct rtw_adapter *padapter) return max_size; } /* */ -int efuse_GetCurrentSize23a(struct rtw_adapter *padapter, u16 *size) -{ - Efuse_PowerSwitch(padapter, false, true); - *size = Efuse_GetCurrentSize23a(padapter, EFUSE_WIFI); - Efuse_PowerSwitch(padapter, false, false); - - return _SUCCESS; -} -/* */ int rtw_efuse_map_read23a(struct rtw_adapter *padapter, u16 addr, u16 cnts, u8 *data) { -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: rtl8192u: remove unselectable options DEBUG_*, USE_ONE_PIPE, USB_RX_AGGREGATION_SUPPORT, USB_TX_DRIVER_AGGREGATION_ENABLE
On Tue, Jun 24, 2014 at 03:52:05PM +0200, Antoine Schweitzer-Chaput wrote: > The code which was only reachable using these options is also removed. > > Signed-off-by: Antoine Schweitzer-Chaput > --- > drivers/staging/rtl8192u/Makefile | 3 - > drivers/staging/rtl8192u/r8192U_core.c | 482 > ++--- > 2 files changed, 16 insertions(+), 469 deletions(-) > > diff --git a/drivers/staging/rtl8192u/Makefile > b/drivers/staging/rtl8192u/Makefile > index eefc657..703c150 100644 > --- a/drivers/staging/rtl8192u/Makefile > +++ b/drivers/staging/rtl8192u/Makefile > @@ -6,9 +6,6 @@ ccflags-y += -O2 > ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y > ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX > ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO > -#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE > -#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT > -ccflags-y += -DUSE_ONE_PIPE Why delete this last one if it is being set? Did you test this change on hardware? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] Input: hyperv-keyboard: register as a wakeup source
> -Original Message- > From: Dexuan Cui [mailto:de...@microsoft.com] > Sent: Friday, August 1, 2014 7:28 AM > To: gre...@linuxfoundation.org; dmitry.torok...@gmail.com; linux- > in...@vger.kernel.org; linux-ker...@vger.kernel.org; driverdev- > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com > Cc: KY Srinivasan; Haiyang Zhang > Subject: [PATCH] Input: hyperv-keyboard: register as a wakeup source > > With this patch, we can press a key to wake up the VM after the VM > executes "echo freeze > /sys/power/state". > > This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100 > > Cc: K. Y. Srinivasan Thanks Dexuan. Signed-off-by: K. Y. Srinivasan > Signed-off-by: Dexuan Cui > --- > drivers/input/serio/hyperv-keyboard.c | 13 + > 1 file changed, 13 insertions(+) > > diff --git a/drivers/input/serio/hyperv-keyboard.c > b/drivers/input/serio/hyperv-keyboard.c > index 6132619..e74e5d6 100644 > --- a/drivers/input/serio/hyperv-keyboard.c > +++ b/drivers/input/serio/hyperv-keyboard.c > @@ -170,6 +170,15 @@ static void hv_kbd_on_receive(struct hv_device > *hv_dev, > serio_interrupt(kbd_dev->hv_serio, scan_code, 0); > } > spin_unlock_irqrestore(&kbd_dev->lock, flags); > + > + /* > + * Only trigger a wakeup on key down, otherwise > + * "echo freeze > /sys/power/state" can't really enter the > + * state because the Enter-UP can trigger a wakeup at once. > + */ > + if (!(info & IS_BREAK)) > + pm_wakeup_event(&hv_dev->device, 0); > + > break; > > default: > @@ -376,6 +385,9 @@ static int hv_kbd_probe(struct hv_device *hv_dev, > goto err_close_vmbus; > > serio_register_port(kbd_dev->hv_serio); > + > + device_init_wakeup(&hv_dev->device, true); > + > return 0; > > err_close_vmbus: > @@ -390,6 +402,7 @@ static int hv_kbd_remove(struct hv_device *hv_dev) > { > struct hv_kbd_dev *kbd_dev = hv_get_drvdata(hv_dev); > > + device_init_wakeup(&hv_dev->device, false); > serio_unregister_port(kbd_dev->hv_serio); > vmbus_close(hv_dev->channel); > kfree(kbd_dev); > -- > 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH] HID: hyperv: register as a wakeup source
> -Original Message- > From: Dexuan Cui [mailto:de...@microsoft.com] > Sent: Friday, August 1, 2014 7:27 AM > To: gre...@linuxfoundation.org; jkos...@suse.cz; linux- > in...@vger.kernel.org; linux-ker...@vger.kernel.org; driverdev- > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com > Cc: KY Srinivasan; Haiyang Zhang > Subject: [PATCH] HID: hyperv: register as a wakeup source > > With this patch, we can move the mouse to wake up the VM after the VM > executes "echo freeze > /sys/power/state". > > This addresses part of https://bugzilla.redhat.com/show_bug.cgi?id=1086100 > > Cc: K. Y. Srinivasan > Signed-off-by: Dexuan Cui Signed-off-by: K. Y. Srinivasan > --- > drivers/hid/hid-hyperv.c | 6 ++ > 1 file changed, 6 insertions(+) > > diff --git a/drivers/hid/hid-hyperv.c b/drivers/hid/hid-hyperv.c index > f52dbcb..31fad64 100644 > --- a/drivers/hid/hid-hyperv.c > +++ b/drivers/hid/hid-hyperv.c > @@ -308,6 +308,9 @@ static void mousevsc_on_receive(struct hv_device > *device, > memcpy(input_dev->input_buf, input_report->buffer, len); > hid_input_report(input_dev->hid_device, > HID_INPUT_REPORT, >input_dev->input_buf, len, 1); > + > + pm_wakeup_event(&input_dev->device->device, 0); > + > break; > default: > pr_err("unsupported hid msg type - type %d len %d", @@ - > 549,6 +552,8 @@ static int mousevsc_probe(struct hv_device *device, > goto probe_err2; > } > > + device_init_wakeup(&device->device, true); > + > input_dev->connected = true; > input_dev->init_complete = true; > > @@ -571,6 +576,7 @@ static int mousevsc_remove(struct hv_device *dev) { > struct mousevsc_dev *input_dev = hv_get_drvdata(dev); > > + device_init_wakeup(&dev->device, false); > vmbus_close(dev->channel); > hid_hw_stop(input_dev->hid_device); > hid_destroy_device(input_dev->hid_device); > -- > 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: rtl8192u: remove unselectable options DEBUG_*, USE_ONE_PIPE, USB_RX_AGGREGATION_SUPPORT, USB_TX_DRIVER_AGGREGATION_ENABLE
On Fri, Aug 01, 2014 at 08:54:07AM -0700, Greg KH wrote: > On Tue, Jun 24, 2014 at 03:52:05PM +0200, Antoine Schweitzer-Chaput wrote: > > The code which was only reachable using these options is also removed. > > > > Signed-off-by: Antoine Schweitzer-Chaput > > --- > > drivers/staging/rtl8192u/Makefile | 3 - > > drivers/staging/rtl8192u/r8192U_core.c | 482 > > ++--- > > 2 files changed, 16 insertions(+), 469 deletions(-) > > > > diff --git a/drivers/staging/rtl8192u/Makefile > > b/drivers/staging/rtl8192u/Makefile > > index eefc657..703c150 100644 > > --- a/drivers/staging/rtl8192u/Makefile > > +++ b/drivers/staging/rtl8192u/Makefile > > @@ -6,9 +6,6 @@ ccflags-y += -O2 > > ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y > > ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX > > ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO > > -#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE > > -#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT > > -ccflags-y += -DUSE_ONE_PIPE > > Why delete this last one if it is being set? Since it is always set, and not modifiable anywhere, it allows removing the code in r8192U_core.c under #ifndef USE_ONE_PIPE > Did you test this change on hardware? No, I didn't have the chance. I however compared the generated code after preprocessing (using gcc -E -P) with and without this change, and the only differences are the 3 removed functions (dump_eprom, txqueue2outpipe, and GetRxPacketShiftBytes819xUsb). Antoine ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/1] Drivers: net-next: hyperv: Increase the size of the sendbuf region
> -Original Message- > From: David Miller [mailto:da...@davemloft.net] > Sent: Thursday, July 31, 2014 9:59 PM > To: KY Srinivasan > Cc: net...@vger.kernel.org; linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; o...@aepfle.de; a...@canonical.com; > jasow...@redhat.com > Subject: Re: [PATCH 1/1] Drivers: net-next: hyperv: Increase the size of the > sendbuf region > > From: "K. Y. Srinivasan" > Date: Wed, 30 Jul 2014 18:35:49 -0700 > > > For forwarding scenarios, it will be useful to allocate larger > > sendbuf. Make the necessary adjustments to permit this. > > > > Signed-off-by: K. Y. Srinivasan > > This needs more information. > > You're increasing the size by 16 times, 1MB --> 16MB, thus less cache > locality. > > You're also now using vmalloc() memory, thus more TLB misses and > thrashing. > > This must have a negative impact on performance, and you have to test for > that and quantify it when making a change as serious as this one. > > You also haven't gone into detail as to why forwarding scenerios require > more buffer space, than say thousands of local sockets sending bulk TCP > data. David, Intel did some benchmarking on our network throughput when Linux on Hyper-V was used as a gateway. This fix gave us almost a 1 Gbps additional throughput on about 5Gbps base throughput we had prior to Increasing the sendbuf size. The sendbuf mechanism is a copy based transport that we have which is clearly more optimal than the copy-free page flipping mechanism (for small packets). In the forwarding scenario, we deal only with MTU sized packets, and increasing the size of the senbuf area gave us the additional performance. For what it is worth, Windows guests on Hyper-V, I am told use similar sendbuf size as well. The exact value of sendbuf I think is less important than the fact that it needs to be larger than what Linux can allocate as physically contiguous memory. Thus the change over to allocating via vmalloc(). As you know we currently allocate 16MB receive buffer and we use vmalloc there for allocation. Also the low level channel code has already been modified to deal with physically dis-contiguous memory in the ringbuffer setup. Again based on experimentation Intel did, they say there was some improvement in throughput as the sendbuf size was Increased up to 16MB and there was no effect on throughput beyond 16MB. Thus I chose 16MB here. Increasing the sendbuf value makes a material difference in small packet handling. Let me know what I should do to make this patch acceptable. Regards, K. Y > > I'm not applying this, it needs a lot more work. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v5 3/4] Staging: rts5208: Use dev_dbg and %*ph specifierto dump memory
On Wed, Jul 30, 2014 at 09:52:35AM +0800, micky wrote: > Documentation/printk-formats.txt > > Raw buffer as a hex string: > %*ph00 01 02 ... 3f > %*phC 00:01:02: ... :3f > %*phD 00-01-02- ... -3f > %*phN 000102 ... 3f > > For printing a small buffers (up to 64 bytes long) as a hex string with > certain separator. For the larger buffers consider to use > print_hex_dump(). > > > Since we can't make sure the cnt value, it is not good use "%*ph", > because it must make cnt <= 64. > dw_len * 4 <= 64 ? Hi Micky, I think that in these two cases we can rely on print_hex_dump_bytes that doesn't have the dev_dbg limit on buffer size. Let me know what you think about it. If you agree, I can send a new version for patches 3/4 and 4/4, since the first two have already been merged in the linux-next tree by Greg. Regards, Fabio ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] staging: rtl8192u: remove unselectable options DEBUG_*, USE_ONE_PIPE, USB_RX_AGGREGATION_SUPPORT, USB_TX_DRIVER_AGGREGATION_ENABLE
On Fri, Aug 01, 2014 at 07:31:10PM +0200, Antoine Schweitzer-Chaput wrote: > On Fri, Aug 01, 2014 at 08:54:07AM -0700, Greg KH wrote: > > On Tue, Jun 24, 2014 at 03:52:05PM +0200, Antoine Schweitzer-Chaput wrote: > > > The code which was only reachable using these options is also removed. > > > > > > Signed-off-by: Antoine Schweitzer-Chaput > > > --- > > > drivers/staging/rtl8192u/Makefile | 3 - > > > drivers/staging/rtl8192u/r8192U_core.c | 482 > > > ++--- > > > 2 files changed, 16 insertions(+), 469 deletions(-) > > > > > > diff --git a/drivers/staging/rtl8192u/Makefile > > > b/drivers/staging/rtl8192u/Makefile > > > index eefc657..703c150 100644 > > > --- a/drivers/staging/rtl8192u/Makefile > > > +++ b/drivers/staging/rtl8192u/Makefile > > > @@ -6,9 +6,6 @@ ccflags-y += -O2 > > > ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y > > > ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX > > > ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO > > > -#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE > > > -#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT > > > -ccflags-y += -DUSE_ONE_PIPE > > > > Why delete this last one if it is being set? > > Since it is always set, and not modifiable anywhere, it allows removing > the code in r8192U_core.c under #ifndef USE_ONE_PIPE Ah, I missed it was ifndef, sorry about that. Actually that points out that this should be broken up into smaller patches to make it easier to review, as I sure got that wrong. Can you do it one-patch-per-define you are removing? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] Drivers: scsi: storvsc: Add blist flags
On Thu, Jul 24, 2014 at 07:40:36AM +0200, Hannes Reinecke wrote: > On 07/22/2014 01:06 AM, K. Y. Srinivasan wrote: > >Add blist flags to permit the reading of the VPD pages even when > >the target may claim SPC-2 compliance. MSFT targets currently > >claim SPC-2 compliance while they implement post SPC-2 features. > >With this patch we can correctly handle WRITE_SAME_16 issues. > > > >Signed-off-by: K. Y. Srinivasan > > > Reviewed-by: Hannes Reinecke On Wed, Jul 23, 2014 at 09:13:41PM +0100, Sitsofe Wheeler wrote: > On Wed, Jul 23, 2014 at 07:15:58AM -0700, Christoph Hellwig wrote: > > On Wed, Jul 23, 2014 at 03:10:28PM +0100, Sitsofe Wheeler wrote: > > > I'm not sure this alone will work - won't sdev_bflags/bflags have > > > already been built at this point? > > > > They've been built up, but we can still or new values into it. It looks > > fine to me from review, but if you can test it on an actualy hypverv > > setup that would be valueable feedback. > > The previous patches didn't work for me with a Windows 2012 R2 host with a > 3.16.0-rc6.x86_64-00076-g2f7d2ec-dirty guest. After applying > https://patchwork.kernel.org/patch/4541201 (which needed a small fixup) and > https://patchwork.kernel.org/patch/4598601 and the attached debugging output I've tested f3cfabce7a2e92564d380de3aad4b43901fb7ae6 (Drivers: add blist flags) from the drivers-for-3.17 branch of scsi-queue (http://git.infradead.org/users/hch/scsi-queue.git/commit/f3cfabce7a2e92564d380de3aad4b43901fb7ae6 ) and this patch still doesn't appear to work (thin provisioning on Hyper-V's Virtual Disks is not enabled): # sg_inq /dev/sda standard INQUIRY: PQual=0 Device_type=0 RMB=0 version=0x04 [SPC-2] [AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=2 SCCS=0 ACC=0 TPGS=0 3PC=0 Protect=0 [BQue=0] EncServ=0 MultiP=0 [MChngr=0] [ACKREQQ=0] Addr16=0 [RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=1 length=36 (0x24) Peripheral device type: disk Vendor identification: Msft Product identification: Virtual Disk Product revision level: 1.0 # sg_vpd -p lbpv /dev/sda Logical block provisioning VPD page (SBC): Unmap command supported (LBPU): 1 Write same (16) with unmap bit supported (LBWS): 0 Write same (10) with unmap bit supported (LBWS10): 0 Logical block provisioning read zeros (LBPRZ): 0 Anchored LBAs supported (ANC_SUP): 0 Threshold exponent: 1 Descriptor present (DP): 0 Provisioning type: 2 grep . /sys/block/sd*/device/scsi_disk/*/{thin,prov,rotat,device/model}* | sort /sys/block/sda/device/scsi_disk/0:0:0:0/device/model:Virtual Disk /sys/block/sda/device/scsi_disk/0:0:0:0/provisioning_mode:full /sys/block/sda/device/scsi_disk/0:0:0:0/thin_provisioning:0 /sys/block/sdb/device/scsi_disk/1:0:0:0/device/model:Virtual Disk /sys/block/sdb/device/scsi_disk/1:0:0:0/provisioning_mode:full /sys/block/sdb/device/scsi_disk/1:0:0:0/thin_provisioning:0 /sys/block/sdc/device/scsi_disk/1:0:0:2/device/model:00AAKS-00TMA0 /sys/block/sdc/device/scsi_disk/1:0:0:2/provisioning_mode:full /sys/block/sdc/device/scsi_disk/1:0:0:2/thin_provisioning:0 /sys/block/sdd/device/scsi_disk/1:0:0:1/device/model:SSD S510 120GB /sys/block/sdd/device/scsi_disk/1:0:0:1/provisioning_mode:full /sys/block/sdd/device/scsi_disk/1:0:0:1/thin_provisioning:0 /sys/block/sde/device/scsi_disk/1:0:0:3/device/model:Virtual Disk /sys/block/sde/device/scsi_disk/1:0:0:3/provisioning_mode:full /sys/block/sde/device/scsi_disk/1:0:0:3/thin_provisioning:0 /sys/block/sdf/device/scsi_disk/1:0:0:4/device/model:ST1000DM003-9YN1 /sys/block/sdf/device/scsi_disk/1:0:0:4/provisioning_mode:full /sys/block/sdf/device/scsi_disk/1:0:0:4/thin_provisioning:0 At least the virtual disks should have thin_provisioning... I was also expecting the passthrough SSD to be reported as non-rotational with this patch: # sg_inq /dev/sdd standard INQUIRY: PQual=0 Device_type=0 RMB=0 version=0x00 [no conformance claimed] [AERC=0] [TrmTsk=0] NormACA=0 HiSUP=0 Resp_data_format=2 SCCS=0 ACC=0 TPGS=0 3PC=0 Protect=0 [BQue=0] EncServ=0 MultiP=0 [MChngr=0] [ACKREQQ=0] Addr16=0 [RelAdr=0] WBus16=0 Sync=0 Linked=0 [TranDis=0] CmdQue=1 [SPI: Clocking=0x0 QAS=0 IUS=0] length=60 (0x3c) Peripheral device type: disk Vendor identification: ADATA Product identification: SSD S510 120GB Product revision level: 5.2. Unit serial number: 0320511550032076 # sg_vpd -p bdc /dev/sdd Block device characteristics VPD page (SBC): Non-rotating medium (e.g. solid state) Product type: Not specified WABEREQ=0 WACEREQ=0 Nominal form factor not reported FUAB=0 VBULS=0 # grep -H . /sys/block/sdd/queue/rot* /sys/block/sdd/queue/rotational:1 -- Sitsofe | http://sucs.org/~sits/ ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
READ CAREFULLY AND GET BACK TO US.
GREAT BRITIAN! OFFICE OF THE PERMANENT SECRETARY FOR NON RESIDENTIAL TAXATION ON INTERNATIONAL LOTTERY AWARD OF THE BRITISH MINISTRY OF FINANCE LONDON UNITED KINGDOM ADDRESS, FINANCE HOUSE KING CHARLES STREET, LONDON,SW1A EMAIL: thefinancenottification.b...@live.co.uk Tel: + 447014229459 OUR REF: BMF/UKG/VOL/0940/012 OUR REF: BMF/UKG/VOL/0946/013 FROM THE DESK OF THE PERMANENT SECRETARY FOR NON RESIDENTIAL TAXATION ON INTERNATIONAL LOTTERY AWARD THE GOVERNMENT VISION FOR UK FOREIGN POLICY. OUR PRIORITIES ADMITTED: Dear Beneficary, We the Board of Directors, Members and Committee of the British Ministry of Finance are now aware of your winning prize. We write to remind you that we received a report from the BANK OF ENGLAND that you could not get your winning prize sum of Ј1,000,000.00 GBP right in your country, due to your country country government strict rules and laws at the Airport and also in the banking system which prompt the BANK of ENGLAND to call back the delivery agent as well as your awarded prize to UK. As per UK government rule. From the report they gave to us and after our investigations,we confirmed that you are the true beneficary of the money.We have also confirmed that until this moment that you have not received your Winning prize money from the awarded company in United Kingdom. After our numerous verifications we found out that you could not get your winning amount due to your low co-operation to the Government Airport Authority as well as the banking system. Also due to terrorism problems going on around globaly. In regards to the above mentioned problems, we the BRITISH MINISTRY OF FINANCE have decided to release your winning amount via cheque or demand draft that will be deposited to your personal bank account without any delay by the Royal Bank of Scotland LISTEN VERY ATTENTIVELY TO ENABLE YOU RECEIVE YOUR WINNING PRIZE! By the power and authority bestowed on us we have conveyed your transaction to trusted Bank which will transfer your winning prize; You are to contact the bank with your personal details/ Your personal infomations for them to move your winning amount directly to your bank account without any further delay. For security reasons Cheque sum of Ј1,000,000.00 GBP has been issued on your behalf from the ROYAL BANK OF SCOTLAND and it will be sent to the British High Commission in your country immediately you fill the below required details for reconfirmation and reverification You are requested to contact Dr. Evans Toon. With your original data for the claim of your compensation prize Cheque. And your bank details, is also very important to deposit your Cheque to any branch of your local bank. DETAILS OF WHOM YOU SHOULD CONTACT IMMEDIATELY Bank Name, (Royal Bank of Scotland (RBS)United Kingdom) Contact Person: ( Dr. Evans Toon), Director Foreign Transfer Department, Bank Email ID: foreigntransferdept@admin.in.th Bank Phone Number: +448 7197 42195 Below is the information you are required to fill and forward to the ROYAL BANK OF SCOTLAND and make sure you fill this form before forwarding it do not send this form to them without filling it, do this immediately. CLAIM FORM: Your Full Name.. Home Address. State . YourDirect Mobile Phone Telephone or second mobile no…… Occupation…. Sex... Next of Kin Date of Birth Your Email ID:……. Bank Account Holders name Bank Name. Bank Account No... Bank Swift Code... Scan copy of your ID card or Driving License/Photo: ID card – SERVICE ID CARD…. We guarantee your transaction with the ROYAL BANK OF SCOTLAND Follow our instructions; you will not have any problem. . NOTE: You will send a copy of this letter back to us after you have filled in the requirement via this E-mail: thefinancenottification.b...@live.co.uk forward a copy to Dr. Evans Toon through their E-mal:- foreigntransferdept@admin.in.th ACCEPT OUR WORM REGARDS SIGNED, Mr. George Pirintzi Permanent Secretary to the Ministry THE BRITISH MINISTRY OF FINANCE KING CHARLES STREET LONDON, SW1A. Copyright ©2014 British Ministry of Finance, All rights reserved. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: comedi: comedi_pci: enhance comedi_pci_disable()
This function can be used by comedi pci drivers for the driver (*detach) callback when all that is required is to release the regions and disable the PCI device. Enhance this function to work like comedi_legacy_detach(). * Rename the function to comedi_pci_detach(). * free the irq if it has been requested * iounmap the 'mmio' address if it has been ioremap'ed Remove all the free_irq() and iounmap() code in the drivers. If the drivers (*detach) function is then a stub, use comedi_pci_detach() directly for the (*detach). The amplc_dio200 drivers required a bit of additional work. Currently, amplc_dio200_common_detach() was used to do the free_irq() because the PCI driver needed it. Since the ISA driver also called this function, the dev->irq is set to 0 to prevent comedi_legacy_detach() from doing the free_irq() again. Now that the PCI drivers will automatically do the free_irq(), both the ISA driver and PCI driver can use the core provided functions directly for the (*detach). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/comedi_pci.c| 22 -- drivers/staging/comedi/comedidev.h | 4 ++-- drivers/staging/comedi/drivers/8255_pci.c | 9 + .../staging/comedi/drivers/addi-data/addi_common.c | 4 +--- drivers/staging/comedi/drivers/addi_apci_1032.c| 4 +--- drivers/staging/comedi/drivers/addi_apci_1516.c| 2 +- drivers/staging/comedi/drivers/addi_apci_1564.c| 4 +--- drivers/staging/comedi/drivers/addi_apci_16xx.c| 2 +- drivers/staging/comedi/drivers/addi_apci_2032.c| 4 +--- drivers/staging/comedi/drivers/addi_apci_2200.c| 2 +- drivers/staging/comedi/drivers/addi_apci_3120.c| 4 +--- drivers/staging/comedi/drivers/addi_apci_3501.c| 4 +--- drivers/staging/comedi/drivers/addi_apci_3xxx.c| 6 +- drivers/staging/comedi/drivers/adl_pci6208.c | 2 +- drivers/staging/comedi/drivers/adl_pci7x3x.c | 2 +- drivers/staging/comedi/drivers/adl_pci8164.c | 2 +- drivers/staging/comedi/drivers/adl_pci9111.c | 4 +--- drivers/staging/comedi/drivers/adl_pci9118.c | 4 +--- drivers/staging/comedi/drivers/adv_pci1710.c | 4 +--- drivers/staging/comedi/drivers/adv_pci1723.c | 2 +- drivers/staging/comedi/drivers/adv_pci1724.c | 2 +- drivers/staging/comedi/drivers/adv_pci_dio.c | 2 +- drivers/staging/comedi/drivers/amplc_dio200.c | 8 +--- drivers/staging/comedi/drivers/amplc_dio200.h | 2 -- .../staging/comedi/drivers/amplc_dio200_common.c | 9 - drivers/staging/comedi/drivers/amplc_dio200_pci.c | 10 +- drivers/staging/comedi/drivers/amplc_pci224.c | 4 +--- drivers/staging/comedi/drivers/amplc_pci230.c | 4 +--- drivers/staging/comedi/drivers/amplc_pci236.c | 9 + drivers/staging/comedi/drivers/amplc_pci263.c | 2 +- drivers/staging/comedi/drivers/cb_pcidas.c | 13 - drivers/staging/comedi/drivers/cb_pcidas64.c | 6 +- drivers/staging/comedi/drivers/cb_pcidda.c | 2 +- drivers/staging/comedi/drivers/cb_pcimdas.c| 9 + drivers/staging/comedi/drivers/cb_pcimdda.c| 2 +- drivers/staging/comedi/drivers/contec_pci_dio.c| 2 +- drivers/staging/comedi/drivers/daqboard2000.c | 12 +++- drivers/staging/comedi/drivers/das08_pci.c | 2 +- drivers/staging/comedi/drivers/dt3000.c| 11 +-- drivers/staging/comedi/drivers/dyna_pci10xx.c | 2 +- drivers/staging/comedi/drivers/gsc_hpdi.c | 6 +- drivers/staging/comedi/drivers/icp_multi.c | 11 +++ drivers/staging/comedi/drivers/jr3_pci.c | 2 +- drivers/staging/comedi/drivers/ke_counter.c| 2 +- drivers/staging/comedi/drivers/me4000.c| 4 +--- drivers/staging/comedi/drivers/me_daq.c| 6 ++ drivers/staging/comedi/drivers/mf6x4.c | 4 +--- drivers/staging/comedi/drivers/ni_6527.c | 6 +- drivers/staging/comedi/drivers/ni_65xx.c | 8 ++-- drivers/staging/comedi/drivers/ni_660x.c | 6 +- drivers/staging/comedi/drivers/ni_670x.c | 4 +--- drivers/staging/comedi/drivers/ni_labpc_pci.c | 11 +-- drivers/staging/comedi/drivers/ni_pcidio.c | 6 +- drivers/staging/comedi/drivers/ni_pcimio.c | 6 +- drivers/staging/comedi/drivers/rtd520.c| 5 + drivers/staging/comedi/drivers/s626.c | 7 +-- drivers/staging/comedi/drivers/skel.c | 2 +- 57 files changed, 80 insertions(+), 220 deletions(-) diff --git a/drivers/staging/comedi/comedi_pci.c b/drivers/staging/comedi/comedi_pci.c index abbc0e4..e594d76 100644 --- a/drivers/staging/comedi/comedi_pci.c +++ b/drivers/staging/comedi/comedi_pci.c @@ -17,6 +17,7 @@ */ #include +#include #inc
[PATCH 00/13] staging: comedi: amplc_dio200: additional cleanup
Remove some cruft leftover from when this driver was a single module that include support for both the ISA and PCI boards. Do a bit of additional cleanup. H Hartley Sweeten (13): staging: comedi: amplc_dio200: remove private data staging: comedi: amplc_dio200: remove 'bustype' from boardinfo staging: comedi: amplc_dio200: remove 'mainsize' from ISA boardinfo staging: comedi: amplc_dio200_pci: remove 'mainsize' from PCI boardinfo staging: comedi: amplc_dio200.h: remove 'mainsize' from boardinfo staging: comedi: amplc_dio200: remove unnecessary local variable staging: comedi: amplc_dio200: tidy up comedi_driver declaration staging: comedi: amplc_dio200: tidy up {comedi,pci}_driver declarations staging: comedi: amplc_dio200.h: remove struct dio200_layout definition staging: comedi: amplc_dio200.h: remove unnecessary function comment descriptions staging: comedi: amplc_dio200.h: rename 'has_enhancements' in boardinfo staging: comedi: amplc_dio200.h: remove boardinfo 'mainshift' staging: comedi: amplc_dio200: absorb dio200_subdev_timer_init() drivers/staging/comedi/drivers/amplc_dio200.c | 115 +++ drivers/staging/comedi/drivers/amplc_dio200.h | 32 +- .../staging/comedi/drivers/amplc_dio200_common.c | 370 +++-- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 159 - 4 files changed, 233 insertions(+), 443 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 04/13] staging: comedi: amplc_dio200_pci: remove 'mainsize' from PCI boardinfo
The 'mainsize' member in the boardinfo for the DIO200 PCI boards is only used for a sanity check of the pci_resource_len(). This sanity check is not needed. Remove the sanity check along with the 'mainsize' values in the boardinfo. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.h | 4 drivers/staging/comedi/drivers/amplc_dio200_pci.c | 9 - 2 files changed, 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index dec7d6e..13e18e1 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -23,10 +23,6 @@ #ifndef AMPLC_DIO200_H_INCLUDED #define AMPLC_DIO200_H_INCLUDED -/* 200 series register area sizes */ -#define DIO200_IO_SIZE 0x20 -#define DIO200_PCIE_IO_SIZE0x4000 - /* * Subdevice types. */ diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index 9e7bc00..52e5acf 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -244,7 +244,6 @@ static const struct dio200_board dio200_pci_boards[] = { [pci215_model] = { .name = "pci215", .mainbar = 2, - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 5, .sdtype = {sd_8255, sd_8255, sd_8254, sd_8254, sd_intr}, @@ -256,7 +255,6 @@ static const struct dio200_board dio200_pci_boards[] = { [pci272_model] = { .name = "pci272", .mainbar = 2, - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 4, .sdtype = {sd_8255, sd_8255, sd_8255, sd_intr}, @@ -268,7 +266,6 @@ static const struct dio200_board dio200_pci_boards[] = { .name = "pcie215", .mainbar = 1, .mainshift = 3, - .mainsize = DIO200_PCIE_IO_SIZE, .layout = { .n_subdevs = 8, .sdtype = {sd_8255, sd_none, sd_8255, sd_none, @@ -284,7 +281,6 @@ static const struct dio200_board dio200_pci_boards[] = { .name = "pcie236", .mainbar = 1, .mainshift = 3, - .mainsize = DIO200_PCIE_IO_SIZE, .layout = { .n_subdevs = 8, .sdtype = {sd_8255, sd_none, sd_none, sd_none, @@ -300,7 +296,6 @@ static const struct dio200_board dio200_pci_boards[] = { .name = "pcie296", .mainbar = 1, .mainshift = 3, - .mainsize = DIO200_PCIE_IO_SIZE, .layout = { .n_subdevs = 8, .sdtype = {sd_8255, sd_8255, sd_8255, sd_8255, @@ -372,10 +367,6 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, return ret; bar = thisboard->mainbar; - if (pci_resource_len(pci_dev, bar) < thisboard->mainsize) { - dev_err(dev->class_dev, "error! PCI region size too small!\n"); - return -EINVAL; - } if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) { dev->mmio = pci_ioremap_bar(pci_dev, bar); if (!dev->mmio) { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 08/13] staging: comedi: amplc_dio200: tidy up {comedi, pci}_driver declarations
For aesthetics, add some whitespace to these declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index 52e5acf..d782730 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -392,10 +392,10 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, } static struct comedi_driver dio200_pci_comedi_driver = { - .driver_name = "amplc_dio200_pci", - .module = THIS_MODULE, - .auto_attach = dio200_pci_auto_attach, - .detach = comedi_pci_detach, + .driver_name= "amplc_dio200_pci", + .module = THIS_MODULE, + .auto_attach= dio200_pci_auto_attach, + .detach = comedi_pci_detach, }; static const struct pci_device_id dio200_pci_table[] = { @@ -416,10 +416,10 @@ static int dio200_pci_probe(struct pci_dev *dev, const struct pci_device_id *id) } static struct pci_driver dio200_pci_pci_driver = { - .name = "amplc_dio200_pci", - .id_table = dio200_pci_table, - .probe = dio200_pci_probe, - .remove = comedi_pci_auto_unconfig, + .name = "amplc_dio200_pci", + .id_table = dio200_pci_table, + .probe = dio200_pci_probe, + .remove = comedi_pci_auto_unconfig, }; module_comedi_pci_driver(dio200_pci_comedi_driver, dio200_pci_pci_driver); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 11/13] staging: comedi: amplc_dio200.h: rename 'has_enhancements' in boardinfo
This member of the boardinfor is only set for the PCIE boards. For aeshetics, rename it to 'is_pcie'. For clarity, use this flag in the (*auto_attach) to determine if the dio200_pcie_board_setup() function needs to be called instead of using the switch (context_model). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.h | 2 +- .../staging/comedi/drivers/amplc_dio200_common.c | 4 ++-- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 28 ++ 3 files changed, 15 insertions(+), 19 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index 7454caf..1dcec92 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -40,7 +40,7 @@ struct dio200_board { unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */ bool has_int_sce:1; /* has interrupt enable/status reg */ bool has_clk_gat_sce:1; /* has clock/gate selection registers */ - bool has_enhancements:1;/* has enhanced features */ + bool is_pcie:1; /* has enhanced features */ }; int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index c9275ed..7c743d2 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -638,7 +638,7 @@ static int dio200_subdev_8254_set_gate_src(struct comedi_device *dev, return -1; if (counter_number > 2) return -1; - if (gate_src > (board->has_enhancements ? 31 : 7)) + if (gate_src > (board->is_pcie ? 31 : 7)) return -1; subpriv->gate_src[counter_number] = gate_src; @@ -676,7 +676,7 @@ static int dio200_subdev_8254_set_clock_src(struct comedi_device *dev, return -1; if (counter_number > 2) return -1; - if (clock_src > (board->has_enhancements ? 31 : 7)) + if (clock_src > (board->is_pcie ? 31 : 7)) return -1; subpriv->clock_src[counter_number] = clock_src; diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index c0c8e5f..dad4679 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -276,7 +276,7 @@ static const struct dio200_board dio200_pci_boards[] = { }, .has_int_sce= true, .has_clk_gat_sce = true, - .has_enhancements = true, + .is_pcie= true, }, [pcie236_model] = { .name = "pcie236", @@ -292,7 +292,7 @@ static const struct dio200_board dio200_pci_boards[] = { }, .has_int_sce= true, .has_clk_gat_sce = true, - .has_enhancements = true, + .is_pcie= true, }, [pcie296_model] = { .name = "pcie296", @@ -308,7 +308,7 @@ static const struct dio200_board dio200_pci_boards[] = { }, .has_int_sce= true, .has_clk_gat_sce = true, - .has_enhancements = true, + .is_pcie= true, }, }; @@ -351,16 +351,16 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, unsigned long context_model) { struct pci_dev *pci_dev = comedi_to_pci_dev(dev); - const struct dio200_board *thisboard = NULL; + const struct dio200_board *board = NULL; unsigned int bar; int ret; if (context_model < ARRAY_SIZE(dio200_pci_boards)) - thisboard = &dio200_pci_boards[context_model]; - if (!thisboard) + board = &dio200_pci_boards[context_model]; + if (!board) return -EINVAL; - dev->board_ptr = thisboard; - dev->board_name = thisboard->name; + dev->board_ptr = board; + dev->board_name = board->name; dev_info(dev->class_dev, "%s: attach pci %s (%s)\n", dev->driver->driver_name, pci_name(pci_dev), dev->board_name); @@ -369,7 +369,7 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, if (ret) return ret; - bar = thisboard->mainbar; + bar = board->mainbar; if (pci_resource_flags(pci_dev, bar) & IORESOURCE_MEM) { dev->mmio = pci_ioremap_bar(pci_dev, bar); if (!dev->mmio) { @@ -380,17 +380,13 @@ static int dio200_pci_auto_attach(struct comedi_device *dev, } else { dev->iobase = pci_resource_start(pci_dev, bar);
[PATCH 13/13] staging: comedi: amplc_dio200: absorb dio200_subdev_timer_init()
This function is only called by amplc_dio200_common_attach() and it can never fail. For aesthetics, absorb it into that function. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_dio200_common.c| 21 ++--- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index e486437..87c0169 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -979,18 +979,6 @@ static int dio200_subdev_timer_config(struct comedi_device *dev, return ret < 0 ? ret : insn->n; } -static int dio200_subdev_timer_init(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - s->type = COMEDI_SUBD_TIMER; - s->subdev_flags = SDF_READABLE | SDF_LSAMPL; - s->n_chan = 1; - s->maxdata = 0x; - s->insn_read = dio200_subdev_timer_read; - s->insn_config = dio200_subdev_timer_config; - return 0; -} - void amplc_dio200_set_enhance(struct comedi_device *dev, unsigned char val) { dio200_write8(dev, DIO200_ENHANCE, val); @@ -1040,9 +1028,12 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, } break; case sd_timer: - ret = dio200_subdev_timer_init(dev, s); - if (ret < 0) - return ret; + s->type = COMEDI_SUBD_TIMER; + s->subdev_flags = SDF_READABLE | SDF_LSAMPL; + s->n_chan = 1; + s->maxdata = 0x; + s->insn_read= dio200_subdev_timer_read; + s->insn_config = dio200_subdev_timer_config; break; default: s->type = COMEDI_SUBD_UNUSED; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/13] staging: comedi: amplc_dio200.h: remove boardinfo 'mainshift'
This member of the boardinfo is only set for the PCIE boards. Use the 'is_pcie' flag to determine if the offset needs to be shifted when reading/writing the registers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.h| 1 - drivers/staging/comedi/drivers/amplc_dio200_common.c | 12 drivers/staging/comedi/drivers/amplc_dio200_pci.c| 3 --- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index 1dcec92..d6d6a26 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -34,7 +34,6 @@ enum dio200_sdtype { sd_none, sd_intr, sd_8255, sd_8254, sd_timer }; struct dio200_board { const char *name; unsigned char mainbar; - unsigned char mainshift; unsigned short n_subdevs; /* number of subdevices */ unsigned char sdtype[DIO200_MAX_SUBDEVS]; /* enum dio200_sdtype */ unsigned char sdinfo[DIO200_MAX_SUBDEVS]; /* depends on sdtype */ diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 7c743d2..e486437 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -137,7 +137,8 @@ static unsigned char dio200_read8(struct comedi_device *dev, { const struct dio200_board *board = comedi_board(dev); - offset <<= board->mainshift; + if (board->is_pcie) + offset <<= 3; if (dev->mmio) return readb(dev->mmio + offset); @@ -149,7 +150,8 @@ static void dio200_write8(struct comedi_device *dev, { const struct dio200_board *board = comedi_board(dev); - offset <<= board->mainshift; + if (board->is_pcie) + offset <<= 3; if (dev->mmio) writeb(val, dev->mmio + offset); @@ -162,7 +164,8 @@ static unsigned int dio200_read32(struct comedi_device *dev, { const struct dio200_board *board = comedi_board(dev); - offset <<= board->mainshift; + if (board->is_pcie) + offset <<= 3; if (dev->mmio) return readl(dev->mmio + offset); @@ -174,7 +177,8 @@ static void dio200_write32(struct comedi_device *dev, { const struct dio200_board *board = comedi_board(dev); - offset <<= board->mainshift; + if (board->is_pcie) + offset <<= 3; if (dev->mmio) writel(val, dev->mmio + offset); diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index dad4679..b83d1f5 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -265,7 +265,6 @@ static const struct dio200_board dio200_pci_boards[] = { [pcie215_model] = { .name = "pcie215", .mainbar= 1, - .mainshift = 3, .n_subdevs = 8, .sdtype = { sd_8255, sd_none, sd_8255, sd_none, @@ -281,7 +280,6 @@ static const struct dio200_board dio200_pci_boards[] = { [pcie236_model] = { .name = "pcie236", .mainbar= 1, - .mainshift = 3, .n_subdevs = 8, .sdtype = { sd_8255, sd_none, sd_none, sd_none, @@ -297,7 +295,6 @@ static const struct dio200_board dio200_pci_boards[] = { [pcie296_model] = { .name = "pcie296", .mainbar= 1, - .mainshift = 3, .n_subdevs = 8, .sdtype = { sd_8255, sd_8255, sd_8255, sd_8255, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/13] staging: comedi: amplc_dio200.h: remove 'mainsize' from boardinfo
This member of the boardinfo is not used by the drivers. Remove it. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.h | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index 13e18e1..3dddc8a 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -49,7 +49,6 @@ struct dio200_board { struct dio200_layout layout; unsigned char mainbar; unsigned char mainshift; - unsigned int mainsize; }; int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 02/13] staging: comedi: amplc_dio200: remove 'bustype' from boardinfo
This member of the boardinfo 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/amplc_dio200.c | 5 - drivers/staging/comedi/drivers/amplc_dio200.h | 3 --- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 5 - 3 files changed, 13 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index e855729..46839e0 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -203,7 +203,6 @@ static const struct dio200_board dio200_isa_boards[] = { { .name = "pc212e", - .bustype = isa_bustype, .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 6, @@ -216,7 +215,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc214e", - .bustype = isa_bustype, .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 4, @@ -226,7 +224,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc215e", - .bustype = isa_bustype, .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 5, @@ -238,7 +235,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc218e", - .bustype = isa_bustype, .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 7, @@ -251,7 +247,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc272e", - .bustype = isa_bustype, .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 4, diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index b142ba8..dec7d6e 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -48,12 +48,9 @@ struct dio200_layout { bool has_enhancements:1;/* has enhanced features */ }; -enum dio200_bustype { isa_bustype, pci_bustype }; - struct dio200_board { const char *name; struct dio200_layout layout; - enum dio200_bustype bustype; unsigned char mainbar; unsigned char mainshift; unsigned int mainsize; diff --git a/drivers/staging/comedi/drivers/amplc_dio200_pci.c b/drivers/staging/comedi/drivers/amplc_dio200_pci.c index 3058253..9e7bc00 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_pci.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_pci.c @@ -243,7 +243,6 @@ enum dio200_pci_model { static const struct dio200_board dio200_pci_boards[] = { [pci215_model] = { .name = "pci215", - .bustype = pci_bustype, .mainbar = 2, .mainsize = DIO200_IO_SIZE, .layout = { @@ -256,7 +255,6 @@ static const struct dio200_board dio200_pci_boards[] = { }, [pci272_model] = { .name = "pci272", - .bustype = pci_bustype, .mainbar = 2, .mainsize = DIO200_IO_SIZE, .layout = { @@ -268,7 +266,6 @@ static const struct dio200_board dio200_pci_boards[] = { }, [pcie215_model] = { .name = "pcie215", - .bustype = pci_bustype, .mainbar = 1, .mainshift = 3, .mainsize = DIO200_PCIE_IO_SIZE, @@ -285,7 +282,6 @@ static const struct dio200_board dio200_pci_boards[] = { }, [pcie236_model] = { .name = "pcie236", - .bustype = pci_bustype, .mainbar = 1, .mainshift = 3, .mainsize = DIO200_PCIE_IO_SIZE, @@ -302,7 +298,6 @@ static const struct dio200_board dio200_pci_boards[] = { }, [pcie296_model] = { .name = "pcie296", - .bustype = pci_bustype, .mainbar = 1, .mainshift = 3, .mainsize = DIO200_PCIE_IO_SIZE, -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/13] staging: comedi: amplc_dio200: remove private data
The private data in this driver only has one member, 'intr_sd', which is the index to the interrupt subdevice. This member is initialized during the attach of the driver when the sd_intr subdevice is detected in the boadinfo 'layout'. The member is then used in the interrupt handler to get the pointer to the subdevice. This member is not necessary. The comedi_device 'read_subdev' is also initialized during the attach. This can be used in the interrupt handler to get the subdevice pointer. Refactor the code to not require the private data and remove the struct and its allocations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.c | 5 - drivers/staging/comedi/drivers/amplc_dio200.h | 7 --- .../staging/comedi/drivers/amplc_dio200_common.c | 24 ++ drivers/staging/comedi/drivers/amplc_dio200_pci.c | 5 - 4 files changed, 6 insertions(+), 35 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 19b5c40..e855729 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -265,16 +265,11 @@ static const struct dio200_board dio200_isa_boards[] = { static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) { const struct dio200_board *thisboard = comedi_board(dev); - struct dio200_private *devpriv; unsigned int irq; int ret; irq = it->options[1]; - devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); - if (!devpriv) - return -ENOMEM; - ret = comedi_request_region(dev, it->options[0], thisboard->mainsize); if (ret) return ret; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index 641f1bf..b142ba8 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -59,13 +59,6 @@ struct dio200_board { unsigned int mainsize; }; -/* - * Comedi device private data. - */ -struct dio200_private { - int intr_sd; -}; - int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, unsigned long req_irq_flags); diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 81b082b..85cb26c 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -574,19 +574,13 @@ dio200_subdev_intr_init(struct comedi_device *dev, struct comedi_subdevice *s, static irqreturn_t dio200_interrupt(int irq, void *d) { struct comedi_device *dev = d; - struct dio200_private *devpriv = dev->private; - struct comedi_subdevice *s; + struct comedi_subdevice *s = dev->read_subdev; int handled; if (!dev->attached) return IRQ_NONE; - if (devpriv->intr_sd >= 0) { - s = &dev->subdevices[devpriv->intr_sd]; - handled = dio200_handle_read_intr(dev, s); - } else { - handled = 0; - } + handled = dio200_handle_read_intr(dev, s); return IRQ_RETVAL(handled); } @@ -1122,15 +1116,11 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, unsigned long req_irq_flags) { const struct dio200_board *thisboard = comedi_board(dev); - struct dio200_private *devpriv = dev->private; const struct dio200_layout *layout = dio200_board_layout(thisboard); struct comedi_subdevice *s; - int sdx; unsigned int n; int ret; - devpriv->intr_sd = -1; - ret = comedi_alloc_subdevices(dev, layout->n_subdevs); if (ret) return ret; @@ -1154,14 +1144,14 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq, break; case sd_intr: /* 'INTERRUPT' subdevice */ - if (irq) { + if (irq && !dev->read_subdev) { ret = dio200_subdev_intr_init(dev, s, DIO200_INT_SCE, layout->sdinfo[n] ); if (ret < 0) return ret; - devpriv->intr_sd = n; + dev->read_subdev = s; } else { s->type = COMEDI_SUBD_UNUSED; } @@ -1176,10 +1166,8 @@ int amplc_dio200_common_attach(struct comedi_device *dev, unsigned int irq
[PATCH 03/13] staging: comedi: amplc_dio200: remove 'mainsize' from ISA boardinfo
All the ISA DIO200 boards have an i/o region size of 0x20 (DIO200_IO_SIZE). Remove the boardinfo and open code the size in the comedi_request_region() call. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.c | 8 +--- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 46839e0..1d6ca91 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -203,7 +203,6 @@ static const struct dio200_board dio200_isa_boards[] = { { .name = "pc212e", - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 6, .sdtype = {sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, @@ -215,7 +214,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc214e", - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 4, .sdtype = {sd_8255, sd_8255, sd_8254, sd_intr}, @@ -224,7 +222,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc215e", - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 5, .sdtype = {sd_8255, sd_8255, sd_8254, sd_8254, sd_intr}, @@ -235,7 +232,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc218e", - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 7, .sdtype = {sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, @@ -247,7 +243,6 @@ static const struct dio200_board dio200_isa_boards[] = { }, { .name = "pc272e", - .mainsize = DIO200_IO_SIZE, .layout = { .n_subdevs = 4, .sdtype = {sd_8255, sd_8255, sd_8255, sd_intr}, @@ -259,13 +254,12 @@ static const struct dio200_board dio200_isa_boards[] = { static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - const struct dio200_board *thisboard = comedi_board(dev); unsigned int irq; int ret; irq = it->options[1]; - ret = comedi_request_region(dev, it->options[0], thisboard->mainsize); + ret = comedi_request_region(dev, it->options[0], 0x20); if (ret) return ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/13] staging: comedi: amplc_dio200: remove unnecessary local variable
The local variable 'irq' is not necessary in dio200_attach(). Just pass the it->options[1] value directly. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.c | 5 + 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 1d6ca91..6a60126 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -254,16 +254,13 @@ static const struct dio200_board dio200_isa_boards[] = { static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) { - unsigned int irq; int ret; - irq = it->options[1]; - ret = comedi_request_region(dev, it->options[0], 0x20); if (ret) return ret; - return amplc_dio200_common_attach(dev, irq, 0); + return amplc_dio200_common_attach(dev, it->options[1], 0); } static struct comedi_driver amplc_dio200_driver = { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/13] staging: comedi: amplc_dio200: tidy up comedi_driver declaration
For aesthetics, add some whitespace to the declaration. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.c | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index 6a60126..b0200a2 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -264,13 +264,13 @@ static int dio200_attach(struct comedi_device *dev, struct comedi_devconfig *it) } static struct comedi_driver amplc_dio200_driver = { - .driver_name = "amplc_dio200", - .module = THIS_MODULE, - .attach = dio200_attach, - .detach = comedi_legacy_detach, - .board_name = &dio200_isa_boards[0].name, - .offset = sizeof(struct dio200_board), - .num_names = ARRAY_SIZE(dio200_isa_boards), + .driver_name= "amplc_dio200", + .module = THIS_MODULE, + .attach = dio200_attach, + .detach = comedi_legacy_detach, + .board_name = &dio200_isa_boards[0].name, + .offset = sizeof(struct dio200_board), + .num_names = ARRAY_SIZE(dio200_isa_boards), }; module_comedi_driver(amplc_dio200_driver); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/13] staging: comedi: amplc_dio200.h: remove unnecessary function comment descriptions
The function names provide enough description. The extra comments are not necessary. Remove them. Also, tidy up some of the function declarations. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- .../staging/comedi/drivers/amplc_dio200_common.c | 225 ++--- 1 file changed, 59 insertions(+), 166 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 3537c05..c9275ed 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -132,9 +132,6 @@ struct dio200_subdev_intr { bool active:1; }; -/* - * Read 8-bit register. - */ static unsigned char dio200_read8(struct comedi_device *dev, unsigned int offset) { @@ -147,11 +144,8 @@ static unsigned char dio200_read8(struct comedi_device *dev, return inb(dev->iobase + offset); } -/* - * Write 8-bit register. - */ -static void dio200_write8(struct comedi_device *dev, unsigned int offset, - unsigned char val) +static void dio200_write8(struct comedi_device *dev, + unsigned int offset, unsigned char val) { const struct dio200_board *board = comedi_board(dev); @@ -163,9 +157,6 @@ static void dio200_write8(struct comedi_device *dev, unsigned int offset, outb(val, dev->iobase + offset); } -/* - * Read 32-bit register. - */ static unsigned int dio200_read32(struct comedi_device *dev, unsigned int offset) { @@ -178,11 +169,8 @@ static unsigned int dio200_read32(struct comedi_device *dev, return inl(dev->iobase + offset); } -/* - * Write 32-bit register. - */ -static void dio200_write32(struct comedi_device *dev, unsigned int offset, - unsigned int val) +static void dio200_write32(struct comedi_device *dev, + unsigned int offset, unsigned int val) { const struct dio200_board *board = comedi_board(dev); @@ -194,13 +182,10 @@ static void dio200_write32(struct comedi_device *dev, unsigned int offset, outl(val, dev->iobase + offset); } -/* - * 'insn_bits' function for an 'INTERRUPT' subdevice. - */ -static int -dio200_subdev_intr_insn_bits(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, unsigned int *data) +static int dio200_subdev_intr_insn_bits(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_insn *insn, + unsigned int *data) { const struct dio200_board *board = comedi_board(dev); struct dio200_subdev_intr *subpriv = s->private; @@ -216,9 +201,6 @@ dio200_subdev_intr_insn_bits(struct comedi_device *dev, return insn->n; } -/* - * Called to stop acquisition for an 'INTERRUPT' subdevice. - */ static void dio200_stop_intr(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -231,9 +213,6 @@ static void dio200_stop_intr(struct comedi_device *dev, dio200_write8(dev, subpriv->ofs, 0); } -/* - * Called to start acquisition for an 'INTERRUPT' subdevice. - */ static int dio200_start_intr(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -328,10 +307,6 @@ static void dio200_read_scan_intr(struct comedi_device *dev, } } -/* - * This is called from the interrupt service routine to handle a read - * scan on an 'INTERRUPT' subdevice. - */ static int dio200_handle_read_intr(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -405,9 +380,6 @@ static int dio200_handle_read_intr(struct comedi_device *dev, return (triggered != 0); } -/* - * 'cancel' function for an 'INTERRUPT' subdevice. - */ static int dio200_subdev_intr_cancel(struct comedi_device *dev, struct comedi_subdevice *s) { @@ -423,12 +395,9 @@ static int dio200_subdev_intr_cancel(struct comedi_device *dev, return 0; } -/* - * 'do_cmdtest' function for an 'INTERRUPT' subdevice. - */ -static int -dio200_subdev_intr_cmdtest(struct comedi_device *dev, - struct comedi_subdevice *s, struct comedi_cmd *cmd) +static int dio200_subdev_intr_cmdtest(struct comedi_device *dev, + struct comedi_subdevice *s, + struct comedi_cmd *cmd) { int err = 0; @@ -481,9 +450,6 @@ dio200_subdev_intr_cmdtest(struct comedi_device *dev, return 0; } -/* - * 'do_cmd' function for an 'INTERRUPT' subdevice. - */ static int dio200_subdev_intr_cmd(struct comedi_device *dev, struct comedi_subd
[PATCH 09/13] staging: comedi: amplc_dio200.h: remove struct dio200_layout definition
This struct is used to provide part of the boardinfo data. Using the extra indirection does not provide any additional clarity to the driver. Absorb the members from dio200_layout into dio200_board and remove the extra 'layout' indirection. For aesthetics, rename all the local variables used for the boardinfo pointer to 'board'. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_dio200.c | 78 +++ drivers/staging/comedi/drivers/amplc_dio200.h | 16 +--- .../staging/comedi/drivers/amplc_dio200_common.c | 96 --- drivers/staging/comedi/drivers/amplc_dio200_pci.c | 105 +++-- 4 files changed, 135 insertions(+), 160 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_dio200.c b/drivers/staging/comedi/drivers/amplc_dio200.c index b0200a2..4fe1183 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.c +++ b/drivers/staging/comedi/drivers/amplc_dio200.c @@ -202,53 +202,47 @@ */ static const struct dio200_board dio200_isa_boards[] = { { - .name = "pc212e", - .layout = { - .n_subdevs = 6, - .sdtype = {sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, - sd_intr}, - .sdinfo = {0x00, 0x08, 0x0C, 0x10, 0x14, 0x3F}, - .has_int_sce = true, - .has_clk_gat_sce = true, + .name = "pc212e", + .n_subdevs = 6, + .sdtype = { + sd_8255, sd_8254, sd_8254, sd_8254, sd_8254, sd_intr }, - }, - { - .name = "pc214e", - .layout = { - .n_subdevs = 4, - .sdtype = {sd_8255, sd_8255, sd_8254, sd_intr}, - .sdinfo = {0x00, 0x08, 0x10, 0x01}, + .sdinfo = { 0x00, 0x08, 0x0c, 0x10, 0x14, 0x3f }, + .has_int_sce= true, + .has_clk_gat_sce = true, + }, { + .name = "pc214e", + .n_subdevs = 4, + .sdtype = { + sd_8255, sd_8255, sd_8254, sd_intr }, - }, - { - .name = "pc215e", - .layout = { - .n_subdevs = 5, - .sdtype = {sd_8255, sd_8255, sd_8254, sd_8254, sd_intr}, - .sdinfo = {0x00, 0x08, 0x10, 0x14, 0x3F}, - .has_int_sce = true, - .has_clk_gat_sce = true, + .sdinfo = { 0x00, 0x08, 0x10, 0x01 }, + }, { + .name = "pc215e", + .n_subdevs = 5, + .sdtype = { + sd_8255, sd_8255, sd_8254, sd_8254, sd_intr }, - }, - { - .name = "pc218e", - .layout = { - .n_subdevs = 7, - .sdtype = {sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, - sd_intr}, - .sdinfo = {0x00, 0x04, 0x08, 0x0C, 0x10, 0x14, 0x3F}, - .has_int_sce = true, - .has_clk_gat_sce = true, + .sdinfo = { 0x00, 0x08, 0x10, 0x14, 0x3f }, + .has_int_sce= true, + .has_clk_gat_sce = true, + }, { + .name = "pc218e", + .n_subdevs = 7, + .sdtype = { + sd_8254, sd_8254, sd_8255, sd_8254, sd_8254, sd_intr }, - }, - { - .name = "pc272e", - .layout = { - .n_subdevs = 4, - .sdtype = {sd_8255, sd_8255, sd_8255, sd_intr}, - .sdinfo = {0x00, 0x08, 0x10, 0x3F}, - .has_int_sce = true, + .sdinfo = { 0x00, 0x04, 0x08, 0x0c, 0x10, 0x14, 0x3f }, + .has_int_sce= true, + .has_clk_gat_sce = true, + }, { + .name = "pc272e", + .n_subdevs = 4, + .sdtype = { + sd_8255, sd_8255, sd_8255, sd_intr }, + .sdinfo = { 0x00, 0x08, 0x10, 0x3f }, + .has_int_sce = true, }, }; diff --git a/drivers/staging/comedi/drivers/amplc_dio200.h b/drivers/staging/comedi/drivers/amplc_dio200.h index 3dddc8a..7454caf 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200.h +++ b/drivers/staging/comedi/drivers/amplc_dio200.h @@ -31,11 +31,10 @@ enum dio200_sdtype { sd_none, sd_intr, sd_8255, sd_8254, sd_timer }; #define DIO200_MAX_SUBDEVS 8 #define DIO200_MAX_ISNS6 -/* - * Board descriptions. - */ - -struct
[PATCH 15/15] staging: comedi: amplc_dio200_common: use 8255 module
This driver currently duplicates the functionality of the 8255 module. The only difference is in how the i/o access is handled. Provide a private (*io) callback for the 8255 module to handle the differences. We can then use that module and initialize the subdevice with subdev_8255_init(). Update the Kconfig to select the COMEDI_8255 module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/Kconfig | 1 + .../staging/comedi/drivers/amplc_dio200_common.c | 120 +++-- 2 files changed, 14 insertions(+), 107 deletions(-) diff --git a/drivers/staging/comedi/Kconfig b/drivers/staging/comedi/Kconfig index 36f2c71..d5509d1 100644 --- a/drivers/staging/comedi/Kconfig +++ b/drivers/staging/comedi/Kconfig @@ -1266,6 +1266,7 @@ config COMEDI_FC config COMEDI_AMPLC_DIO200 tristate + select COMEDI_8255 config COMEDI_AMPLC_PC236 tristate diff --git a/drivers/staging/comedi/drivers/amplc_dio200_common.c b/drivers/staging/comedi/drivers/amplc_dio200_common.c index 6cadf7e..4eb883c 100644 --- a/drivers/staging/comedi/drivers/amplc_dio200_common.c +++ b/drivers/staging/comedi/drivers/amplc_dio200_common.c @@ -27,7 +27,7 @@ #include "amplc_dio200.h" #include "comedi_fc.h" #include "8253.h" -#include "8255.h" /* only for register defines */ +#include "8255.h" /* 200 series registers */ #define DIO200_IO_SIZE 0x20 @@ -111,10 +111,6 @@ struct dio200_subdev_8254 { spinlock_t spinlock; }; -struct dio200_subdev_8255 { - unsigned int ofs; /* DIO base offset */ -}; - struct dio200_subdev_intr { spinlock_t spinlock; unsigned int ofs; @@ -178,6 +174,16 @@ static void dio200_write32(struct comedi_device *dev, outl(val, dev->iobase + offset); } +static int dio200_8255_io(struct comedi_device *dev, + int dir, int port, int data, unsigned long regbase) +{ + if (dir) { + dio200_write8(dev, regbase + port, data); + return 0; + } + return dio200_read8(dev, regbase + port); +} + static int dio200_subdev_intr_insn_bits(struct comedi_device *dev, struct comedi_subdevice *s, struct comedi_insn *insn, @@ -801,106 +807,6 @@ static int dio200_subdev_8254_init(struct comedi_device *dev, return 0; } -static void dio200_subdev_8255_set_dir(struct comedi_device *dev, - struct comedi_subdevice *s) -{ - struct dio200_subdev_8255 *subpriv = s->private; - int config; - - config = I8255_CTRL_CW; - /* 1 in io_bits indicates output, 1 in config indicates input */ - if (!(s->io_bits & 0xff)) - config |= I8255_CTRL_A_IO; - if (!(s->io_bits & 0x00ff00)) - config |= I8255_CTRL_B_IO; - if (!(s->io_bits & 0x0f)) - config |= I8255_CTRL_C_LO_IO; - if (!(s->io_bits & 0xf0)) - config |= I8255_CTRL_C_HI_IO; - dio200_write8(dev, subpriv->ofs + I8255_CTRL_REG, config); -} - -static int dio200_subdev_8255_bits(struct comedi_device *dev, - struct comedi_subdevice *s, - struct comedi_insn *insn, - unsigned int *data) -{ - struct dio200_subdev_8255 *subpriv = s->private; - unsigned int mask; - unsigned int val; - - mask = comedi_dio_update_state(s, data); - if (mask) { - if (mask & 0xff) - dio200_write8(dev, subpriv->ofs + I8255_DATA_A_REG, - s->state & 0xff); - if (mask & 0xff00) - dio200_write8(dev, subpriv->ofs + I8255_DATA_B_REG, - (s->state >> 8) & 0xff); - if (mask & 0xff) - dio200_write8(dev, subpriv->ofs + I8255_DATA_C_REG, - (s->state >> 16) & 0xff); - } - - val = dio200_read8(dev, subpriv->ofs + I8255_DATA_A_REG); - val |= dio200_read8(dev, subpriv->ofs + I8255_DATA_B_REG) << 8; - val |= dio200_read8(dev, subpriv->ofs + I8255_DATA_C_REG) << 16; - - data[1] = val; - - return insn->n; -} - -static int dio200_subdev_8255_config(struct comedi_device *dev, -struct comedi_subdevice *s, -struct comedi_insn *insn, -unsigned int *data) -{ - unsigned int chan = CR_CHAN(insn->chanspec); - unsigned int mask; - int ret; - - if (chan < 8) - mask = 0xff; - else if (chan < 16) - mask = 0x00ff00; - else if (chan < 20) - mask = 0x0f; - else - mask = 0xf0; - -
[PATCH 11/15] staging: comedi: 8255_pci: tidy up pci_8255_mmio()
The 8255 driver (*io) callback now includes the comedi_device pointer. Using this we can get the ioremap'ed base address. Instead of passing the (cast) mmio address to subdev_8255_init(), pass the 'iobase' of the 8255 registers (i * 4). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255_pci.c | 9 +++-- 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 81856ef..c303e98 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -193,13 +193,11 @@ static int pci_8255_mite_init(struct pci_dev *pcidev) static int pci_8255_mmio(struct comedi_device *dev, int dir, int port, int data, unsigned long iobase) { - void __iomem *mmio_base = (void __iomem *)iobase; - if (dir) { - writeb(data, mmio_base + port); + writeb(data, dev->mmio + iobase + port); return 0; } - return readb(mmio_base + port); + return readb(dev->mmio + iobase + port); } static int pci_8255_auto_attach(struct comedi_device *dev, @@ -253,8 +251,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev, s = &dev->subdevices[i]; if (is_mmio) { - iobase = (unsigned long)(dev->mmio + (i * 4)); - ret = subdev_8255_init(dev, s, pci_8255_mmio, iobase); + ret = subdev_8255_init(dev, s, pci_8255_mmio, i * 4); } else { iobase = dev->iobase + (i * 4); ret = subdev_8255_init(dev, s, NULL, iobase); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 01/15] staging: comedi: cb_pcidas: use dev->iobase for PCI bar 3
Currently the base address of the 8254 and 8255 devices, found in PCI bar 3, is saved in the private data as 'pacer_counter_dio'. The 'iobase' in the comedi_device is currently unused. Save the address from PCI bar 3 in the comedi_device and remove the unnecessary member from the private data. This will help with some cleanup of the 8255 module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas.c b/drivers/staging/comedi/drivers/cb_pcidas.c index 80908eb..feae3e4 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas.c +++ b/drivers/staging/comedi/drivers/cb_pcidas.c @@ -342,7 +342,6 @@ struct cb_pcidas_private { unsigned long s5933_config; unsigned long control_status; unsigned long adc_fifo; - unsigned long pacer_counter_dio; unsigned long ao_registers; /* divisors of master clock for analog input pacing */ unsigned int divisor1; @@ -942,7 +941,7 @@ static int cb_pcidas_ai_cmdtest(struct comedi_device *dev, static void cb_pcidas_ai_load_counters(struct comedi_device *dev) { struct cb_pcidas_private *devpriv = dev->private; - unsigned long timer_base = devpriv->pacer_counter_dio + ADC8254; + unsigned long timer_base = dev->iobase + ADC8254; i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); @@ -1194,7 +1193,7 @@ static int cb_pcidas_ao_inttrig(struct comedi_device *dev, static void cb_pcidas_ao_load_counters(struct comedi_device *dev) { struct cb_pcidas_private *devpriv = dev->private; - unsigned long timer_base = devpriv->pacer_counter_dio + DAC8254; + unsigned long timer_base = dev->iobase + DAC8254; i8254_set_mode(timer_base, 0, 1, I8254_MODE2 | I8254_BINARY); i8254_set_mode(timer_base, 0, 2, I8254_MODE2 | I8254_BINARY); @@ -1463,7 +1462,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, devpriv->s5933_config = pci_resource_start(pcidev, 0); devpriv->control_status = pci_resource_start(pcidev, 1); devpriv->adc_fifo = pci_resource_start(pcidev, 2); - devpriv->pacer_counter_dio = pci_resource_start(pcidev, 3); + dev->iobase = pci_resource_start(pcidev, 3); if (thisboard->ao_nchan) devpriv->ao_registers = pci_resource_start(pcidev, 4); @@ -1529,8 +1528,7 @@ static int cb_pcidas_auto_attach(struct comedi_device *dev, /* 8255 */ s = &dev->subdevices[2]; - ret = subdev_8255_init(dev, s, NULL, - devpriv->pacer_counter_dio + DIO_8255); + ret = subdev_8255_init(dev, s, NULL, dev->iobase + DIO_8255); if (ret) return ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 10/15] staging: comedi: cb_pcidas64: tidy up dio_callback_4020()
The 8255 driver (*io) callback now includes the comedi_device pointer. Using this we can get the ioremap'ed base address. Instead of passing the (cast) mmio address to subdev_8255_init(), pass the 'iobase' of the 8255 registers (I8255_4020_REG). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 84ff853..f94923b 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -3380,15 +3380,15 @@ static int dio_callback(struct comedi_device *dev, } static int dio_callback_4020(struct comedi_device *dev, -int dir, int port, int data, unsigned long arg) +int dir, int port, int data, unsigned long iobase) { - void __iomem *iobase = (void __iomem *)arg; + struct pcidas64_private *devpriv = dev->private; if (dir) { - writew(data, iobase + 2 * port); + writew(data, devpriv->main_iobase + iobase + 2 * port); return 0; } - return readw(iobase + 2 * port); + return readw(devpriv->main_iobase + iobase + 2 * port); } static int di_rbits(struct comedi_device *dev, struct comedi_subdevice *s, @@ -3751,7 +3751,6 @@ static int setup_subdevices(struct comedi_device *dev) const struct pcidas64_board *thisboard = comedi_board(dev); struct pcidas64_private *devpriv = dev->private; struct comedi_subdevice *s; - void __iomem *dio_8255_iobase; int i; int ret; @@ -3840,9 +3839,8 @@ static int setup_subdevices(struct comedi_device *dev) s = &dev->subdevices[4]; if (thisboard->has_8255) { if (thisboard->layout == LAYOUT_4020) { - dio_8255_iobase = devpriv->main_iobase + I8255_4020_REG; ret = subdev_8255_init(dev, s, dio_callback_4020, - (unsigned long)dio_8255_iobase); + I8255_4020_REG); } else { ret = subdev_8255_init(dev, s, dio_callback, DIO_8255_OFFSET); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/15] staging: comedi: 8255: add a comedi_device param to the (*io) callback
The 8255 driver uses an (*io) callback to read/write the registers of the 8255 device. The default callback provided by the driver uses inb()/outb() calls to access to registers based on an 'iobase' that was initialized during the subdev_8255_init() and a 'port' value. The users of this module can optionally provide a custom (*io) callback to handle the read/write in another manner. Make the (*io) callback a bit more flexible by also passing the comedi_device pointer as a parameter. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 33 ++ drivers/staging/comedi/drivers/8255.h | 6 +++-- drivers/staging/comedi/drivers/8255_pci.c | 3 ++- drivers/staging/comedi/drivers/cb_pcidas64.c | 6 +++-- drivers/staging/comedi/drivers/daqboard2000.c | 3 ++- drivers/staging/comedi/drivers/ni_labpc.c | 3 ++- drivers/staging/comedi/drivers/ni_mio_common.c | 3 ++- drivers/staging/comedi/drivers/pcl724.c| 3 ++- 8 files changed, 36 insertions(+), 24 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index a33a196..212e547 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -94,10 +94,11 @@ I/O port base address can be found in the output of 'lspci -v'. struct subdev_8255_private { unsigned long iobase; - int (*io)(int, int, int, unsigned long); + int (*io)(struct comedi_device *, int, int, int, unsigned long); }; -static int subdev_8255_io(int dir, int port, int data, unsigned long iobase) +static int subdev_8255_io(struct comedi_device *dev, + int dir, int port, int data, unsigned long iobase) { if (dir) { outb(data, iobase + port); @@ -113,8 +114,8 @@ void subdev_8255_interrupt(struct comedi_device *dev, unsigned long iobase = spriv->iobase; unsigned short d; - d = spriv->io(0, _8255_DATA, 0, iobase); - d |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); + d = spriv->io(dev, 0, _8255_DATA, 0, iobase); + d |= (spriv->io(dev, 0, _8255_DATA + 1, 0, iobase) << 8); comedi_buf_put(s, d); s->async->events |= COMEDI_CB_EOS; @@ -136,18 +137,18 @@ static int subdev_8255_insn(struct comedi_device *dev, mask = comedi_dio_update_state(s, data); if (mask) { if (mask & 0xff) - spriv->io(1, _8255_DATA, s->state & 0xff, iobase); + spriv->io(dev, 1, _8255_DATA, s->state & 0xff, iobase); if (mask & 0xff00) - spriv->io(1, _8255_DATA + 1, (s->state >> 8) & 0xff, - iobase); + spriv->io(dev, 1, _8255_DATA + 1, + (s->state >> 8) & 0xff, iobase); if (mask & 0xff) - spriv->io(1, _8255_DATA + 2, (s->state >> 16) & 0xff, - iobase); + spriv->io(dev, 1, _8255_DATA + 2, + (s->state >> 16) & 0xff, iobase); } - v = spriv->io(0, _8255_DATA, 0, iobase); - v |= (spriv->io(0, _8255_DATA + 1, 0, iobase) << 8); - v |= (spriv->io(0, _8255_DATA + 2, 0, iobase) << 16); + v = spriv->io(dev, 0, _8255_DATA, 0, iobase); + v |= (spriv->io(dev, 0, _8255_DATA + 1, 0, iobase) << 8); + v |= (spriv->io(dev, 0, _8255_DATA + 2, 0, iobase) << 16); data[1] = v; @@ -172,7 +173,7 @@ static void subdev_8255_do_config(struct comedi_device *dev, if (!(s->io_bits & 0xf0)) config |= CR_C_HI_IO; - spriv->io(1, _8255_CR, config, iobase); + spriv->io(dev, 1, _8255_CR, config, iobase); } static int subdev_8255_insn_config(struct comedi_device *dev, @@ -261,7 +262,8 @@ static int subdev_8255_cancel(struct comedi_device *dev, } int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, -int (*io)(int, int, int, unsigned long), +int (*io)(struct comedi_device *, + int, int, int, unsigned long), unsigned long iobase) { struct subdev_8255_private *spriv; @@ -288,7 +290,8 @@ int subdev_8255_init(struct comedi_device *dev, struct comedi_subdevice *s, EXPORT_SYMBOL_GPL(subdev_8255_init); int subdev_8255_init_irq(struct comedi_device *dev, struct comedi_subdevice *s, -int (*io)(int, int, int, unsigned long), +int (*io)(struct comedi_device *, + int, int, int, unsigned long), unsigned long iobase) { int ret; diff --git a/drivers/staging/comedi/drivers/8255.h b/drivers/staging/comedi/drivers/8255.h index 795d232..c2c20db 100644 --- a/drivers/staging/comedi/driver
[PATCH 06/15] staging: comedi: ni_mio_common: tidy up ni_8255_callback()
The 8255 driver (*io) callback now includes the comedi_device pointer. Instead of passing the (cast) pointer to subdev_8255_init(), pass the 'iobase' of the 8255 registers (Port_A). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_mio_common.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_mio_common.c b/drivers/staging/comedi/drivers/ni_mio_common.c index 0765905..8b3ba40 100644 --- a/drivers/staging/comedi/drivers/ni_mio_common.c +++ b/drivers/staging/comedi/drivers/ni_mio_common.c @@ -4176,17 +4176,15 @@ static int ni_freq_out_insn_config(struct comedi_device *dev, return insn->n; } -static int ni_8255_callback(struct comedi_device *cdev, - int dir, int port, int data, unsigned long arg) +static int ni_8255_callback(struct comedi_device *dev, + int dir, int port, int data, unsigned long iobase) { - struct comedi_device *dev = (struct comedi_device *)arg; - if (dir) { - ni_writeb(dev, data, Port_A + 2 * port); + ni_writeb(dev, data, iobase + 2 * port); return 0; } - return ni_readb(dev, Port_A + 2 * port); + return ni_readb(dev, iobase + 2 * port); } static int ni_get_pwm_config(struct comedi_device *dev, unsigned int *data) @@ -5561,8 +5559,7 @@ static int ni_E_init(struct comedi_device *dev, /* 8255 device */ s = &dev->subdevices[NI_8255_DIO_SUBDEV]; if (board->has_8255) { - ret = subdev_8255_init(dev, s, ni_8255_callback, - (unsigned long)dev); + ret = subdev_8255_init(dev, s, ni_8255_callback, Port_A); if (ret) return ret; } else { -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/15] staging: comedi: ni_labpc: tidy up labpc_8255_mmio()
The 8255 driver (*io) callback now includes the comedi_device pointer. Instead of passing the (cast) pointer to subdev_8255_init(), pass the 'iobase' of the 8255 registers (DIO_BASE_REG). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/ni_labpc.c | 12 +--- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c index fa108b9..15ead27 100644 --- a/drivers/staging/comedi/drivers/ni_labpc.c +++ b/drivers/staging/comedi/drivers/ni_labpc.c @@ -1035,17 +1035,15 @@ static int labpc_ao_insn_read(struct comedi_device *dev, return 1; } -static int labpc_8255_mmio(struct comedi_device *cdev, - int dir, int port, int data, unsigned long arg) +static int labpc_8255_mmio(struct comedi_device *dev, + int dir, int port, int data, unsigned long iobase) { - struct comedi_device *dev = (struct comedi_device *)arg; - if (dir) { - writeb(data, dev->mmio + DIO_BASE_REG + port); + writeb(data, dev->mmio + iobase + port); return 0; } - return readb(dev->mmio + DIO_BASE_REG + port); + return readb(dev->mmio + iobase + port); } /* lowlevel write to eeprom/dac */ @@ -1405,7 +1403,7 @@ int labpc_common_attach(struct comedi_device *dev, s = &dev->subdevices[2]; if (dev->mmio) { ret = subdev_8255_init(dev, s, labpc_8255_mmio, - (unsigned long)dev); + DIO_BASE_REG); } else { ret = subdev_8255_init(dev, s, NULL, dev->iobase + DIO_BASE_REG); -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/15] staging: comedi: cb_pcidas64: tidy up dio_callback()
The 8255 driver (*io) callback now includes the comedi_device pointer. Using this we can get the ioremap'ed base address. Instead of passing the (cast) mmio address to subdev_8255_init(), pass the 'iobase' of the 8255 registers (DIO_8255_OFFSET). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidas64.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index 064d7f0..84ff853 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -3370,15 +3370,13 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) } static int dio_callback(struct comedi_device *dev, - int dir, int port, int data, unsigned long arg) + int dir, int port, int data, unsigned long iobase) { - void __iomem *iobase = (void __iomem *)arg; - if (dir) { - writeb(data, iobase + port); + writeb(data, dev->mmio + iobase + port); return 0; } - return readb(iobase + port); + return readb(dev->mmio + iobase + port); } static int dio_callback_4020(struct comedi_device *dev, @@ -3846,9 +3844,8 @@ static int setup_subdevices(struct comedi_device *dev) ret = subdev_8255_init(dev, s, dio_callback_4020, (unsigned long)dio_8255_iobase); } else { - dio_8255_iobase = dev->mmio + DIO_8255_OFFSET; ret = subdev_8255_init(dev, s, dio_callback, - (unsigned long)dio_8255_iobase); + DIO_8255_OFFSET); } if (ret) return ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 13/15] staging: comedi: 8255: make default (*io) function handle memory mapped io
The drivers that use this module with memory mapped io all have the ioremap'ed base address stored in the comedi_device 'mmio' member. Modify subdev_8255_io() to handle the memory mapped io. This allows removing the private callbacks from some of the drivers. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c| 14 -- drivers/staging/comedi/drivers/8255_pci.c| 20 ++-- drivers/staging/comedi/drivers/cb_pcidas64.c | 13 + drivers/staging/comedi/drivers/ni_labpc.c| 18 +- 4 files changed, 16 insertions(+), 49 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 39cf12e..4095a87 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -100,11 +100,21 @@ struct subdev_8255_private { static int subdev_8255_io(struct comedi_device *dev, int dir, int port, int data, unsigned long regbase) { + unsigned int offset = regbase + port; + + if (dev->mmio) { + if (dir) { + writeb(data, dev->mmio + offset); + return 0; + } + return readb(dev->mmio + offset); + } + if (dir) { - outb(data, dev->iobase + regbase + port); + outb(data, dev->iobase + offset); return 0; } - return inb(dev->iobase + regbase + port); + return inb(dev->iobase + offset); } void subdev_8255_interrupt(struct comedi_device *dev, diff --git a/drivers/staging/comedi/drivers/8255_pci.c b/drivers/staging/comedi/drivers/8255_pci.c index 24e9099..1418cd6 100644 --- a/drivers/staging/comedi/drivers/8255_pci.c +++ b/drivers/staging/comedi/drivers/8255_pci.c @@ -190,23 +190,12 @@ static int pci_8255_mite_init(struct pci_dev *pcidev) return 0; } -static int pci_8255_mmio(struct comedi_device *dev, -int dir, int port, int data, unsigned long iobase) -{ - if (dir) { - writeb(data, dev->mmio + iobase + port); - return 0; - } - return readb(dev->mmio + iobase + port); -} - static int pci_8255_auto_attach(struct comedi_device *dev, unsigned long context) { struct pci_dev *pcidev = comedi_to_pci_dev(dev); const struct pci_8255_boardinfo *board = NULL; struct comedi_subdevice *s; - bool is_mmio; int ret; int i; @@ -227,9 +216,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev, return ret; } - is_mmio = (pci_resource_flags(pcidev, board->dio_badr) & - IORESOURCE_MEM) != 0; - if (is_mmio) { + if ((pci_resource_flags(pcidev, board->dio_badr) & IORESOURCE_MEM)) { dev->mmio = pci_ioremap_bar(pcidev, board->dio_badr); if (!dev->mmio) return -ENOMEM; @@ -248,10 +235,7 @@ static int pci_8255_auto_attach(struct comedi_device *dev, for (i = 0; i < board->n_8255; i++) { s = &dev->subdevices[i]; - if (is_mmio) - ret = subdev_8255_init(dev, s, pci_8255_mmio, i * 4); - else - ret = subdev_8255_init(dev, s, NULL, i * 4); + ret = subdev_8255_init(dev, s, NULL, i * 4); if (ret) return ret; } diff --git a/drivers/staging/comedi/drivers/cb_pcidas64.c b/drivers/staging/comedi/drivers/cb_pcidas64.c index f94923b..9c18789 100644 --- a/drivers/staging/comedi/drivers/cb_pcidas64.c +++ b/drivers/staging/comedi/drivers/cb_pcidas64.c @@ -3369,16 +3369,6 @@ static int ao_cancel(struct comedi_device *dev, struct comedi_subdevice *s) return 0; } -static int dio_callback(struct comedi_device *dev, - int dir, int port, int data, unsigned long iobase) -{ - if (dir) { - writeb(data, dev->mmio + iobase + port); - return 0; - } - return readb(dev->mmio + iobase + port); -} - static int dio_callback_4020(struct comedi_device *dev, int dir, int port, int data, unsigned long iobase) { @@ -3842,8 +3832,7 @@ static int setup_subdevices(struct comedi_device *dev) ret = subdev_8255_init(dev, s, dio_callback_4020, I8255_4020_REG); } else { - ret = subdev_8255_init(dev, s, dio_callback, - DIO_8255_OFFSET); + ret = subdev_8255_init(dev, s, NULL, DIO_8255_OFFSET); } if (ret) return ret; diff --git a/drivers/staging/comedi/drivers/ni_labpc.c b/drivers/staging/comedi/drivers/ni_labpc.c i
[PATCH 00/15] staging: comedi: 8255: tidy up the (*io) operations
Now that the comedi_device has a 'mmio' and a 'iobase' member, this module can detect if the (*io) operations need to use readb/writeb for memory mapped I/O or inb/outb for port I/O. This can be use to cleanup a lot of the code duplication in the drivers that use the 8255 module. 1) Modify a couple comedi drivers that use port I/O for the 8255 device so that the 'iobase' is used for the base address of the 8255 device. 2) Add a comedi_device parameter to the (*io) callback. Tidy up the private (*io) callbacks to use this parameter. 3) Modify the default (*io) callback to use the comedi_device 'iobase'. Remove the, now redundant, dev->iobase from the 'iobase' that is passed to subdev_8255_init() for all callers that use the default (*io) callback. 4) Modify the default (*io) callback to use the comedi_device 'mmio'. Remove the private (*io) callbacks that use readb/writeb to access the hardware. 5) Modify the amplc_dio200_common module to use the 8255 module and remove the code duplication. H Hartley Sweeten (15): staging: comedi: cb_pcidas: use dev->iobase for PCI bar 3 staging: comedi: cb_pcimdas: refactor iobase addresses staging: comedi: cb_pcidda: refactor iobase addresses staging: comedi: amplc_pci230: refactor iobase addresses staging: comedi: 8255: add a comedi_device param to the (*io) callback staging: comedi: ni_mio_common: tidy up ni_8255_callback() staging: comedi: ni_labpc: tidy up labpc_8255_mmio() staging: comedi: ni_labpc: tidy up daqboard2000_8255_cb() staging: comedi: cb_pcidas64: tidy up dio_callback() staging: comedi: cb_pcidas64: tidy up dio_callback_4020() staging: comedi: 8255_pci: tidy up pci_8255_mmio() staging: comedi: 8255: refactor how the (*io) function works staging: comedi: 8255: make default (*io) function handle memory mapped io staging: comedi: 8255: provide common defines for registers staging: comedi: amplc_dio200_common: use 8255 module drivers/staging/comedi/Kconfig | 1 + drivers/staging/comedi/drivers/8255.c | 100 +++-- drivers/staging/comedi/drivers/8255.h | 24 ++- drivers/staging/comedi/drivers/8255_pci.c | 26 +--- drivers/staging/comedi/drivers/adv_pci_dio.c | 4 +- drivers/staging/comedi/drivers/aio_aio12_8.c | 3 +- .../staging/comedi/drivers/amplc_dio200_common.c | 127 ++-- .../staging/comedi/drivers/amplc_pc236_common.c| 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 162 ++--- drivers/staging/comedi/drivers/cb_pcidas.c | 10 +- drivers/staging/comedi/drivers/cb_pcidas64.c | 28 +--- drivers/staging/comedi/drivers/cb_pcidda.c | 27 ++-- drivers/staging/comedi/drivers/cb_pcimdas.c| 16 +- drivers/staging/comedi/drivers/cb_pcimdda.c| 3 +- drivers/staging/comedi/drivers/daqboard2000.c | 13 +- drivers/staging/comedi/drivers/das08.c | 3 +- drivers/staging/comedi/drivers/das16.c | 3 +- drivers/staging/comedi/drivers/das16m1.c | 2 +- drivers/staging/comedi/drivers/ni_atmio16d.c | 2 +- drivers/staging/comedi/drivers/ni_daq_dio24.c | 2 +- drivers/staging/comedi/drivers/ni_labpc.c | 20 +-- drivers/staging/comedi/drivers/ni_mio_common.c | 12 +- drivers/staging/comedi/drivers/pcl724.c| 10 +- drivers/staging/comedi/drivers/pcm3724.c | 27 +--- 24 files changed, 233 insertions(+), 394 deletions(-) -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 12/15] staging: comedi: 8255: refactor how the (*io) function works
Currently, all users of is module that use the default (*io) function pass an 'iobase' to subdev_8255_init() of the form: dev->iobase + OFFSET_TO_8255_BASE_REG Now that the (*io) callback includes the comedi_device 'dev' pointer the 'dev->iobase' does not need to be included. Modify the default (*io) function, subdev_8255_io(), to automatically add the dev->iobase to the address when reading/writing the port. For aesthetics, rename the subdevice private data member to 'regbase'. Also, rename the local variables in this module that are used to access this member. Add a comment in dev_8255_attach() about the 'iobase' that is passed to subdev_8255_init(). For manually attached 8255 devices the io region is requested with __comedi_request_region() which does not set dev->iobase. For these devices the 'regbase' is actually the 'iobase'. Remove the, now unnecessary, dev->iobase from all the callers of subdev_8255_init(). There are a couple drivers that only passed the dev->iobase. For those drivers pass a 'regbase' of 0x00. Note that the das16m1 driver is a bit goofy. The devpriv->extra_iobase is requested using __comedi_request_region() which does not set the dev->iobase. But the starting address passed is dev->iobase + DAS16M1_82C55 so a 'regbase' of DAS16M1_82C55 is passed to subdev_8255_init(). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 51 -- drivers/staging/comedi/drivers/8255.h | 4 +- drivers/staging/comedi/drivers/8255_pci.c | 10 ++--- drivers/staging/comedi/drivers/adv_pci_dio.c | 1 - drivers/staging/comedi/drivers/aio_aio12_8.c | 3 +- .../staging/comedi/drivers/amplc_pc236_common.c| 2 +- drivers/staging/comedi/drivers/amplc_pci230.c | 3 +- drivers/staging/comedi/drivers/cb_pcidas.c | 2 +- drivers/staging/comedi/drivers/cb_pcidda.c | 2 +- drivers/staging/comedi/drivers/cb_pcimdas.c| 2 +- drivers/staging/comedi/drivers/cb_pcimdda.c| 3 +- drivers/staging/comedi/drivers/das08.c | 3 +- drivers/staging/comedi/drivers/das16.c | 3 +- drivers/staging/comedi/drivers/das16m1.c | 2 +- drivers/staging/comedi/drivers/ni_atmio16d.c | 2 +- drivers/staging/comedi/drivers/ni_daq_dio24.c | 2 +- drivers/staging/comedi/drivers/ni_labpc.c | 3 +- drivers/staging/comedi/drivers/pcl724.c| 3 +- drivers/staging/comedi/drivers/pcm3724.c | 3 +- 19 files changed, 49 insertions(+), 55 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 212e547..39cf12e 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -93,29 +93,29 @@ I/O port base address can be found in the output of 'lspci -v'. #define CR_CW 0x80 struct subdev_8255_private { - unsigned long iobase; + unsigned long regbase; int (*io)(struct comedi_device *, int, int, int, unsigned long); }; static int subdev_8255_io(struct comedi_device *dev, - int dir, int port, int data, unsigned long iobase) + int dir, int port, int data, unsigned long regbase) { if (dir) { - outb(data, iobase + port); + outb(data, dev->iobase + regbase + port); return 0; } - return inb(iobase + port); + return inb(dev->iobase + regbase + port); } void subdev_8255_interrupt(struct comedi_device *dev, struct comedi_subdevice *s) { struct subdev_8255_private *spriv = s->private; - unsigned long iobase = spriv->iobase; + unsigned long regbase = spriv->regbase; unsigned short d; - d = spriv->io(dev, 0, _8255_DATA, 0, iobase); - d |= (spriv->io(dev, 0, _8255_DATA + 1, 0, iobase) << 8); + d = spriv->io(dev, 0, _8255_DATA, 0, regbase); + d |= (spriv->io(dev, 0, _8255_DATA + 1, 0, regbase) << 8); comedi_buf_put(s, d); s->async->events |= COMEDI_CB_EOS; @@ -130,25 +130,25 @@ static int subdev_8255_insn(struct comedi_device *dev, unsigned int *data) { struct subdev_8255_private *spriv = s->private; - unsigned long iobase = spriv->iobase; + unsigned long regbase = spriv->regbase; unsigned int mask; unsigned int v; mask = comedi_dio_update_state(s, data); if (mask) { if (mask & 0xff) - spriv->io(dev, 1, _8255_DATA, s->state & 0xff, iobase); + spriv->io(dev, 1, _8255_DATA, s->state & 0xff, regbase); if (mask & 0xff00) spriv->io(dev, 1, _8255_DATA + 1, - (s->state >> 8) & 0xff, iobase); + (s->state >> 8) & 0xff, regbase
[PATCH 14/15] staging: comedi: 8255: provide common defines for registers
There are a couple comedi drivers that duplicate some of the register defines used by the 8255 module. Move these defines into the header so the duplication can be removed. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/8255.c | 46 -- drivers/staging/comedi/drivers/8255.h | 14 +++ drivers/staging/comedi/drivers/8255_pci.c | 2 +- drivers/staging/comedi/drivers/adv_pci_dio.c | 3 +- .../staging/comedi/drivers/amplc_dio200_common.c | 35 +++- drivers/staging/comedi/drivers/cb_pcidda.c | 2 +- drivers/staging/comedi/drivers/pcl724.c| 6 +-- drivers/staging/comedi/drivers/pcm3724.c | 26 8 files changed, 57 insertions(+), 77 deletions(-) diff --git a/drivers/staging/comedi/drivers/8255.c b/drivers/staging/comedi/drivers/8255.c index 4095a87..f8ce598 100644 --- a/drivers/staging/comedi/drivers/8255.c +++ b/drivers/staging/comedi/drivers/8255.c @@ -79,19 +79,6 @@ I/O port base address can be found in the output of 'lspci -v'. #include "comedi_fc.h" #include "8255.h" -#define _8255_SIZE 4 - -#define _8255_DATA 0 -#define _8255_CR 3 - -#define CR_C_LO_IO 0x01 -#define CR_B_IO0x02 -#define CR_B_MODE 0x04 -#define CR_C_HI_IO 0x08 -#define CR_A_IO0x10 -#define CR_A_MODE(a) ((a)<<5) -#define CR_CW 0x80 - struct subdev_8255_private { unsigned long regbase; int (*io)(struct comedi_device *, int, int, int, unsigned long); @@ -124,8 +111,8 @@ void subdev_8255_interrupt(struct comedi_device *dev, unsigned long regbase = spriv->regbase; unsigned short d; - d = spriv->io(dev, 0, _8255_DATA, 0, regbase); - d |= (spriv->io(dev, 0, _8255_DATA + 1, 0, regbase) << 8); + d = spriv->io(dev, 0, I8255_DATA_A_REG, 0, regbase); + d |= (spriv->io(dev, 0, I8255_DATA_B_REG, 0, regbase) << 8); comedi_buf_put(s, d); s->async->events |= COMEDI_CB_EOS; @@ -147,18 +134,19 @@ static int subdev_8255_insn(struct comedi_device *dev, mask = comedi_dio_update_state(s, data); if (mask) { if (mask & 0xff) - spriv->io(dev, 1, _8255_DATA, s->state & 0xff, regbase); + spriv->io(dev, 1, I8255_DATA_A_REG, + s->state & 0xff, regbase); if (mask & 0xff00) - spriv->io(dev, 1, _8255_DATA + 1, + spriv->io(dev, 1, I8255_DATA_B_REG, (s->state >> 8) & 0xff, regbase); if (mask & 0xff) - spriv->io(dev, 1, _8255_DATA + 2, + spriv->io(dev, 1, I8255_DATA_C_REG, (s->state >> 16) & 0xff, regbase); } - v = spriv->io(dev, 0, _8255_DATA, 0, regbase); - v |= (spriv->io(dev, 0, _8255_DATA + 1, 0, regbase) << 8); - v |= (spriv->io(dev, 0, _8255_DATA + 2, 0, regbase) << 16); + v = spriv->io(dev, 0, I8255_DATA_A_REG, 0, regbase); + v |= (spriv->io(dev, 0, I8255_DATA_B_REG, 0, regbase) << 8); + v |= (spriv->io(dev, 0, I8255_DATA_C_REG, 0, regbase) << 16); data[1] = v; @@ -172,18 +160,18 @@ static void subdev_8255_do_config(struct comedi_device *dev, unsigned long regbase = spriv->regbase; int config; - config = CR_CW; + config = I8255_CTRL_CW; /* 1 in io_bits indicates output, 1 in config indicates input */ if (!(s->io_bits & 0xff)) - config |= CR_A_IO; + config |= I8255_CTRL_A_IO; if (!(s->io_bits & 0x00ff00)) - config |= CR_B_IO; + config |= I8255_CTRL_B_IO; if (!(s->io_bits & 0x0f)) - config |= CR_C_LO_IO; + config |= I8255_CTRL_C_LO_IO; if (!(s->io_bits & 0xf0)) - config |= CR_C_HI_IO; + config |= I8255_CTRL_C_HI_IO; - spriv->io(dev, 1, _8255_CR, config, regbase); + spriv->io(dev, 1, I8255_CTRL_REG, config, regbase); } static int subdev_8255_insn_config(struct comedi_device *dev, @@ -358,7 +346,7 @@ static int dev_8255_attach(struct comedi_device *dev, * comedi_config, the 'iobase' is the actual I/O port * base address of the chip. */ - ret = __comedi_request_region(dev, iobase, _8255_SIZE); + ret = __comedi_request_region(dev, iobase, I8255_SIZE); if (ret) { s->type = COMEDI_SUBD_UNUSED; } else { @@ -381,7 +369,7 @@ static void dev_8255_detach(struct comedi_device *dev) s = &dev->subdevices[i]; if (s->type != COMEDI_SUBD_UNUSED) { spriv = s->private; - release_region(
[PATCH 04/15] staging: comedi: amplc_pci230: refactor iobase addresses
This driver uses two iobase addresses, found in PCI bars 2 and 3. Currently, the address in PCI bar 2 is saved in the private data as 'iobase1' and the address in PCI bar 3 is saved in the comedi_device as the 'iobase'. The 'iobase' is the base address of the daq registers (ai/ao) of the board. The 'iobase1' address is the base address of the 8255, 8254, configuration, and interrupt registers. Flip the saving of these base addresses. Save the address from PCI bar 2 in the comedi_device 'iobase' and the address from PCI bar 3 in the private data as 'daqio'. This will help with some cleanup of the 8255 module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/amplc_pci230.c | 161 -- 1 file changed, 77 insertions(+), 84 deletions(-) diff --git a/drivers/staging/comedi/drivers/amplc_pci230.c b/drivers/staging/comedi/drivers/amplc_pci230.c index 99f7694..c9940e6 100644 --- a/drivers/staging/comedi/drivers/amplc_pci230.c +++ b/drivers/staging/comedi/drivers/amplc_pci230.c @@ -513,8 +513,8 @@ struct pci230_private { spinlock_t res_spinlock;/* Shared resources spin lock */ spinlock_t ai_stop_spinlock;/* Spin lock for stopping AI command */ spinlock_t ao_stop_spinlock;/* Spin lock for stopping AO command */ + unsigned long daqio;/* PCI230's DAQ I/O space */ unsigned long state;/* State flags */ - unsigned long iobase1; /* PCI230's I/O space 1 */ unsigned int ao_readback[2];/* Used for AO readback */ unsigned int ai_scan_count; /* Number of AI scans remaining */ unsigned int ai_scan_pos; /* Current position within AI scan */ @@ -579,7 +579,7 @@ static unsigned short pci230_ai_read(struct comedi_device *dev) unsigned short data; /* Read sample. */ - data = inw(dev->iobase + PCI230_ADCDATA); + data = inw(devpriv->daqio + PCI230_ADCDATA); /* * PCI230 is 12 bit - stored in upper bits of 16 bit register * (lower four bits reserved for expansion). PCI230+ is 16 bit AI. @@ -628,7 +628,7 @@ static inline void pci230_ao_write_nofifo(struct comedi_device *dev, /* Write mangled datum to appropriate DACOUT register. */ outw(pci230_ao_mangle_datum(dev, datum), -dev->iobase + (((chan) == 0) ? PCI230_DACOUT1 : PCI230_DACOUT2)); +devpriv->daqio + ((chan) == 0) ? PCI230_DACOUT1 : PCI230_DACOUT2); } static inline void pci230_ao_write_fifo(struct comedi_device *dev, @@ -641,7 +641,7 @@ static inline void pci230_ao_write_fifo(struct comedi_device *dev, /* Write mangled datum to appropriate DACDATA register. */ outw(pci230_ao_mangle_datum(dev, datum), -dev->iobase + PCI230P2_DACDATA); +devpriv->daqio + PCI230P2_DACDATA); } static int get_resources(struct comedi_device *dev, unsigned int res_mask, @@ -770,29 +770,25 @@ static void pci230_ct_setup_ns_mode(struct comedi_device *dev, unsigned int ct, unsigned int mode, uint64_t ns, unsigned int flags) { - struct pci230_private *devpriv = dev->private; unsigned int clk_src; unsigned int count; /* Set mode. */ - i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, mode); + i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, mode); /* Determine clock source and count. */ clk_src = pci230_choose_clk_count(ns, &count, flags); /* Program clock source. */ - outb(CLK_CONFIG(ct, clk_src), devpriv->iobase1 + PCI230_ZCLK_SCE); + outb(CLK_CONFIG(ct, clk_src), dev->iobase + PCI230_ZCLK_SCE); /* Set initial count. */ if (count >= 65536) count = 0; - i8254_write(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, count); + i8254_write(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, count); } static void pci230_cancel_ct(struct comedi_device *dev, unsigned int ct) { - struct pci230_private *devpriv = dev->private; - - i8254_set_mode(devpriv->iobase1 + PCI230_Z2_CT_BASE, 0, ct, - I8254_MODE1); + i8254_set_mode(dev->iobase + PCI230_Z2_CT_BASE, 0, ct, I8254_MODE1); /* Counter ct, 8254 mode 1, initial count not written. */ } @@ -801,9 +797,10 @@ static int pci230_ai_eoc(struct comedi_device *dev, struct comedi_insn *insn, unsigned long context) { + struct pci230_private *devpriv = dev->private; unsigned int status; - status = inw(dev->iobase + PCI230_ADCCON); + status = inw(devpriv->daqio + PCI230_ADCCON); if ((status & PCI230_ADC_FIFO_EMPTY) == 0) return 0; return -EBUSY; @@ -842,7 +839,7 @@ static int pci230_ai_rinsn(struct comedi_device *dev, */ adccon = PCI230_ADC_TRIG_
[PATCH 02/15] staging: comedi: cb_pcimdas: refactor iobase addresses
This driver uses three iobase addresses, found in PCI bars 2, 3, and 4. Currently, the address in PCI bar 2 is saved in the comedi_device as the 'iobase', the PCI bar 3 address is saved in the private data as 'BADR3' and the one in PCI bar 4 is just passed to subdev_8255_init() as the 'iobase' parameter. Flip the saving of the PCI bar 2 and 4 base addresses. Save the address from PCI bar 2 in the private data as the 'daqio' and the address from PCI bar 4 in the comedi_device as the 'iobase'. This will help with some cleanup of the 8255 module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcimdas.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcimdas.c b/drivers/staging/comedi/drivers/cb_pcimdas.c index 765e0a0..20748b5 100644 --- a/drivers/staging/comedi/drivers/cb_pcimdas.c +++ b/drivers/staging/comedi/drivers/cb_pcimdas.c @@ -77,6 +77,7 @@ See http://www.mccdaq.com/PDFs/Manuals/pcim-das1602-16.pdf for more details. */ struct cb_pcimdas_private { /* base addresses */ + unsigned long daqio; unsigned long BADR3; /* Used for AO readback */ @@ -143,7 +144,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, /* convert n samples */ for (n = 0; n < insn->n; n++) { /* trigger conversion */ - outw(0, dev->iobase + 0); + outw(0, devpriv->daqio + 0); /* wait for conversion to end */ ret = comedi_timeout(dev, s, insn, cb_pcimdas_ai_eoc, 0); @@ -151,7 +152,7 @@ static int cb_pcimdas_ai_rinsn(struct comedi_device *dev, return ret; /* read data */ - data[n] = inw(dev->iobase + 0); + data[n] = inw(devpriv->daqio + 0); } /* return the number of samples read/written */ @@ -171,10 +172,10 @@ static int cb_pcimdas_ao_winsn(struct comedi_device *dev, for (i = 0; i < insn->n; i++) { switch (chan) { case 0: - outw(data[i] & 0x0FFF, dev->iobase + DAC0_OFFSET); + outw(data[i] & 0x0FFF, devpriv->daqio + DAC0_OFFSET); break; case 1: - outw(data[i] & 0x0FFF, dev->iobase + DAC1_OFFSET); + outw(data[i] & 0x0FFF, devpriv->daqio + DAC1_OFFSET); break; default: return -1; @@ -208,7 +209,6 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, struct pci_dev *pcidev = comedi_to_pci_dev(dev); struct cb_pcimdas_private *devpriv; struct comedi_subdevice *s; - unsigned long iobase_8255; int ret; devpriv = comedi_alloc_devpriv(dev, sizeof(*devpriv)); @@ -219,9 +219,9 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, if (ret) return ret; - dev->iobase = pci_resource_start(pcidev, 2); + devpriv->daqio = pci_resource_start(pcidev, 2); devpriv->BADR3 = pci_resource_start(pcidev, 3); - iobase_8255 = pci_resource_start(pcidev, 4); + dev->iobase = pci_resource_start(pcidev, 4); ret = comedi_alloc_subdevices(dev, 3); if (ret) @@ -252,7 +252,7 @@ static int cb_pcimdas_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; /* digital i/o subdevice */ - ret = subdev_8255_init(dev, s, NULL, iobase_8255); + ret = subdev_8255_init(dev, s, NULL, dev->iobase); if (ret) return ret; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 03/15] staging: comedi: cb_pcidda: refactor iobase addresses
This driver uses two iobase addresses, found in PCI bars 2 and 3. Currently, the address in PCI bar 3 is saved in the comedi_device as the 'iobase' and the one in PCI bar 2 is just passed to subdev_8255_init() as the 'iobase' parameter. Save the PCI bar 3 address in the private data as 'daqio' and the address from PCI bar 2 in the comedi_device as the 'iobase'. This will help with some cleanup of the 8255 module. Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/cb_pcidda.c | 27 +++ 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/drivers/staging/comedi/drivers/cb_pcidda.c b/drivers/staging/comedi/drivers/cb_pcidda.c index bbec7529..d9a1234 100644 --- a/drivers/staging/comedi/drivers/cb_pcidda.c +++ b/drivers/staging/comedi/drivers/cb_pcidda.c @@ -154,6 +154,7 @@ static const struct cb_pcidda_board cb_pcidda_boards[] = { }; struct cb_pcidda_private { + unsigned long daqio; /* bits last written to da calibration register 1 */ unsigned int dac_cal1_bits; /* current range settings for output channels */ @@ -164,13 +165,14 @@ struct cb_pcidda_private { /* lowlevel read from eeprom */ static unsigned int cb_pcidda_serial_in(struct comedi_device *dev) { + struct cb_pcidda_private *devpriv = dev->private; unsigned int value = 0; int i; const int value_width = 16; /* number of bits wide values are */ for (i = 1; i <= value_width; i++) { /* read bits most significant bit first */ - if (inw_p(dev->iobase + DACALIBRATION1) & SERIAL_OUT_BIT) + if (inw_p(devpriv->daqio + DACALIBRATION1) & SERIAL_OUT_BIT) value |= 1 << (value_width - i); } @@ -190,7 +192,7 @@ static void cb_pcidda_serial_out(struct comedi_device *dev, unsigned int value, devpriv->dac_cal1_bits |= SERIAL_IN_BIT; else devpriv->dac_cal1_bits &= ~SERIAL_IN_BIT; - outw_p(devpriv->dac_cal1_bits, dev->iobase + DACALIBRATION1); + outw_p(devpriv->dac_cal1_bits, devpriv->daqio + DACALIBRATION1); } } @@ -198,6 +200,7 @@ static void cb_pcidda_serial_out(struct comedi_device *dev, unsigned int value, static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev, unsigned int address) { + struct cb_pcidda_private *devpriv = dev->private; unsigned int i; unsigned int cal2_bits; unsigned int value; @@ -213,7 +216,7 @@ static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev, /* deactivate caldacs (one caldac for every two channels) */ for (i = 0; i < max_num_caldacs; i++) cal2_bits |= DESELECT_CALDAC_BIT(i); - outw_p(cal2_bits, dev->iobase + DACALIBRATION2); + outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2); /* tell eeprom we want to read */ cb_pcidda_serial_out(dev, read_instruction, instruction_length); @@ -224,7 +227,7 @@ static unsigned int cb_pcidda_read_eeprom(struct comedi_device *dev, /* deactivate eeprom */ cal2_bits &= ~SELECT_EEPROM_BIT; - outw_p(cal2_bits, dev->iobase + DACALIBRATION2); + outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2); return value; } @@ -234,6 +237,7 @@ static void cb_pcidda_write_caldac(struct comedi_device *dev, unsigned int caldac, unsigned int channel, unsigned int value) { + struct cb_pcidda_private *devpriv = dev->private; unsigned int cal2_bits; unsigned int i; /* caldacs use 3 bit channel specification */ @@ -256,10 +260,10 @@ static void cb_pcidda_write_caldac(struct comedi_device *dev, cal2_bits |= DESELECT_CALDAC_BIT(i); /* activate the caldac we want */ cal2_bits &= ~DESELECT_CALDAC_BIT(caldac); - outw_p(cal2_bits, dev->iobase + DACALIBRATION2); + outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2); /* deactivate caldac */ cal2_bits |= DESELECT_CALDAC_BIT(caldac); - outw_p(cal2_bits, dev->iobase + DACALIBRATION2); + outw_p(cal2_bits, devpriv->daqio + DACALIBRATION2); } /* set caldacs to eeprom values for given channel and range */ @@ -324,9 +328,9 @@ static int cb_pcidda_ao_insn_write(struct comedi_device *dev, if (range > 2) ctrl |= CB_DDA_DA_CTRL_UNIP; - outw(ctrl, dev->iobase + CB_DDA_DA_CTRL_REG); + outw(ctrl, devpriv->daqio + CB_DDA_DA_CTRL_REG); - outw(data[0], dev->iobase + CB_DDA_DA_DATA_REG(channel)); + outw(data[0], devpriv->daqio + CB_DDA_DA_DATA_REG(channel)); return insn->n; } @@ -338,7 +342,6 @@ static int cb_pcidda_auto_attach(struct comedi_device *dev, const struct cb_pcidda_board *thisboard = NULL;
[PATCH 08/15] staging: comedi: ni_labpc: tidy up daqboard2000_8255_cb()
The 8255 driver (*io) callback now includes the comedi_device pointer. Using this we can get the ioremap'ed base address. Instead of passing the (cast) mmio address to subdev_8255_init(), pass the 'iobase' of the 8255 registers (dioP2ExpansionIO8Bit). Signed-off-by: H Hartley Sweeten Cc: Ian Abbott Cc: Greg Kroah-Hartman --- drivers/staging/comedi/drivers/daqboard2000.c | 10 -- 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/drivers/staging/comedi/drivers/daqboard2000.c b/drivers/staging/comedi/drivers/daqboard2000.c index 9e7f90b..dbede9e 100644 --- a/drivers/staging/comedi/drivers/daqboard2000.c +++ b/drivers/staging/comedi/drivers/daqboard2000.c @@ -653,15 +653,13 @@ static void daqboard2000_initializeDac(struct comedi_device *dev) static int daqboard2000_8255_cb(struct comedi_device *dev, int dir, int port, int data, - unsigned long ioaddr) + unsigned long iobase) { - void __iomem *mmio_base = (void __iomem *)ioaddr; - if (dir) { - writew(data, mmio_base + port * 2); + writew(data, dev->mmio + iobase + port * 2); return 0; } - return readw(mmio_base + port * 2); + return readw(dev->mmio + iobase + port * 2); } static const void *daqboard2000_find_boardinfo(struct comedi_device *dev, @@ -745,7 +743,7 @@ static int daqboard2000_auto_attach(struct comedi_device *dev, s = &dev->subdevices[2]; result = subdev_8255_init(dev, s, daqboard2000_8255_cb, - (unsigned long)(dev->mmio + dioP2ExpansionIO8Bit)); + dioP2ExpansionIO8Bit); if (result) return result; -- 2.0.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[GIT PULL] Staging driver fixes for 3.16-rc8
The following changes since commit 9a3c4145af32125c5ee39c0272662b47307a8323: Linux 3.16-rc6 (2014-07-20 21:04:16 -0700) are available in the git repository at: git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git/ tags/staging-3.16-rc8 for you to fetch changes up to 4aa0abed3a2a11b7d71ad560c1a3e7631c5a31cd: staging: vt6655: Fix disassociated messages every 10 seconds (2014-07-24 15:10:42 -0700) Staging driver bugfixes for 3.16-rc8 Here are some tiny staging driver bugfixes that I've had in my tree for the past week that resolve some reported issues. Nothing major at all, but it would be good to get them merged for 3.16-rc8 or -final. Signed-off-by: Greg Kroah-Hartman Greg Kroah-Hartman (1): Merge tag 'iio-fixes-for-3.16e' of git://git.kernel.org/.../jic23/iio into staging-linus Jes Sorensen (1): staging: rtl8723au: rtw_resume(): release semaphore before exit on error Lars-Peter Clausen (1): iio: buffer: Fix demux table creation Malcolm Priestley (2): staging: vt6655: Fix Warning on boot handle_irq_event_percpu. staging: vt6655: Fix disassociated messages every 10 seconds Peter Meerwald (2): iio:bma180: Fix scale factors to report correct acceleration units iio:bma180: Missing check for frequency fractional part drivers/iio/accel/bma180.c | 8 +--- drivers/iio/industrialio-buffer.c | 2 +- drivers/staging/rtl8723au/os_dep/usb_intf.c | 4 +++- drivers/staging/vt6655/bssdb.c | 2 +- drivers/staging/vt6655/device_main.c| 7 +-- 5 files changed, 15 insertions(+), 8 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/6] staging: rtl8192u: remove define always set USE_ONE_PIPE
Also remove the code previously under #ifndef USE_ONE_PIPE. Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/Makefile | 1 - drivers/staging/rtl8192u/r8192U_core.c | 19 --- 2 files changed, 20 deletions(-) diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index eefc657..a3a7e3f 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -8,7 +8,6 @@ ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO #ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE #ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT -ccflags-y += -DUSE_ONE_PIPE ccflags-y += -Idrivers/staging/rtl8192u/ieee80211 r8192u_usb-y := r8192U_core.o r8180_93cx6.o r8192U_wx.o\ diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index ccf00f7..17642b7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1543,15 +1543,6 @@ u16 N_DBPSOfRate(u16 DataRate) return N_DBPS; } -unsigned int txqueue2outpipe(struct r8192_priv *priv, unsigned int tx_queue) -{ - if (tx_queue >= 9) { - RT_TRACE(COMP_ERR, "%s():Unknown queue ID!!!\n", __func__); - return 0x04; - } - return priv->txqueue_to_outpipemap[tx_queue]; -} - short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -1581,12 +1572,7 @@ short rtl819xU_tx_cmd(struct net_device *dev, struct sk_buff *skb) // // Fill up USB_OUT_CONTEXT. // - // Get index to out pipe from specified QueueID. -#ifndef USE_ONE_PIPE - idx_pipe = txqueue2outpipe(priv, queue_index); -#else idx_pipe = 0x04; -#endif usb_fill_bulk_urb(tx_urb, priv->udev, usb_sndbulkpipe(priv->udev, idx_pipe), skb->data, skb->len, rtl8192_tx_isr, skb); @@ -1915,12 +1901,7 @@ short rtl8192_tx(struct net_device *dev, struct sk_buff *skb) //DWORD 2 tx_desc->TxBufferSize = (u32)(skb->len - USB_HWDESC_HEADER_LEN); } - /* Get index to out pipe from specified QueueID */ -#ifndef USE_ONE_PIPE - idx_pipe = txqueue2outpipe(priv, tcb_desc->queue_index); -#else idx_pipe = 0x5; -#endif /* To submit bulk urb */ usb_fill_bulk_urb(tx_urb, udev, -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/6] staging: rtl8192u: remove misc. unused defines
Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/r8192U_core.c | 21 - 1 file changed, 21 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 0f59605..4f3fa35 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -56,27 +56,6 @@ double __extendsfdf2(float a) } #endif -#undef DUMP_RX -#undef DUMP_TX -#undef DEBUG_TX_DESC2 -#undef RX_DONT_PASS_UL -#undef DEBUG_RX_VERBOSE -#undef DUMMY_RX -#undef DEBUG_ZERO_RX -#undef DEBUG_RX_SKB -#undef DEBUG_TX_FRAG -#undef DEBUG_RX_FRAG -#undef DEBUG_TX_FILLDESC -#undef DEBUG_TX -#undef DEBUG_IRQ -#undef DEBUG_RX -#undef DEBUG_RXALLOC -#undef DEBUG_REGISTERS -#undef DEBUG_RING -#undef DEBUG_IRQ_TASKLET -#undef DEBUG_TX_ALLOC -#undef DEBUG_TX_DESC - #define CONFIG_RTL8192_IO_MAP #include -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/6] staging: rtl8192u: remove unused define USB_RX_AGGREGATION_SUPPORT
Also remove related unreachable code. Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/Makefile | 1 - drivers/staging/rtl8192u/r8192U_core.c | 174 +++-- 2 files changed, 11 insertions(+), 164 deletions(-) diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index 416a05a..703c150 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -6,7 +6,6 @@ ccflags-y += -O2 ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO -#ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT ccflags-y += -Idrivers/staging/rtl8192u/ieee80211 r8192u_usb-y := r8192U_core.o r8180_93cx6.o r8192U_wx.o\ diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index fd7a2f3..bd15651 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -715,14 +715,8 @@ static void rtl8192_rx_isr(struct urb *urb); static u32 get_rxpacket_shiftbytes_819xusb(struct ieee80211_rx_stats *pstats) { -#ifdef USB_RX_AGGREGATION_SUPPORT - if (pstats->bisrxaggrsubframe) - return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize - + pstats->RxBufShift + 8); - else -#endif - return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize - + pstats->RxBufShift); + return (sizeof(rx_desc_819x_usb) + pstats->RxDrvInfoSize + + pstats->RxBufShift); } static int rtl8192_rx_initiate(struct net_device *dev) @@ -2796,22 +2790,6 @@ static bool rtl8192_adapter_start(struct net_device *dev) for (i = 0; i < QOS_QUEUE_NUM; i++) write_nic_dword(dev, WDCAPARA_ADD[i], DEFAULT_EDCA); } -#ifdef USB_RX_AGGREGATION_SUPPORT - //3 For usb rx firmware aggregation control - if (priv->ResetProgress == RESET_TYPE_NORESET) { - u32 ulValue; - PRT_HIGH_THROUGHPUT pHTInfo = priv->ieee80211->pHTInfo; - ulValue = (pHTInfo->UsbRxFwAggrEn<<24) | (pHTInfo->UsbRxFwAggrPageNum<<16) | - (pHTInfo->UsbRxFwAggrPacketNum<<8) | (pHTInfo->UsbRxFwAggrTimeout); - /* -* If usb rx firmware aggregation is enabled, -* when anyone of three threshold conditions above is reached, -* firmware will send aggregated packet to driver. -*/ - write_nic_dword(dev, 0x1a8, ulValue); - priv->bCurrentRxAggrEnable = true; - } -#endif rtl8192_phy_configmac(dev); @@ -4497,30 +4475,16 @@ static void query_rxdesc_status(struct sk_buff *skb, // //Get Rx Descriptor Information // -#ifdef USB_RX_AGGREGATION_SUPPORT - if (bIsRxAggrSubframe) { - rx_desc_819x_usb_aggr_subframe *desc = (rx_desc_819x_usb_aggr_subframe *)skb->data; - stats->Length = desc->Length; - stats->RxDrvInfoSize = desc->RxDrvInfoSize; - stats->RxBufShift = 0; //RxBufShift = 2 in RxDesc, but usb didn't shift bytes in fact. - stats->bICV = desc->ICV; - stats->bCRC = desc->CRC32; - stats->bHwError = stats->bCRC|stats->bICV; - stats->Decrypted = !desc->SWDec;//RTL8190 set this bit to indicate that Hw does not decrypt packet - } else -#endif - { - rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; + rx_desc_819x_usb *desc = (rx_desc_819x_usb *)skb->data; - stats->Length = desc->Length; - stats->RxDrvInfoSize = desc->RxDrvInfoSize; - stats->RxBufShift = 0; - stats->bICV = desc->ICV; - stats->bCRC = desc->CRC32; - stats->bHwError = stats->bCRC|stats->bICV; - //RTL8190 set this bit to indicate that Hw does not decrypt packet - stats->Decrypted = !desc->SWDec; - } + stats->Length = desc->Length; + stats->RxDrvInfoSize = desc->RxDrvInfoSize; + stats->RxBufShift = 0; + stats->bICV = desc->ICV; + stats->bCRC = desc->CRC32; + stats->bHwError = stats->bCRC|stats->bICV; + /* RTL8190 set this bit to indicate that Hw does not decrypt packet */ + stats->Decrypted = !desc->SWDec; if ((priv->ieee80211->pHTInfo->bCurrentHTSupport == true) && (priv->ieee80211->pairwise_key_type == KEY_TYPE_CCMP)) stats->bHwError = false; @@ -4585,11 +4549,6 @@ static void query_rxdesc_status(struct sk_buff *skb, skb_pull(skb, stats->RxBufShift + stats->RxDrvInfoSize); } -#ifdef USB_RX_AGGREGATION_SUPPORT - /* for the rx aggregated sub frame, the redundant space truly contained in the packet */ - if (bIsRxAggrSubframe)
[PATCH 3/6] staging: rtl8192u: remove unused define USB_TX_DRIVER_AGGREGATION_ENABLE
Also remove the unreachable code. Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/Makefile | 1 - drivers/staging/rtl8192u/r8192U_core.c | 250 + 2 files changed, 4 insertions(+), 247 deletions(-) diff --git a/drivers/staging/rtl8192u/Makefile b/drivers/staging/rtl8192u/Makefile index a3a7e3f..416a05a 100644 --- a/drivers/staging/rtl8192u/Makefile +++ b/drivers/staging/rtl8192u/Makefile @@ -6,7 +6,6 @@ ccflags-y += -O2 ccflags-y += -DCONFIG_FORCE_HARD_FLOAT=y ccflags-y += -DJACKSON_NEW_8187 -DJACKSON_NEW_RX ccflags-y += -DTHOMAS_BEACON -DTHOMAS_TASKLET -DTHOMAS_SKB -DTHOMAS_TURBO -#ccflags-y += -DUSB_TX_DRIVER_AGGREGATION_ENABLE #ccflags-y += -DUSB_RX_AGGREGATION_SUPPORT ccflags-y += -Idrivers/staging/rtl8192u/ieee80211 diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 17642b7..fd7a2f3 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -1036,194 +1036,6 @@ static int rtl8192_hard_start_xmit(struct sk_buff *skb, struct net_device *dev) void rtl8192_try_wake_queue(struct net_device *dev, int pri); -#ifdef USB_TX_DRIVER_AGGREGATION_ENABLE -u16 DrvAggr_PaddingAdd(struct net_device *dev, struct sk_buff *skb) -{ - u16 PaddingNum = 256 - ((skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES) % 256); - return PaddingNum & 0xff; -} - -u8 MRateToHwRate8190Pci(u8 rate); -u8 QueryIsShort(u8 TxHT, u8 TxRate, cb_desc *tcb_desc); -u8 MapHwQueueToFirmwareQueue(u8 QueueID); -struct sk_buff *DrvAggr_Aggregation(struct net_device *dev, struct ieee80211_drv_agg_txb *pSendList) -{ - struct ieee80211_device *ieee = netdev_priv(dev); - struct r8192_priv *priv = ieee80211_priv(dev); - cb_desc *tcb_desc = NULL; - u8 i; - u32 TotalLength; - struct sk_buff *skb; - struct sk_buff *agg_skb; - tx_desc_819x_usb_aggr_subframe *tx_agg_desc = NULL; - tx_fwinfo_819x_usb *tx_fwinfo = NULL; - - // - // Local variable initialization. - // - /* first skb initialization */ - skb = pSendList->tx_agg_frames[0]; - TotalLength = skb->len; - - /* Get the total aggregation length including the padding space and -* sub frame header. -*/ - for (i = 1; i < pSendList->nr_drv_agg_frames; i++) { - TotalLength += DrvAggr_PaddingAdd(dev, skb); - skb = pSendList->tx_agg_frames[i]; - TotalLength += (skb->len + TX_PACKET_DRVAGGR_SUBFRAME_SHIFT_BYTES); - } - - /* allocate skb to contain the aggregated packets */ - agg_skb = dev_alloc_skb(TotalLength + ieee->tx_headroom); - memset(agg_skb->data, 0, agg_skb->len); - skb_reserve(agg_skb, ieee->tx_headroom); - - /* reserve info for first subframe Tx descriptor to be set in the tx function */ - skb = pSendList->tx_agg_frames[0]; - tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - tcb_desc->drv_agg_enable = 1; - tcb_desc->pkt_size = skb->len; - tcb_desc->DrvAggrNum = pSendList->nr_drv_agg_frames; - netdev_dbg(dev, "DrvAggNum = %d\n", tcb_desc->DrvAggrNum); - memcpy(agg_skb->cb, skb->cb, sizeof(skb->cb)); - memcpy(skb_put(agg_skb, skb->len), skb->data, skb->len); - - for (i = 1; i < pSendList->nr_drv_agg_frames; i++) { - /* push the next sub frame to be 256 byte aline */ - skb_put(agg_skb, DrvAggr_PaddingAdd(dev, skb)); - - /* Subframe drv Tx descriptor and firmware info setting */ - skb = pSendList->tx_agg_frames[i]; - tcb_desc = (cb_desc *)(skb->cb + MAX_DEV_ADDR_SIZE); - tx_agg_desc = (tx_desc_819x_usb_aggr_subframe *)skb_tail_pointer(agg_skb); - tx_fwinfo = (tx_fwinfo_819x_usb *)(skb_tail_pointer(agg_skb) + sizeof(tx_desc_819x_usb_aggr_subframe)); - - memset(tx_fwinfo, 0, sizeof(tx_fwinfo_819x_usb)); - /* DWORD 0 */ - tx_fwinfo->TxHT = (tcb_desc->data_rate&0x80) ? 1 : 0; - tx_fwinfo->TxRate = MRateToHwRate8190Pci(tcb_desc->data_rate); - tx_fwinfo->EnableCPUDur = tcb_desc->bTxEnableFwCalcDur; - tx_fwinfo->Short = QueryIsShort(tx_fwinfo->TxHT, tx_fwinfo->TxRate, tcb_desc); - if (tcb_desc->bAMPDUEnable) { /* AMPDU enabled */ - tx_fwinfo->AllowAggregation = 1; - /* DWORD 1 */ - tx_fwinfo->RxMF = tcb_desc->ampdu_factor; - tx_fwinfo->RxAMD = tcb_desc->ampdu_density&0x07;//ampdudensity - } else { - tx_fwinfo->AllowAggregation = 0; - /* DWORD 1 */ - tx_fwinfo->RxMF = 0; - tx_fwinfo->RxAMD = 0; - } - - /* Protection mode rel
[PATCH 5/6] staging: rtl8192u: remove unused define LOOP_TEST
Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/r8192U_core.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index bd15651..0f59605 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -56,7 +56,6 @@ double __extendsfdf2(float a) } #endif -#undef LOOP_TEST #undef DUMP_RX #undef DUMP_TX #undef DEBUG_TX_DESC2 @@ -701,13 +700,11 @@ void rtl8192_set_chan(struct net_device *dev, short ch) /* this hack should avoid frame TX during channel setting*/ -#ifndef LOOP_TEST //need to implement rf set channel here WB if (priv->rf_set_chan) priv->rf_set_chan(dev, priv->chan); mdelay(10); -#endif } static void rtl8192_rx_isr(struct urb *urb); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/6] staging: rtl8192u: remove unused define DEBUG_EPROM
Also remove the code now unreachable. Signed-off-by: Antoine Schweitzer-Chaput --- drivers/staging/rtl8192u/r8192U_core.c | 13 - 1 file changed, 13 deletions(-) diff --git a/drivers/staging/rtl8192u/r8192U_core.c b/drivers/staging/rtl8192u/r8192U_core.c index 7640386..ccf00f7 100644 --- a/drivers/staging/rtl8192u/r8192U_core.c +++ b/drivers/staging/rtl8192u/r8192U_core.c @@ -61,7 +61,6 @@ double __extendsfdf2(float a) #undef DUMP_TX #undef DEBUG_TX_DESC2 #undef RX_DONT_PASS_UL -#undef DEBUG_EPROM #undef DEBUG_RX_VERBOSE #undef DUMMY_RX #undef DEBUG_ZERO_RX @@ -665,15 +664,6 @@ static void tx_timeout(struct net_device *dev) schedule_work(&priv->reset_wq); } - -/* this is only for debug */ -void dump_eprom(struct net_device *dev) -{ - int i; - for (i = 0; i < 63; i++) - RT_TRACE(COMP_EPROM, "EEPROM addr %x : %x", i, eprom_read(dev, i)); -} - void rtl8192_update_msr(struct net_device *dev) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -2869,9 +2859,6 @@ static short rtl8192_init(struct net_device *dev) return -ENOMEM; } -#ifdef DEBUG_EPROM - dump_eprom(dev); -#endif return 0; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/1] Drivers: net-next: hyperv: Increase the size of the sendbuf region
Don't explain things to me in this thread. Instead, tell the whole world and everyone who would ever see this commit, in the commit log message. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
劳动法与员工关系管理实战
51h 新《劳动合同法》、《社会保险法》、《工伤保险条例》实操应对策略 ARVFKVTE 防范用工风险和化解劳动争议的技能.txt Description: Binary data ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel