Re: [PATCH 0/25] Replace DEFINE_PCI_DEVICE_TABLE macro use
On 21/07/2014 17:16, Bjorn Helgaas wrote: > [+cc Jingoo] > > On Fri, Jul 18, 2014 at 12:50 PM, James Bottomley > > Anyway, it's PCI code ... let the PCI maintainer decide. However, if he > > does want this do it as one big bang patch via either the PCI or Trivial > > tree (latter because Jiří has experience doing this, but the former > > might be useful so the decider feels the pain ...) > > I don't feel strongly either way, so I guess I'm OK with this, and in > the spirit of feeling the pain, I'm willing to handle it. Jingoo > proposed similar patches, so it might be nice to give him some credit. > > Benoit, how about if you wait until about half-way through the merge > window after v3.16 releases, generate an up-to-date single patch, and > post that? Then we can try to get it in before v3.17-rc1 to minimize > merge hassles. Sure, I will do this. -- Benoît Taine Master cycle intern Regal Team. LIP6 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/25] Replace DEFINE_PCI_DEVICE_TABLE macro use
We should prefer `const struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to meet kernel coding style guidelines. This issue was reported by checkpatch. A simplified version of the semantic patch that makes this change is as follows (http://coccinelle.lip6.fr/): // @@ identifier i; declarer name DEFINE_PCI_DEVICE_TABLE; initializer z; @@ - DEFINE_PCI_DEVICE_TABLE(i) + const struct pci_device_id i[] = z; // I have 103 patches ready, and will only send a few for you to judge if it is useful enough, and to prevent from spamming too much. Thanks. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 9/18] staging: rtl8723au: Use kmemdup instead of kmalloc + memcpy
On 26/05/2014 17:43, Jes Sorensen wrote: > Benoit Taine writes: > > This issue was reported by coccicheck using the semantic patch > > at scripts/coccinelle/api/memdup.cocci > > > > Signed-off-by: Benoit Taine > > --- > > Tested by compilation without errors. > > > > drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c |3 +-- > > drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 16 ++-- > > 2 files changed, 7 insertions(+), 12 deletions(-) > > Benoit, > > I believe this was already applied to staging-next - if you feel > something is missing. Could you please re-diff against the latest > staging-next tree. Agreed, it is mostly 80 chars per line compliance. I will resend. -- Benoît Taine Master cycle intern Regal Team. LIP6 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/18] Use kmemdup instead of kmalloc + memcpy
These patches enhance kernel style usage, and allows smaller code while preventing accidental code edits to produce overflows. The semantic patch at scripts/coccinelle/api/memdup.cocci was used to detect and edit this situation. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 9/18] staging: rtl8723au: Use kmemdup instead of kmalloc + memcpy
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci Signed-off-by: Benoit Taine --- Tested by compilation without errors. drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c |3 +-- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 16 ++-- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index e2d426a..f917edd 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -339,12 +339,11 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) rtStatus = _FAIL; goto Exit; } - firmware_buf = kzalloc(fw->size, GFP_KERNEL); + firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL); if (!firmware_buf) { rtStatus = _FAIL; goto Exit; } - memcpy(firmware_buf, fw->data, fw->size); buf = firmware_buf; fw_size = fw->size; release_firmware(fw); diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 182f57c..735eb99 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1426,14 +1426,13 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct rtw_adapter *padapter, pmlmepriv->wps_probe_req_ie = NULL; } - pmlmepriv->wps_probe_req_ie = - kmalloc(wps_ielen, GFP_KERNEL); + pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, + wps_ielen, GFP_KERNEL); if (pmlmepriv->wps_probe_req_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); pmlmepriv->wps_probe_req_ie_len = wps_ielen; } } @@ -1697,12 +1696,11 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, ret = -EINVAL; goto exit; } - buf = kzalloc(ielen, GFP_KERNEL); + buf = kmemdup(pie, ielen, GFP_KERNEL); if (buf == NULL) { ret = -ENOMEM; goto exit; } - memcpy(buf, pie, ielen); /* dump */ DBG_8723A("set wpa_ie(length:%zu):\n", ielen); @@ -3178,14 +3176,13 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, pmlmepriv->wps_beacon_ie = NULL; } - pmlmepriv->wps_beacon_ie = - kmalloc(wps_ielen, GFP_KERNEL); + pmlmepriv->wps_beacon_ie = kmemdup(wps_ie, wps_ielen, + GFP_KERNEL); if (pmlmepriv->wps_beacon_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); pmlmepriv->wps_beacon_ie_len = wps_ielen; #ifdef CONFIG_8723AU_AP_MODE @@ -3270,14 +3267,13 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, pmlmepriv->wps_assoc_resp_ie = NULL; } - pmlmepriv->wps_assoc_resp_ie = kmalloc(len, GFP_KERNEL); + pmlmepriv->wps_assoc_resp_ie = kmemdup(buf, len, GFP_KERNEL); if (pmlmepriv->wps_assoc_resp_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len); pmlmepriv->wps_assoc_resp_ie_len = len; } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8723au: Use kmemdup() instead of memcpy() to duplicate memory
This issue was reported by coccicheck using the semantic patch at scripts/coccinelle/api/memdup.cocci, and tested by compilation. Signed-off-by: Benoit Taine --- drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c |3 +-- drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c | 17 +++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c index e2d426a..f917edd 100644 --- a/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c +++ b/drivers/staging/rtl8723au/hal/rtl8723a_hal_init.c @@ -339,12 +339,11 @@ int rtl8723a_FirmwareDownload(struct rtw_adapter *padapter) rtStatus = _FAIL; goto Exit; } - firmware_buf = kzalloc(fw->size, GFP_KERNEL); + firmware_buf = kmemdup(fw->data, fw->size, GFP_KERNEL); if (!firmware_buf) { rtStatus = _FAIL; goto Exit; } - memcpy(firmware_buf, fw->data, fw->size); buf = firmware_buf; fw_size = fw->size; release_firmware(fw); diff --git a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c index 182f57c..c88a416 100644 --- a/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c +++ b/drivers/staging/rtl8723au/os_dep/ioctl_cfg80211.c @@ -1426,14 +1426,14 @@ static int rtw_cfg80211_set_probe_req_wpsp2pie(struct rtw_adapter *padapter, pmlmepriv->wps_probe_req_ie = NULL; } - pmlmepriv->wps_probe_req_ie = - kmalloc(wps_ielen, GFP_KERNEL); + pmlmepriv->wps_probe_req_ie = kmemdup(wps_ie, + wps_ielen, + GFP_KERNEL); if (pmlmepriv->wps_probe_req_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_probe_req_ie, wps_ie, wps_ielen); pmlmepriv->wps_probe_req_ie_len = wps_ielen; } } @@ -1697,12 +1697,11 @@ static int rtw_cfg80211_set_wpa_ie(struct rtw_adapter *padapter, const u8 *pie, ret = -EINVAL; goto exit; } - buf = kzalloc(ielen, GFP_KERNEL); + buf = kmemdup(pie, ielen, GFP_KERNEL); if (buf == NULL) { ret = -ENOMEM; goto exit; } - memcpy(buf, pie, ielen); /* dump */ DBG_8723A("set wpa_ie(length:%zu):\n", ielen); @@ -3178,14 +3177,13 @@ static int rtw_cfg80211_set_beacon_wpsp2pie(struct net_device *ndev, char *buf, pmlmepriv->wps_beacon_ie = NULL; } - pmlmepriv->wps_beacon_ie = - kmalloc(wps_ielen, GFP_KERNEL); + pmlmepriv->wps_beacon_ie = kmemdup(wps_ie, wps_ielen, + GFP_KERNEL); if (pmlmepriv->wps_beacon_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_beacon_ie, wps_ie, wps_ielen); pmlmepriv->wps_beacon_ie_len = wps_ielen; #ifdef CONFIG_8723AU_AP_MODE @@ -3270,14 +3268,13 @@ static int rtw_cfg80211_set_assoc_resp_wpsp2pie(struct net_device *net, pmlmepriv->wps_assoc_resp_ie = NULL; } - pmlmepriv->wps_assoc_resp_ie = kmalloc(len, GFP_KERNEL); + pmlmepriv->wps_assoc_resp_ie = kmemdup(buf, len, GFP_KERNEL); if (pmlmepriv->wps_assoc_resp_ie == NULL) { DBG_8723A("%s()-%d: kmalloc() ERROR!\n", __func__, __LINE__); return -EINVAL; } - memcpy(pmlmepriv->wps_assoc_resp_ie, buf, len); pmlmepriv->wps_assoc_resp_ie_len = len; } ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rts5208: Use pci_device_id rather than DEFINE_PCI_DEVICE_TABLE
This patch enhances kernel style usage for the rts5208 driver. We should prefer `struct pci_device_id` over `DEFINE_PCI_DEVICE_TABLE` to meet kernel coding style guidelines. This issue was reported by checkpatch. Signed-off-by: Benoit Taine --- drivers/staging/rts5208/rtsx.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rts5208/rtsx.c b/drivers/staging/rts5208/rtsx.c index d2d1345..c0a0e60 100644 --- a/drivers/staging/rts5208/rtsx.c +++ b/drivers/staging/rts5208/rtsx.c @@ -1030,7 +1030,7 @@ static void rtsx_remove(struct pci_dev *pci) } /* PCI IDs */ -static DEFINE_PCI_DEVICE_TABLE(rtsx_ids) = { +static const struct pci_device_id rtsx_ids[] = { { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5208), PCI_CLASS_OTHERS << 16, 0xFF }, { PCI_DEVICE(PCI_VENDOR_ID_REALTEK, 0x5288), ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging/rtl8192u: Put EXPORT_SYMBOL just after the exported function
Export of symbols statement must be placed right after the definition to meet kernel coding style guidelines. This issue was reported by checkpatch. A simplified version of the semantic patch that makes this change is as follows (http://coccinelle.lip6.fr/): // @ r @ identifier f; @@ - EXPORT_SYMBOL(f); @@ identifier r.f; @@ f(...) { ... } + EXPORT_SYMBOL(f); // Signed-off-by: Benoit Taine --- drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c |3 drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c| 52 +- drivers/staging/rtl8192u/ieee80211/ieee80211_softmac_wx.c | 42 --- drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c |3 drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 19 ++--- drivers/staging/rtl8192u/ieee80211/rtl819x_HTProc.c |3 6 files changed, 52 insertions(+), 70 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c index a98414a..92707fb 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_rx.c @@ -1387,6 +1387,7 @@ int ieee80211_rx(struct ieee80211_device *ieee, struct sk_buff *skb, * hardware as a DMA target */ return 0; } +EXPORT_SYMBOL(ieee80211_rx); #define MGMT_FRAME_FIXED_PART_LENGTH0x24 @@ -2643,6 +2644,4 @@ void ieee80211_rx_mgt(struct ieee80211_device *ieee, } } - EXPORT_SYMBOL(ieee80211_rx_mgt); -EXPORT_SYMBOL(ieee80211_rx); diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c index 9caf6fd..d2eea3c 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_softmac.c @@ -28,11 +28,13 @@ short ieee80211_is_54g(const struct ieee80211_network *net) { return (net->rates_ex_len > 0) || (net->rates_len > 4); } +EXPORT_SYMBOL(ieee80211_is_54g); short ieee80211_is_shortslot(const struct ieee80211_network *net) { return net->capability & WLAN_CAPABILITY_SHORT_SLOT; } +EXPORT_SYMBOL(ieee80211_is_shortslot); /* returns the total length needed for pleacing the RATE MFIE * tag and the EXTENDED RATE MFIE tag if needed. @@ -415,6 +417,7 @@ void ieee80211_send_probe_requests(struct ieee80211_device *ieee) ieee80211_send_probe(ieee); } } +EXPORT_SYMBOL(ieee80211_send_probe_requests); /* this performs syncro scan blocking the caller until all channels * in the allowed channel map has been checked. @@ -485,7 +488,7 @@ out: up(&ieee->scan_sem); } } - +EXPORT_SYMBOL(ieee80211_softmac_scan_syncro); static void ieee80211_softmac_scan_wq(struct work_struct *work) { @@ -563,7 +566,7 @@ void ieee80211_stop_send_beacons(struct ieee80211_device *ieee) if (ieee->softmac_features & IEEE_SOFTMAC_BEACONS) ieee80211_beacons_stop(ieee); } - +EXPORT_SYMBOL(ieee80211_stop_send_beacons); void ieee80211_start_send_beacons(struct ieee80211_device *ieee) { @@ -572,7 +575,7 @@ void ieee80211_start_send_beacons(struct ieee80211_device *ieee) if(ieee->softmac_features & IEEE_SOFTMAC_BEACONS) ieee80211_beacons_start(ieee); } - +EXPORT_SYMBOL(ieee80211_start_send_beacons); static void ieee80211_softmac_stop_scan(struct ieee80211_device *ieee) { @@ -600,6 +603,7 @@ void ieee80211_stop_scan(struct ieee80211_device *ieee) else ieee->stop_scan(ieee->dev); } +EXPORT_SYMBOL(ieee80211_stop_scan); /* called with ieee->lock held */ static void ieee80211_start_scan(struct ieee80211_device *ieee) @@ -638,6 +642,7 @@ void ieee80211_start_scan_syncro(struct ieee80211_device *ieee) ieee->scan_syncro(ieee->dev); } +EXPORT_SYMBOL(ieee80211_start_scan_syncro); inline struct sk_buff *ieee80211_authentication_req(struct ieee80211_network *beacon, struct ieee80211_device *ieee, int challengelen) @@ -1709,8 +1714,6 @@ ieee80211_rx_assoc_rq(struct ieee80211_device *ieee, struct sk_buff *skb) //FIXME } - - static void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, short pwr) { @@ -1721,7 +1724,7 @@ static void ieee80211_sta_ps_send_null_frame(struct ieee80211_device *ieee, softmac_ps_mgmt_xmit(buf, ieee); } - +/* EXPORT_SYMBOL(ieee80211_sta_ps_send_null_frame); */ static short ieee80211_sta_ps_sleep(struct ieee80211_device *ieee, u32 *time_h, u32 *time_l) @@ -1889,6 +1892,8 @@ void ieee80211_ps_tx_ack(struct ieee80211_device *ieee, short success) } spin_unlock_irqrestore(&ieee->lock, flags); } +EXPORT_SYMBOL(ieee80211_ps_tx_ack); + static void ieee80211_process_action(struct ieee80211_device *ieee,