Re: [PATCH v4 3/3] memstick: Add realtek USB memstick host driver
On 02/12/2014 06:00 PM, rogera...@realtek.com wrote: From: Roger Tseng rogera...@realtek.com Realtek USB memstick host driver provides memstick host support based on the Realtek USB card reader MFD driver. Signed-off-by: Roger Tseng rogera...@realtek.com Andrew, Would you please Ack or comment this patch(3/3) to let the 3 patches be merged together? I have been making the same request at the message thread of [PATCH v4 2/3] since several weeks ago but got no response. Thus I re-post here and hope I could get something. Best regards, Roger Tseng --- drivers/memstick/host/Kconfig | 10 + drivers/memstick/host/Makefile | 1 + drivers/memstick/host/rtsx_usb_ms.c | 836 3 files changed, 847 insertions(+) create mode 100644 drivers/memstick/host/rtsx_usb_ms.c diff --git a/drivers/memstick/host/Kconfig b/drivers/memstick/host/Kconfig index 1b37cf8..7310e32 100644 --- a/drivers/memstick/host/Kconfig +++ b/drivers/memstick/host/Kconfig @@ -52,3 +52,13 @@ config MEMSTICK_REALTEK_PCI To compile this driver as a module, choose M here: the module will be called rtsx_pci_ms. + +config MEMSTICK_REALTEK_USB + tristate Realtek USB Memstick Card Interface Driver + depends on MFD_RTSX_USB + help + Say Y here to include driver code to support Memstick card interface + of Realtek RTS5129/39 series USB card reader + + To compile this driver as a module, choose M here: the module will + be called rts5139_ms. diff --git a/drivers/memstick/host/Makefile b/drivers/memstick/host/Makefile index af3459d..491c955 100644 --- a/drivers/memstick/host/Makefile +++ b/drivers/memstick/host/Makefile @@ -6,3 +6,4 @@ obj-$(CONFIG_MEMSTICK_TIFM_MS) += tifm_ms.o obj-$(CONFIG_MEMSTICK_JMICRON_38X)+= jmb38x_ms.o obj-$(CONFIG_MEMSTICK_R592) += r592.o obj-$(CONFIG_MEMSTICK_REALTEK_PCI)+= rtsx_pci_ms.o +obj-$(CONFIG_MEMSTICK_REALTEK_USB) += rtsx_usb_ms.o diff --git a/drivers/memstick/host/rtsx_usb_ms.c b/drivers/memstick/host/rtsx_usb_ms.c new file mode 100644 index 000..eb4c75d --- /dev/null +++ b/drivers/memstick/host/rtsx_usb_ms.c @@ -0,0 +1,836 @@ +/* Realtek USB Memstick Card Interface driver + * + * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved. + * + * This program is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 + * as published by the Free Software Foundation. + * + * This program is distributed in the hope that it will be useful, but + * WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * General Public License for more details. + * + * You should have received a copy of the GNU General Public License along + * with this program; if not, see http://www.gnu.org/licenses/. + * + * Author: + * Roger Tseng rogera...@realtek.com + */ + +#include linux/module.h +#include linux/highmem.h +#include linux/delay.h +#include linux/platform_device.h +#include linux/workqueue.h +#include linux/memstick.h +#include linux/kthread.h +#include linux/mfd/rtsx_usb.h +#include linux/pm_runtime.h +#include asm/unaligned.h + +struct rtsx_usb_ms { + struct platform_device *pdev; + struct rtsx_ucr *ucr; + struct memstick_host*msh; + struct memstick_request *req; + + struct mutexhost_mutex; + struct work_struct handle_req; + + struct task_struct *detect_ms; + struct completion detect_ms_exit; + + u8 ssc_depth; + unsigned intclock; + int power_mode; + unsigned char ifmode; + booleject; +}; + +static inline struct device *ms_dev(struct rtsx_usb_ms *host) +{ + return (host-pdev-dev); +} + +static inline void ms_clear_error(struct rtsx_usb_ms *host) +{ + struct rtsx_ucr *ucr = host-ucr; + rtsx_usb_ep0_write_register(ucr, CARD_STOP, + MS_STOP | MS_CLR_ERR, + MS_STOP | MS_CLR_ERR); + + rtsx_usb_clear_dma_err(ucr); + rtsx_usb_clear_fsm_err(ucr); +} + +#ifdef DEBUG + +static void ms_print_debug_regs(struct rtsx_usb_ms *host) +{ + struct rtsx_ucr *ucr = host-ucr; + u16 i; + u8 *ptr; + + /* Print MS host internal registers */ + rtsx_usb_init_cmd(ucr); + + /* MS_CFG to MS_INT_REG */ + for (i = 0xFD40; i = 0xFD44; i++) + rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0); + + /* CARD_SHARE_MODE to CARD_GPIO */ + for (i = 0xFD51; i = 0xFD56; i++) + rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0); + + /* CARD_PULL_CTLx */ + for (i = 0xFD60; i = 0xFD65; i++) + rtsx_usb_add_cmd(ucr, READ_REG_CMD, i, 0, 0); + + /* CARD_DATA_SOURCE,
RE: [PATCH] staging: octeon-usb: prevent memory corruption
From: Aaro Koskinen octeon-hcd will crash the kernel when SLOB is used. This usually happens after the 18-byte control transfer when a device descriptor is read. The DMA engine is always transfering full 32-bit words and if the transfer is shorter, some random garbage appears after the buffer. The problem is not visible with SLUB since it rounds up the allocations to word boundary, and the extra bytes will go undetected. Fix by providing quirk functions for DMA map/unmap that allocate a bigger temporary buffer when necessary. Tested by booting EdgeRouter Lite to USB stick root file system with SLAB, SLOB and SLUB kernels. Wouldn't it be simpler to just round up the existing allocation? (With a comment that some DMA controllers write whole words.) David ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/2] coding style: fix quoted string split across lines
On Wed, 2014-03-19 at 23:04 +0100, Cédric Cabessa wrote: [] diff --git a/drivers/staging/usbip/usbip_common.c b/drivers/staging/usbip/usbip_common.c [] @@ -178,8 +178,8 @@ static void usbip_dump_usb_ctrlrequest(struct usb_ctrlrequest *cmd) } pr_debug( ); - pr_debug(bRequestType(%02X) bRequest(%02X) wValue(%04X) wIndex(%04X) - wLength(%04X) , cmd-bRequestType, cmd-bRequest, + pr_debug(bRequestType(%02X) bRequest(%02X) wValue(%04X) wIndex(%04X) wLength(%04X) , + cmd-bRequestType, cmd-bRequest, cmd-wValue, cmd-wIndex, cmd-wLength); pr_debug(\n ); While you didn't change it, these uses are broken. pr_debug always starts a new line so the continuations attempted in this block don't work. Likely this was originally converted from some non pr_debug mechanism without an understanding of how pr_debug varies from a normal printf. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [RFC PATCH] staging: imx-drm: add suspend / resume
Hi Martin, On Thu, Mar 20, 2014 at 12:17 PM, Martin Fuzzey mfuz...@parkeon.com wrote: Currently i.MX53 boards with the imx-drm display driver active fail an intensive suspend to ram / resume test. After around 5 - 50 cycles it is no longer possible to resume the board. The culprit is the imx-drm driver which does not stop DMA before suspending. Removing the driver fixes the problem. This patch provides a minimal suspend / resume implementation enabling the intensive test to work (500 cycles ok). I am only sending this as RFC for the moment since I don't really know the hardware or driver code well enough to be sure this is the right way of doing it. Does this patch still cause the visual artifacts you mentioned earlier? Regards, Fabio Estevam Signed-off-by: Martin Fuzzey mfuz...@parkeon.com --- drivers/staging/imx-drm/ipu-v3/ipu-common.c | 47 +++ drivers/staging/imx-drm/ipu-v3/ipu-prv.h|1 + 2 files changed, 48 insertions(+) diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-common.c b/drivers/staging/imx-drm/ipu-v3/ipu-common.c index 97ca692..484a90a 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-common.c +++ b/drivers/staging/imx-drm/ipu-v3/ipu-common.c @@ -692,6 +692,8 @@ int ipu_idmac_enable_channel(struct ipuv3_channel *channel) val |= idma_mask(channel-num); ipu_idmac_write(ipu, val, IDMAC_CHA_EN(channel-num)); + channel-enabled = true; + spin_unlock_irqrestore(ipu-lock, flags); return 0; @@ -750,6 +752,8 @@ int ipu_idmac_disable_channel(struct ipuv3_channel *channel) val = ~idma_mask(channel-num); ipu_cm_write(ipu, val, IPU_CHA_DB_MODE_SEL(channel-num)); + channel-enabled = false; + spin_unlock_irqrestore(ipu-lock, flags); return 0; @@ -1245,10 +1249,53 @@ static int ipu_remove(struct platform_device *pdev) return 0; } +#ifdef CONFIG_PM_SLEEP + +static int ipu_suspend(struct device *dev) +{ + struct ipu_soc *ipu = dev_get_drvdata(dev); + struct ipuv3_channel *channel; + int i; + + channel = ipu-channel; + for (i = 0; i ARRAY_SIZE(ipu-channel); i++, channel++) { + channel-suspended = false; + if (channel-enabled) { + if (ipu_idmac_wait_busy(channel, 50)) + dev_warn(dev, + %s: Timeout channel %d idle\n, + __func__, i); + ipu_idmac_disable_channel(channel); + channel-suspended = true; + } + } + return 0; +} + +static int ipu_resume(struct device *dev) +{ + struct ipu_soc *ipu = dev_get_drvdata(dev); + struct ipuv3_channel *channel; + int i; + + channel = ipu-channel; + for (i = 0; i ARRAY_SIZE(ipu-channel); i++, channel++) { + if (channel-suspended) { + ipu_idmac_enable_channel(channel); + channel-suspended = false; + } + } + return 0; +} +#endif + +static SIMPLE_DEV_PM_OPS(ipu_pm_ops, ipu_suspend, ipu_resume); + static struct platform_driver imx_ipu_driver = { .driver = { .name = imx-ipuv3, .of_match_table = imx_ipu_dt_ids, + .pm = ipu_pm_ops, }, .probe = ipu_probe, .remove = ipu_remove, diff --git a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h index 4df0050..233749a 100644 --- a/drivers/staging/imx-drm/ipu-v3/ipu-prv.h +++ b/drivers/staging/imx-drm/ipu-v3/ipu-prv.h @@ -144,6 +144,7 @@ struct ipuv3_channel { bool enabled; bool busy; + bool suspended; struct ipu_soc *ipu; }; ___ linux-arm-kernel mailing list linux-arm-ker...@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/rtl8821ae: Fix OOM handling in _rtl_init_deferred_work()
alloc_workqueue() can fail, handle this case. Signed-off-by: Richard Weinberger rich...@nod.at --- drivers/staging/rtl8821ae/base.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8821ae/base.c b/drivers/staging/rtl8821ae/base.c index fce9c3f..8dbe13c 100644 --- a/drivers/staging/rtl8821ae/base.c +++ b/drivers/staging/rtl8821ae/base.c @@ -388,7 +388,7 @@ static void _rtl_init_mac80211(struct ieee80211_hw *hw) } -static void _rtl_init_deferred_work(struct ieee80211_hw *hw) +static int _rtl_init_deferred_work(struct ieee80211_hw *hw) { struct rtl_priv *rtlpriv = rtl_priv(hw); @@ -410,6 +410,9 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) rtlpriv-works.rtl_wq = create_workqueue(rtlpriv-cfg-name); #endif /*delete in kernel end*/ + if (!rtlpriv-works.rtl_wq) + return -ENOMEM; + INIT_DELAYED_WORK(rtlpriv-works.watchdog_wq, (void *)rtl_watchdog_wq_callback); INIT_DELAYED_WORK(rtlpriv-works.ips_nic_off_wq, @@ -421,6 +424,8 @@ static void _rtl_init_deferred_work(struct ieee80211_hw *hw) INIT_DELAYED_WORK(rtlpriv-works.fwevt_wq, (void *)rtl_fwevt_wq_callback); + return 0; + } void rtl_deinit_deferred_work(struct ieee80211_hw *hw) @@ -519,7 +524,8 @@ int rtl_init_core(struct ieee80211_hw *hw) INIT_LIST_HEAD(rtlpriv-entry_list); /* 6 init deferred work */ - _rtl_init_deferred_work(hw); + if (_rtl_init_deferred_work(hw)) + return 1; /* 7 */ #ifdef VIF_TODO -- 1.8.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: vt6655: Fix sparse-indicated type mismatch to kmalloc
Signed-off-by: Conrad Meyer cse@gmail.com --- Patch is against next-20140320. Fixes a minor sparse warning in the staging driver vt6655. p-length is u16; implicit cast to size_t is fine. No reason to cast GFP_KERNEL... --- drivers/staging/vt6655/wpactl.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/vt6655/wpactl.c b/drivers/staging/vt6655/wpactl.c index d17224f..c27ed5d 100644 --- a/drivers/staging/vt6655/wpactl.c +++ b/drivers/staging/vt6655/wpactl.c @@ -855,11 +855,11 @@ int wpa_ioctl(PSDevice pDevice, struct iw_point *p) if (p-length sizeof(struct viawget_wpa_param) || p-length VIAWGET_WPA_MAX_BUF_SIZE || !p-pointer) return -EINVAL; - param = kmalloc((int)p-length, (int)GFP_KERNEL); + param = kmalloc(p-length, GFP_KERNEL); if (param == NULL) return -ENOMEM; if (copy_from_user(param, p-pointer, p-length)) { ret = -EFAULT; -- 1.8.5.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/2] coding style: fix line over 80 characters
On 03/21/2014 12:34 AM, Sergei Shtylyov wrote: Signed-off-by: Cédric Cabessa c...@ryick.net --- drivers/staging/usbip/vhci_hcd.c | 33 ++--- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/drivers/staging/usbip/vhci_hcd.c b/drivers/staging/usbip/vhci_hcd.c index f690668..1e84577 100644 --- a/drivers/staging/usbip/vhci_hcd.c +++ b/drivers/staging/usbip/vhci_hcd.c [...] @@ -539,7 +546,9 @@ static int vhci_urb_enqueue(struct usb_hcd *hcd, struct urb *urb, default: /* NOT REACHED */ -dev_err(dev, invalid request to devnum 0 bRequest %u, wValue %u\n, ctrlreq-bRequest, +dev_err(dev, +invalid request to devnum 0 bRequest %u, wValue %u\n, +ctrlreq-bRequest, ctrlreq-wValue); ret = -EINVAL; goto no_need_xmit; @@ -1060,7 +1069,9 @@ static int vhci_hcd_suspend(struct platform_device *pdev, pm_message_t state) spin_unlock(the_controller-lock); if (connected 0) { -dev_info(pdev-dev, We have %d active connection%s. Do not suspend.\n, connected, (connected == 1 ? : s)); +dev_info(pdev-dev, + We have %d active connection%s. Do not suspend.\n, + connected, (connected == 1 ? : s)); ret = -EBUSY; } else { dev_info(pdev-dev, suspend vhci_hcd); Hm, I don't see checkpatch.pl complaints about these either in the 'usb-next' branch of Greg's tree. Sorry, I forgot about Greg's separate staging.git repo. The patch looks correct in this context. WBR, Sergei ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree
Replace kmalloc/kfree with OS_kmalloc/OS_kfree. And also some allocation doesn't need to use GFP_DMA so just use GFP_KERNEL. c4_new() function is never called, remove it. Signed-off-by: Daeseok Youn daeseok.y...@gmail.com --- I'm not sure what GFP_DMA use correctly for km{,z}alloc(). Please review this. And this patch has coding style issues. coding style issues will be fixed with another one. drivers/staging/cxt1e1/hwprobe.c |2 +- drivers/staging/cxt1e1/linux.c | 21 +-- drivers/staging/cxt1e1/musycc.c | 12 --- drivers/staging/cxt1e1/pmcc4_drv.c | 47 +- drivers/staging/cxt1e1/sbecom_inline_linux.h | 23 + drivers/staging/cxt1e1/sbecrc.c |5 ++- drivers/staging/cxt1e1/sbeproc.c |2 +- 7 files changed, 32 insertions(+), 80 deletions(-) diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c index 9b4198b..6e207f5 100644 --- a/drivers/staging/cxt1e1/hwprobe.c +++ b/drivers/staging/cxt1e1/hwprobe.c @@ -205,7 +205,7 @@ cleanup_devs(void) #ifdef CONFIG_SBE_PMCC4_NCOMM free_irq(hi-pdev[1]-irq, hi-ndev); #endif - OS_kfree(hi-ndev); + kfree(hi-ndev); } } diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c index b02f5ade..4b4609d 100644 --- a/drivers/staging/cxt1e1/linux.c +++ b/drivers/staging/cxt1e1/linux.c @@ -60,7 +60,6 @@ status_tc4_chan_work_init(mpi_t *, mch_t *); voidmusycc_wq_chan_restart(void *); status_t __init c4_init(ci_t *, u_char *, u_char *); status_t __init c4_init2(ci_t *); -ci_t *__init c4_new(void *); int __init c4hw_attach_all(void); void __init hdw_sn_get(hdw_info_t *, int); @@ -418,7 +417,7 @@ create_chan(struct net_device *ndev, ci_t *ci, struct c4_priv *priv; /* allocate then fill in private data structure */ - priv = OS_kmalloc(sizeof(struct c4_priv)); + priv = kzalloc(sizeof(struct c4_priv), GFP_KERNEL); if (!priv) { pr_warning(%s: no memory for net_device !\n, ci-devname); @@ -428,7 +427,7 @@ create_chan(struct net_device *ndev, ci_t *ci, if (!dev) { pr_warning(%s: no memory for hdlc_device !\n, ci-devname); - OS_kfree(priv); + kfree(priv); return NULL; } priv-ci = ci; @@ -972,8 +971,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, if (register_netdev(ndev) || (c4_init(ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) { - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -ENODEV; return NULL; } @@ -998,8 +997,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, pr_warning(%s: MUSYCC could not get irq: %d\n, ndev-name, irq0); unregister_netdev(ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -EIO; return NULL; } @@ -1008,8 +1007,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, pr_warning(%s: EBUS could not get irq: %d\n, hi-devname, irq1); unregister_netdev(ndev); free_irq(irq0, ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -EIO; return NULL; } @@ -1068,8 +1067,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, unregister_netdev(ndev); free_irq(irq1, ndev); free_irq(irq0, ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); /* failure, error_flag is set */ return NULL; } diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c index 7b4f6f2..c174f6d 100644 --- a/drivers/staging/cxt1e1/musycc.c +++ b/drivers/staging/cxt1e1/musycc.c @@ -744,7 +744,8 @@ musycc_init(ci_t *ci) #define INT_QUEUE_BOUNDARY 4 -regaddr = OS_kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t)); + regaddr = kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t), + GFP_KERNEL | GFP_DMA); if (!regaddr) return -ENOMEM; ci-iqd_p_saved = regaddr; /* save orig
Re: [PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree
On Fri, Mar 21, 2014 at 10:41:39AM +0900, Daeseok Youn wrote: Replace kmalloc/kfree with OS_kmalloc/OS_kfree. I think you mean this the other way around, right? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: cxt1e1: replace kmalloc/kfree with OS_kmalloc/OS_kfree
Yes. It was already noticed by Joe Perches. I will send it again. Thanks. Daeseok Youn. 2014-03-21 11:35 GMT+09:00, Greg KH gre...@linuxfoundation.org: On Fri, Mar 21, 2014 at 10:41:39AM +0900, Daeseok Youn wrote: Replace kmalloc/kfree with OS_kmalloc/OS_kfree. I think you mean this the other way around, right? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: bcm: CmHost: remove temp bracing from switch/cases.
Remove the temp bracing afixed to case labels. Properly indent switch/case breaks. Signed-off-by: Gary Alan Rookard garyrook...@gmail.com --- On branch staging-next drivers/staging/bcm/CmHost.c | 50 +++- 1 file changed, 7 insertions(+), 43 deletions(-) diff --git a/drivers/staging/bcm/CmHost.c b/drivers/staging/bcm/CmHost.c index 632f81a..4564c63 100644 --- a/drivers/staging/bcm/CmHost.c +++ b/drivers/staging/bcm/CmHost.c @@ -460,42 +460,30 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* Pointer BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, CopyToAdapter : u8CSSpecification : %X\n, psfLocalSet-u8CSSpecification); switch (psfLocalSet-u8CSSpecification) { case eCSPacketIPV4: - { Adapter-PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; break; - } case eCSPacketIPV6: - { Adapter-PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; break; - } case eCS802_3PacketEthernet: case eCS802_1QPacketVLAN: - { Adapter-PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; - } case eCSPacketIPV4Over802_1QVLAN: case eCSPacketIPV4Over802_3Ethernet: - { Adapter-PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; Adapter-PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; - } case eCSPacketIPV6Over802_1QVLAN: case eCSPacketIPV6Over802_3Ethernet: - { Adapter-PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV6_CS; Adapter-PackInfo[uiSearchRuleIndex].bEthCSSupport = ETH_CS_802_3; break; - } default: - { BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, Error in value of CS Classification.. setting default to IP CS\n); Adapter-PackInfo[uiSearchRuleIndex].bIPCSSupport = IPV4_CS; break; } - } BCM_DEBUG_PRINT(Adapter, DBG_TYPE_OTHERS, CONN_MSG, DBG_LVL_ALL, CopyToAdapter : Queue No : %X ETH CS Support : %X , IP CS Support : %X\n, uiSearchRuleIndex, @@ -542,32 +530,23 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* Pointer } else if (ucDsxType == DSC_ACK) { switch (psfCSType-u8ClassfierDSCAction) { case 0: /* DSC Add Classifier */ - { eClassifierAction = eAddClassifier; - } - break; + break; case 1: /* DSC Replace Classifier */ - { eClassifierAction = eReplaceClassifier; - } - break; + break; case 2: /* DSC Delete Classifier */ - { eClassifierAction = eDeleteClassifier; - } - break; + break; default: - { eClassifierAction = eInvalidClassifierAction; } - } } u16PacketClassificationRuleIndex = ntohs(psfCSType-cCPacketClassificationRule.u16PacketClassificationRuleIndex); switch (eClassifierAction) { case eAddClassifier: - { /* Get a Free Classifier Index From Classifier table for this SF to add the Classifier */ /* Contained in this message */ nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex); @@ -587,10 +566,8 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* Pointer CopyToAdapter: Error The Specified Classifier Already Exists and attempted To Add Classifier with Same PCRI : 0x%x\n, u16PacketClassificationRuleIndex); } - } - break; + break; case eReplaceClassifier: - { /* Get the Classifier Index From Classifier table for this SF and replace existing Classifier */ /* with the new classifier Contained in this message */ nClassifierIndex = SearchClsid(Adapter, ulSFID, u16PacketClassificationRuleIndex); @@ -601,10 +578,8 @@ static VOID CopyToAdapter(register struct bcm_mini_adapter *Adapter, /* Pointer }
[PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree
Replace OS_kmalloc/OS_kfree with kmalloc/kfree. And also some allocation doesn't need to use GFP_DMA so just use GFP_KERNEL. c4_new() function is never called, remove it. Signed-off-by: Daeseok Youn daeseok.y...@gmail.com --- v2: fix subject and comment correctly. I'm not sure what GFP_DMA use correctly for km{,z}alloc(). Please review this. And this patch has coding style issues. coding style issues will be fixed with another one. drivers/staging/cxt1e1/hwprobe.c |2 +- drivers/staging/cxt1e1/linux.c | 21 +-- drivers/staging/cxt1e1/musycc.c | 12 --- drivers/staging/cxt1e1/pmcc4_drv.c | 47 +- drivers/staging/cxt1e1/sbecom_inline_linux.h | 23 + drivers/staging/cxt1e1/sbecrc.c |5 ++- drivers/staging/cxt1e1/sbeproc.c |2 +- 7 files changed, 32 insertions(+), 80 deletions(-) diff --git a/drivers/staging/cxt1e1/hwprobe.c b/drivers/staging/cxt1e1/hwprobe.c index 9b4198b..6e207f5 100644 --- a/drivers/staging/cxt1e1/hwprobe.c +++ b/drivers/staging/cxt1e1/hwprobe.c @@ -205,7 +205,7 @@ cleanup_devs(void) #ifdef CONFIG_SBE_PMCC4_NCOMM free_irq(hi-pdev[1]-irq, hi-ndev); #endif - OS_kfree(hi-ndev); + kfree(hi-ndev); } } diff --git a/drivers/staging/cxt1e1/linux.c b/drivers/staging/cxt1e1/linux.c index b02f5ade..4b4609d 100644 --- a/drivers/staging/cxt1e1/linux.c +++ b/drivers/staging/cxt1e1/linux.c @@ -60,7 +60,6 @@ status_tc4_chan_work_init(mpi_t *, mch_t *); voidmusycc_wq_chan_restart(void *); status_t __init c4_init(ci_t *, u_char *, u_char *); status_t __init c4_init2(ci_t *); -ci_t *__init c4_new(void *); int __init c4hw_attach_all(void); void __init hdw_sn_get(hdw_info_t *, int); @@ -418,7 +417,7 @@ create_chan(struct net_device *ndev, ci_t *ci, struct c4_priv *priv; /* allocate then fill in private data structure */ - priv = OS_kmalloc(sizeof(struct c4_priv)); + priv = kzalloc(sizeof(struct c4_priv), GFP_KERNEL); if (!priv) { pr_warning(%s: no memory for net_device !\n, ci-devname); @@ -428,7 +427,7 @@ create_chan(struct net_device *ndev, ci_t *ci, if (!dev) { pr_warning(%s: no memory for hdlc_device !\n, ci-devname); - OS_kfree(priv); + kfree(priv); return NULL; } priv-ci = ci; @@ -972,8 +971,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, if (register_netdev(ndev) || (c4_init(ci, (u_char *) f0, (u_char *) f1) != SBE_DRVR_SUCCESS)) { - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -ENODEV; return NULL; } @@ -998,8 +997,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, pr_warning(%s: MUSYCC could not get irq: %d\n, ndev-name, irq0); unregister_netdev(ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -EIO; return NULL; } @@ -1008,8 +1007,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, pr_warning(%s: EBUS could not get irq: %d\n, hi-devname, irq1); unregister_netdev(ndev); free_irq(irq0, ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); error_flag = -EIO; return NULL; } @@ -1068,8 +1067,8 @@ c4_add_dev(hdw_info_t *hi, int brdno, unsigned long f0, unsigned long f1, unregister_netdev(ndev); free_irq(irq1, ndev); free_irq(irq0, ndev); - OS_kfree(netdev_priv(ndev)); - OS_kfree(ndev); + kfree(netdev_priv(ndev)); + kfree(ndev); /* failure, error_flag is set */ return NULL; } diff --git a/drivers/staging/cxt1e1/musycc.c b/drivers/staging/cxt1e1/musycc.c index 7b4f6f2..c174f6d 100644 --- a/drivers/staging/cxt1e1/musycc.c +++ b/drivers/staging/cxt1e1/musycc.c @@ -744,7 +744,8 @@ musycc_init(ci_t *ci) #define INT_QUEUE_BOUNDARY 4 -regaddr = OS_kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t)); + regaddr = kmalloc((INT_QUEUE_SIZE + 1) * sizeof(u_int32_t), + GFP_KERNEL | GFP_DMA); if (!regaddr) return -ENOMEM;
Re: [PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree
On Fri, Mar 21, 2014 at 01:15:23PM +0900, Daeseok Youn wrote: Replace OS_kmalloc/OS_kfree with kmalloc/kfree. You should replace it with kzalloc, not kmalloc, as OS_kmalloc() zeroed out the allocated data: -static inline void * -OS_kmalloc (size_t size) -{ -char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA); - -if (ptr) -memset (ptr, 0, size); -return ptr; -} greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: cxt1e1: replace OS_kmalloc/OS_kfree with kmalloc/kfree
2014-03-21 13:27 GMT+09:00 Greg KH gre...@linuxfoundation.org: On Fri, Mar 21, 2014 at 01:15:23PM +0900, Daeseok Youn wrote: Replace OS_kmalloc/OS_kfree with kmalloc/kfree. You should replace it with kzalloc, not kmalloc, as OS_kmalloc() zeroed out the allocated data: I think some case does not need to get zeroed memory. :-) I will change that and send it again. Thanks for review. Daeseok Youn. -static inline void * -OS_kmalloc (size_t size) -{ -char *ptr = kmalloc (size, GFP_KERNEL | GFP_DMA); - -if (ptr) -memset (ptr, 0, size); -return ptr; -} greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] fix some coding style in drivers/staging/iio
fix some coding style in drivers/staging/iio. Signed-off-by: Jimmy Licoder.l...@gmail.com --- drivers/staging/iio/accel/adis16220_core.c |3 ++- drivers/staging/iio/accel/sca3000_core.c |3 ++- drivers/staging/iio/adc/ad7192.c |3 ++- drivers/staging/iio/adc/ad7606_core.c |2 +- drivers/staging/iio/adc/ad7816.c |6 +++--- drivers/staging/iio/adc/mxs-lradc.c|6 -- drivers/staging/iio/addac/adt7316.c|3 +-- drivers/staging/iio/frequency/ad5930.c | 23 +++ drivers/staging/iio/frequency/ad9850.c |2 +- drivers/staging/iio/light/isl29018.c | 10 ++ drivers/staging/iio/light/tsl2583.c|2 +- drivers/staging/iio/light/tsl2x7x_core.c | 12 ++-- drivers/staging/iio/meter/ade7854-i2c.c|3 ++- drivers/staging/iio/resolver/ad2s1200.c|1 + 14 files changed, 47 insertions(+), 32 deletions(-) diff --git a/drivers/staging/iio/accel/adis16220_core.c b/drivers/staging/iio/accel/adis16220_core.c index 6f38ca9..31c7a9d 100644 --- a/drivers/staging/iio/accel/adis16220_core.c +++ b/drivers/staging/iio/accel/adis16220_core.c @@ -392,7 +392,8 @@ static const struct iio_info adis16220_info = { }; static const char * const adis16220_status_error_msgs[] = { - [ADIS16220_DIAG_STAT_VIOLATION_BIT] = Capture period violation/interruption, + [ADIS16220_DIAG_STAT_VIOLATION_BIT] = + Capture period violation/interruption, [ADIS16220_DIAG_STAT_SPI_FAIL_BIT] = SPI failure, [ADIS16220_DIAG_STAT_FLASH_UPT_BIT] = Flash update failed, [ADIS16220_DIAG_STAT_POWER_HIGH_BIT] = Power supply above 3.625V, diff --git a/drivers/staging/iio/accel/sca3000_core.c b/drivers/staging/iio/accel/sca3000_core.c index ed30e32..c099294 100644 --- a/drivers/staging/iio/accel/sca3000_core.c +++ b/drivers/staging/iio/accel/sca3000_core.c @@ -506,7 +506,8 @@ static int sca3000_read_raw(struct iio_dev *indio_dev, mutex_unlock(st-lock); return ret; } - *val = ((st-rx[0] 0x3F) 3) | ((st-rx[1] 0xE0) 5); + *val = ((st-rx[0] 0x3F) 3) | + ((st-rx[1] 0xE0) 5); } mutex_unlock(st-lock); return IIO_VAL_INT; diff --git a/drivers/staging/iio/adc/ad7192.c b/drivers/staging/iio/adc/ad7192.c index 83bb44b..d1f9790 100644 --- a/drivers/staging/iio/adc/ad7192.c +++ b/drivers/staging/iio/adc/ad7192.c @@ -223,7 +223,8 @@ static int ad7192_setup(struct ad7192_state *st, id = AD7192_ID_MASK; if (id != st-devid) - dev_warn(st-sd.spi-dev, device ID query failed (0x%X)\n, id); + dev_warn(st-sd.spi-dev, + device ID query failed (0x%X)\n, id); switch (pdata-clock_source_sel) { case AD7192_CLK_EXT_MCLK1_2: diff --git a/drivers/staging/iio/adc/ad7606_core.c b/drivers/staging/iio/adc/ad7606_core.c index f0f05f1..bf2c801 100644 --- a/drivers/staging/iio/adc/ad7606_core.c +++ b/drivers/staging/iio/adc/ad7606_core.c @@ -140,7 +140,7 @@ static ssize_t ad7606_store_range(struct device *dev, return count; } -static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR, \ +static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR, ad7606_show_range, ad7606_store_range, 0); static IIO_CONST_ATTR(in_voltage_range_available, 5000 1); diff --git a/drivers/staging/iio/adc/ad7816.c b/drivers/staging/iio/adc/ad7816.c index 2369cf2..ec86c01 100644 --- a/drivers/staging/iio/adc/ad7816.c +++ b/drivers/staging/iio/adc/ad7816.c @@ -153,7 +153,8 @@ static ssize_t ad7816_show_available_modes(struct device *dev, return sprintf(buf, full\npower-save\n); } -static IIO_DEVICE_ATTR(available_modes, S_IRUGO, ad7816_show_available_modes, NULL, 0); +static IIO_DEVICE_ATTR(available_modes, S_IRUGO, + ad7816_show_available_modes, NULL, 0); static ssize_t ad7816_show_channel(struct device *dev, struct device_attribute *attr, @@ -442,6 +443,5 @@ static struct spi_driver ad7816_driver = { module_spi_driver(ad7816_driver); MODULE_AUTHOR(Sonic Zhang sonic.zh...@analog.com); -MODULE_DESCRIPTION(Analog Devices AD7816/7/8 digital -temperature sensor driver); +MODULE_DESCRIPTION(Analog Devices AD7816/7/8 digital temperature sensor driver); MODULE_LICENSE(GPL v2); diff --git a/drivers/staging/iio/adc/mxs-lradc.c b/drivers/staging/iio/adc/mxs-lradc.c index 11fb952..84f7177 100644 --- a/drivers/staging/iio/adc/mxs-lradc.c +++ b/drivers/staging/iio/adc/mxs-lradc.c @@ -462,7 +462,8 @@ static void mxs_lradc_setup_ts_channel(struct mxs_lradc *lradc, unsigned ch) * SoC's delay unit and start the conversion later * and automatically. */ - mxs_lradc_reg_wrt(lradc,