[bug report] binder: Support multiple /dev instances
Hello Martijn Coenen, The patch ac4812c5ffbb: "binder: Support multiple /dev instances" from Feb 3, 2017, leads to the following static checker warning: drivers/android/binder.c:4266 binder_init() warn: did you mean to pass the address of 'device_names' drivers/android/binder.c 4255 /* 4256 * Copy the module_parameter string, because we don't want to 4257 * tokenize it in-place. 4258 */ 4259 device_names = kzalloc(strlen(binder_devices_param) + 1, GFP_KERNEL); 4260 if (!device_names) { 4261 ret = -ENOMEM; 4262 goto err_alloc_device_names_failed; 4263 } 4264 strcpy(device_names, binder_devices_param); 4265 4266 while ((device_name = strsep(&device_names, ","))) { Obviously we did mean to pass the address, but on of the problems with this is that now we can't free "device_names" because we don't have the original pointer stored anywhere. 4267 ret = init_binder_device(device_name); 4268 if (ret) 4269 goto err_init_binder_device_failed; 4270 } 4271 4272 return ret; 4273 4274 err_init_binder_device_failed: 4275 hlist_for_each_entry_safe(device, tmp, &binder_devices, hlist) { 4276 misc_deregister(&device->miscdev); 4277 hlist_del(&device->hlist); 4278 kfree(device); 4279 } 4280 err_alloc_device_names_failed: 4281 debugfs_remove_recursive(binder_debugfs_dir_entry_root); 4282 4283 return ret; 4284 } regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH]staging: fbtft: Fix sparse warnings about endianness
Fixed sparse warnings about endianness. E.g.: warning: incorrect type in assignment (different base types) Signed-off-by: maomao xu diff --git a/drivers/staging/fbtft/fbtft-io.c b/drivers/staging/fbtft/fbtft-io.c index d868405..ffb9a3b 100644 --- a/drivers/staging/fbtft/fbtft-io.c +++ b/drivers/staging/fbtft/fbtft-io.c @@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void *buf, size_t len) src++; } tmp |= ((*src & 0x0100) ? 1 : 0); - *(u64 *)dst = cpu_to_be64(tmp); + *(__be64 *)dst = cpu_to_be64(tmp); dst += 8; *dst++ = (u8)(*src++ & 0x00FF); added++; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gdm724x: Fix sparse warnings
drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment (different base types) drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 [addressable] [assigned] [usertype] icmp6_cksum drivers/staging/gdm724x/gdm_lte.c:311:39:got int Signed-off-by: maomao xu diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index a3e046c..ddec6d0 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -308,7 +308,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) memcpy(icmp_na + sizeof(struct icmp6hdr), &na, sizeof(struct neighbour_advertisement)); - icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out, + icmp6_out.icmp6_cksum = (__force __sum16)icmp6_checksum(&ipv6_out, (u16 *)icmp_na, sizeof(icmp_na)); } else { return -1; -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 05/15] staging: rtl8192u: Use min_t instead of min
Use min_t instead of min function in ieee80211/ieee80211_wx.c fixed warning: WARNING: min() should probably be min_t(u8, network->ssid_len, 32) Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 2481c21..fff2020 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -80,7 +80,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.data.length = sizeof(""); start = iwe_stream_add_point(info, start, stop, &iwe, ""); } else { - iwe.u.data.length = min(network->ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->ssid_len, 32); start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); } /* Add the protocol name */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: bcm2835-audio: remove unused macro
The VC_AUDIO_MAX_MSG_LEN macro is not used by anything in the bcm2835-audio driver. Signed-off-by: Hendrik v. Raven --- v2: - rebased against next-20170214 --- drivers/staging/bcm2835-audio/vc_vchi_audioserv_defs.h | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/bcm2835-audio/vc_vchi_audioserv_defs.h b/drivers/staging/bcm2835-audio/vc_vchi_audioserv_defs.h index 928dd6009510..da96f1bc2516 100644 --- a/drivers/staging/bcm2835-audio/vc_vchi_audioserv_defs.h +++ b/drivers/staging/bcm2835-audio/vc_vchi_audioserv_defs.h @@ -21,9 +21,6 @@ /* FourCC code used for VCHI connection */ #define VC_AUDIO_SERVER_NAME MAKE_FOURCC("AUDS") -/* Maximum message length */ -#define VC_AUDIO_MAX_MSG_LEN (sizeof(VC_AUDIO_MSG_T)) - /* * List of screens that are currently supported * All message types supported for HOST->VC direction -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: nvec: Fix incorrect type of i2c address
Am Montag, 13. Februar 2017, 09:35:19 CET schrieb Franck Demathieu: > From: Franck Demathieu > > The i2c address is unsigned according to the dt-bindings. > Fix sparse issue (-Wtypesign): > > drivers/staging/nvec/nvec.c:781:35: warning: incorrect type in argument 3 > (different signedness) drivers/staging/nvec/nvec.c:781:35:expected > unsigned int [usertype] *out_value drivers/staging/nvec/nvec.c:781:35: > got int * > > Signed-off-by: Franck Demathieu looks correct. Thanks! Acked-by: Marc Dietrich > --- > drivers/staging/nvec/nvec.h | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h > index c03ca8d..aa7c70e 100644 > --- a/drivers/staging/nvec/nvec.h > +++ b/drivers/staging/nvec/nvec.h > @@ -138,7 +138,7 @@ struct nvec_chip { > struct device *dev; > int gpio; > int irq; > - int i2c_addr; > + u32 i2c_addr; > void __iomem *base; > struct clk *i2c_clk; > struct reset_control *rst; signature.asc Description: This is a digitally signed message part. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 06/15] staging: rtl8192u: Fixing coding style issues
fixed errors and warnings: ERROR: spaces required around that '=' ERROR: spaces required around that '<' ERROR: space required before the open parenthesis '(' CHECK: spaces preferred around that '&' CHECK: spaces preferred around that '<<' ERROR: space required after that ',' ERROR: spaces required around that '+=' WARNING: Missing a blank line after declarations CHECK: spaces required around that '?' CHECK: spaces required around that ':' Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index fff2020..c846223 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -85,10 +85,10 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - for(i=0; imode&(1bssht.bdHTCapBuf, EWC11NHTCap, 4)) ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[4]; else ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[0]; - is40M = (ht_cap->ChlWidth)?1:0; - isShortGI = (ht_cap->ChlWidth)? - ((ht_cap->ShortGI40Mhz)?1:0): - ((ht_cap->ShortGI20Mhz)?1:0); + is40M = (ht_cap->ChlWidth) ? 1 : 0; + isShortGI = (ht_cap->ChlWidth) ? + ((ht_cap->ShortGI40Mhz) ? 1 : 0) : + ((ht_cap->ShortGI20Mhz) ? 1 : 0); max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS, MCS_FILTER_ALL); rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs&0x7f]; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 07/15] staging: rtl8192u: Fixing style issues in r8180_93cx6.c
Fixing the following checkpatch.pl errors and warning: WARNING: Block comments use * on subsequent lines CHECK: Please don't use multiple blank lines CHECK: Alignment should match open parenthesis CHECK: spaces preferred around that '<<' CHECK: spaces preferred around that '-' CHECK: Alignment should match open parenthesis Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8180_93cx6.c | 71 -- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index f35defc..6a293e3 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -1,22 +1,22 @@ /* - This files contains card eeprom (93c46 or 93c56) programming routines, - memory is addressed by 16 bits words. - - This is part of rtl8180 OpenSource driver. - Copyright (C) Andrea Merello 2004 - Released under the terms of GPL (General Public Licence) - - Parts of this driver are based on the GPL part of the - official realtek driver. - - Parts of this driver are based on the rtl8180 driver skeleton - from Patric Schenke & Andres Salomon. - - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. - - We want to thank the Authors of those projects and the Ndiswrapper - project Authors. -*/ + * This files contains card eeprom (93c46 or 93c56) programming routines, + * memory is addressed by 16 bits words. + * + * This is part of rtl8180 OpenSource driver. + * Copyright (C) Andrea Merello 2004 + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the + * official realtek driver. + * + * Parts of this driver are based on the rtl8180 driver skeleton + * from Patric Schenke & Andres Salomon. + * + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + * + * We want to thank the Authors of those projects and the Ndiswrapper + * project Authors. + */ #include "r8180_93cx6.h" @@ -39,7 +39,6 @@ static void eprom_cs(struct net_device *dev, short bit) udelay(EPROM_DELAY); } - static void eprom_ck_cycle(struct net_device *dev) { u8 cmdreg; @@ -58,7 +57,6 @@ static void eprom_ck_cycle(struct net_device *dev) udelay(EPROM_DELAY); } - static void eprom_w(struct net_device *dev, short bit) { u8 cmdreg; @@ -76,7 +74,6 @@ static void eprom_w(struct net_device *dev, short bit) udelay(EPROM_DELAY); } - static short eprom_r(struct net_device *dev) { u8 bit; @@ -94,7 +91,6 @@ static short eprom_r(struct net_device *dev) return 0; } - static void eprom_send_bits_string(struct net_device *dev, short b[], int len) { int i; @@ -105,7 +101,6 @@ static void eprom_send_bits_string(struct net_device *dev, short b[], int len) } } - int eprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -119,27 +114,27 @@ int eprom_read(struct net_device *dev, u32 addr) ret = 0; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, - (EPROM_CMD_PROGRAM
[PATCH 08/15] staging: rtl8192u: Fixing style issues in r8180_93cx6.h
Fixing the following checkpatch.pl errors and warning: WARNING: Block comments use * on subsequent lines CHECK: Please don't use multiple blank lines Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8180_93cx6.h | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index 9cf7f58..643d465 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h @@ -1,17 +1,17 @@ /* - This is part of rtl8187 OpenSource driver - Copyright (C) Andrea Merello 2004-2005 - Released under the terms of GPL (General Public Licence) - - Parts of this driver are based on the GPL part of the - official realtek driver - Parts of this driver are based on the rtl8180 driver skeleton - from Patric Schenke & Andres Salomon - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver - - We want to thank the Authors of such projects and the Ndiswrapper - project Authors. -*/ + * This is part of rtl8187 OpenSource driver + * Copyright (C) Andrea Merello 2004-2005 + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the + * official realtek driver + * Parts of this driver are based on the rtl8180 driver skeleton + * from Patric Schenke & Andres Salomon + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + * + * We want to thank the Authors of such projects and the Ndiswrapper + * project Authors. + */ /*This files contains card eeprom (93c46 or 93c56) programming routines*/ /*memory is addressed by WORDS*/ @@ -39,5 +39,4 @@ #define EPROM_TXPW2 0x1b #define EPROM_TXPW1 0x3d - int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 09/15] staging: rtl8192u: fixing block comments use * on subsequent lines
Fixed checkpatch.pl warning: WARNING: Block comments use * on subsequent lines Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8190_rtl8256.h | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 1ba4f83..5878f42 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -1,14 +1,13 @@ /* - This is part of the rtl8180-sa2400 driver - released under the GPL (See file COPYING for details). - Copyright (c) 2005 Andrea Merello - - This files contains programming code for the rtl8256 - radio frontend. - - *Many* thanks to Realtek Corp. for their great support! - -*/ + * This is part of the rtl8180-sa2400 driver + * released under the GPL (See file COPYING for details). + * Copyright (c) 2005 Andrea Merello + * + * This files contains programming code for the rtl8256 + * radio frontend. + * + * Many* thanks to Realtek Corp. for their great support! + */ #ifndef RTL8225H #define RTL8225H -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support
Hi, while we're still waiting for a definitive ACK from Microsoft that the algorithm is good for SMP case (as we can't prevent the code in vdso from migrating between CPUs) I'd like to send v2 with some modifications to keep the discussion going. Changes since v1: - Document the TSC page reading protocol [Thomas Gleixner]. - Separate the TSC page reading code from read_hv_clock_tsc() and put it to asm/mshyperv.h to use from both hv_init.c and vdso. - Add explicit barriers [Thomas Gleixner] Original description: Hyper-V TSC page clocksource is suitable for vDSO, however, the protocol defined by the hypervisor is different from VCLOCK_PVCLOCK. Implemented the required support. Simple sysbench test shows the following results: Before: # time sysbench --test=memory --max-requests=50 run ... real1m22.618s user0m50.193s sys 0m32.268s After: # time sysbench --test=memory --max-requests=50 run ... real0m47.241s user0m47.117s sys 0m0.008s Patches 1 and 2 are made on top of K. Y.'s code refactoring which moved tsc page clocksource to arch/x86/hyperv/hv_init.c, this is currently present in Greg's char-misc-next tree. Vitaly Kuznetsov (3): x86/hyperv: implement hv_get_tsc_page() x86/hyperv: move TSC reading method to asm/mshyperv.h x86/vdso: Add VCLOCK_HVCLOCK vDSO clock read method arch/x86/entry/vdso/vclock_gettime.c | 24 +++ arch/x86/entry/vdso/vdso-layout.lds.S | 3 +- arch/x86/entry/vdso/vdso2c.c | 3 ++ arch/x86/entry/vdso/vma.c | 7 + arch/x86/hyperv/hv_init.c | 48 + arch/x86/include/asm/clocksource.h| 3 +- arch/x86/include/asm/mshyperv.h | 58 +++ arch/x86/include/asm/vdso.h | 1 + drivers/hv/Kconfig| 3 ++ 9 files changed, 114 insertions(+), 36 deletions(-) -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/3] x86/vdso: Add VCLOCK_HVCLOCK vDSO clock read method
Hyper-V TSC page clocksource is suitable for vDSO, however, the protocol defined by the hypervisor is different from VCLOCK_PVCLOCK. Implement the required support by adding hvclock_page VVAR. Signed-off-by: Vitaly Kuznetsov --- arch/x86/entry/vdso/vclock_gettime.c | 24 arch/x86/entry/vdso/vdso-layout.lds.S | 3 ++- arch/x86/entry/vdso/vdso2c.c | 3 +++ arch/x86/entry/vdso/vma.c | 7 +++ arch/x86/hyperv/hv_init.c | 3 +++ arch/x86/include/asm/clocksource.h| 3 ++- arch/x86/include/asm/vdso.h | 1 + 7 files changed, 42 insertions(+), 2 deletions(-) diff --git a/arch/x86/entry/vdso/vclock_gettime.c b/arch/x86/entry/vdso/vclock_gettime.c index 9d4d6e1..fa8dbfc 100644 --- a/arch/x86/entry/vdso/vclock_gettime.c +++ b/arch/x86/entry/vdso/vclock_gettime.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -32,6 +33,11 @@ extern u8 pvclock_page __attribute__((visibility("hidden"))); #endif +#ifdef CONFIG_HYPERV_TSCPAGE +extern u8 hvclock_page + __attribute__((visibility("hidden"))); +#endif + #ifndef BUILD_VDSO32 notrace static long vdso_fallback_gettime(long clock, struct timespec *ts) @@ -141,6 +147,20 @@ static notrace u64 vread_pvclock(int *mode) return last; } #endif +#ifdef CONFIG_HYPERV_TSCPAGE +static notrace u64 vread_hvclock(int *mode) +{ + const struct ms_hyperv_tsc_page *tsc_pg = + (const struct ms_hyperv_tsc_page *)&hvclock_page; + u64 current_tick = hv_read_tsc_page(tsc_pg); + + if (current_tick != U64_MAX) + return current_tick; + + *mode = VCLOCK_NONE; + return 0; +} +#endif notrace static u64 vread_tsc(void) { @@ -173,6 +193,10 @@ notrace static inline u64 vgetsns(int *mode) else if (gtod->vclock_mode == VCLOCK_PVCLOCK) cycles = vread_pvclock(mode); #endif +#ifdef CONFIG_HYPERV_TSCPAGE + else if (gtod->vclock_mode == VCLOCK_HVCLOCK) + cycles = vread_hvclock(mode); +#endif else return 0; v = (cycles - gtod->cycle_last) & gtod->mask; diff --git a/arch/x86/entry/vdso/vdso-layout.lds.S b/arch/x86/entry/vdso/vdso-layout.lds.S index a708aa9..8ebb4b6 100644 --- a/arch/x86/entry/vdso/vdso-layout.lds.S +++ b/arch/x86/entry/vdso/vdso-layout.lds.S @@ -25,7 +25,7 @@ SECTIONS * segment. */ - vvar_start = . - 2 * PAGE_SIZE; + vvar_start = . - 3 * PAGE_SIZE; vvar_page = vvar_start; /* Place all vvars at the offsets in asm/vvar.h. */ @@ -36,6 +36,7 @@ SECTIONS #undef EMIT_VVAR pvclock_page = vvar_start + PAGE_SIZE; + hvclock_page = vvar_start + 2 * PAGE_SIZE; . = SIZEOF_HEADERS; diff --git a/arch/x86/entry/vdso/vdso2c.c b/arch/x86/entry/vdso/vdso2c.c index 491020b..0780a44 100644 --- a/arch/x86/entry/vdso/vdso2c.c +++ b/arch/x86/entry/vdso/vdso2c.c @@ -74,6 +74,7 @@ enum { sym_vvar_page, sym_hpet_page, sym_pvclock_page, + sym_hvclock_page, sym_VDSO_FAKE_SECTION_TABLE_START, sym_VDSO_FAKE_SECTION_TABLE_END, }; @@ -82,6 +83,7 @@ const int special_pages[] = { sym_vvar_page, sym_hpet_page, sym_pvclock_page, + sym_hvclock_page, }; struct vdso_sym { @@ -94,6 +96,7 @@ struct vdso_sym required_syms[] = { [sym_vvar_page] = {"vvar_page", true}, [sym_hpet_page] = {"hpet_page", true}, [sym_pvclock_page] = {"pvclock_page", true}, + [sym_hvclock_page] = {"hvclock_page", true}, [sym_VDSO_FAKE_SECTION_TABLE_START] = { "VDSO_FAKE_SECTION_TABLE_START", false }, diff --git a/arch/x86/entry/vdso/vma.c b/arch/x86/entry/vdso/vma.c index 10820f6..b256a3b 100644 --- a/arch/x86/entry/vdso/vma.c +++ b/arch/x86/entry/vdso/vma.c @@ -21,6 +21,7 @@ #include #include #include +#include #if defined(CONFIG_X86_64) unsigned int __read_mostly vdso64_enabled = 1; @@ -120,6 +121,12 @@ static int vvar_fault(const struct vm_special_mapping *sm, vmf->address, __pa(pvti) >> PAGE_SHIFT); } + } else if (sym_offset == image->sym_hvclock_page) { + struct ms_hyperv_tsc_page *tsc_pg = hv_get_tsc_page(); + + if (tsc_pg && vclock_was_used(VCLOCK_HVCLOCK)) + ret = vm_insert_pfn(vma, vmf->address, + vmalloc_to_pfn(tsc_pg)); } if (ret == 0 || ret == -EBUSY) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 77fec0c..870f0eb 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -129,6 +129,9 @@ void hyperv_init(void) tsc_msr.guest_physical_address = vmalloc_to_pfn(tsc_pg); wrmsrl(HV_X64_MSR_REFERENCE_TSC, tsc_msr.as_uint64); + + hyperv_cs_tsc.archdata.vcl
[PATCH v2 2/3] x86/hyperv: move TSC reading method to asm/mshyperv.h
As a preparation to making Hyper-V TSC page suitable for vDSO move the TSC page reading logic to asm/mshyperv.h. While on it, do the following - Document the reading algorithm. - Simplify the code a bit. - Add explicit barriers to prevent re-ordering (we need to read sequence stricktly before and after) - Use mul_u64_u64_shr() instead of assembly. I checked and on x86_64 gcc generates a single 'mul' instruction. Signed-off-by: Vitaly Kuznetsov --- arch/x86/hyperv/hv_init.c | 36 - arch/x86/include/asm/mshyperv.h | 50 + 2 files changed, 54 insertions(+), 32 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index 0ce8485..77fec0c 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -38,39 +38,11 @@ struct ms_hyperv_tsc_page *hv_get_tsc_page(void) static u64 read_hv_clock_tsc(struct clocksource *arg) { - u64 current_tick; + u64 current_tick = hv_read_tsc_page(tsc_pg); + + if (current_tick == U64_MAX) + rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); - if (tsc_pg->tsc_sequence != 0) { - /* -* Use the tsc page to compute the value. -*/ - - while (1) { - u64 tmp; - u32 sequence = tsc_pg->tsc_sequence; - u64 cur_tsc; - u64 scale = tsc_pg->tsc_scale; - s64 offset = tsc_pg->tsc_offset; - - rdtscll(cur_tsc); - /* current_tick = ((cur_tsc *scale) >> 64) + offset */ - asm("mulq %3" - : "=d" (current_tick), "=a" (tmp) - : "a" (cur_tsc), "r" (scale)); - - current_tick += offset; - if (tsc_pg->tsc_sequence == sequence) - return current_tick; - - if (tsc_pg->tsc_sequence != 0) - continue; - /* -* Fallback using MSR method. -*/ - break; - } - } - rdmsrl(HV_X64_MSR_TIME_REF_COUNT, current_tick); return current_tick; } diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index 14dd92c..ddd071c 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -175,6 +175,56 @@ void hyperv_cleanup(void); #endif #ifdef CONFIG_HYPERV_TSCPAGE struct ms_hyperv_tsc_page *hv_get_tsc_page(void); +static inline u64 hv_read_tsc_page(const struct ms_hyperv_tsc_page *tsc_pg) +{ + u64 scale, offset, current_tick, cur_tsc; + u32 sequence; + + /* +* The protocol for reading Hyper-V TSC page is specified in Hypervisor +* Top-Level Functional Specification ver. 3.0 and above. To get the +* reference time we must do the following: +* - READ ReferenceTscSequence +* A special '0' value indicates the time source is unreliable and we +* need to use something else. The currently published specification +* versions (up to 4.0b) contain a mistake and wrongly claim '-1' +* instead of '0' as the special value, see commit c35b82ef0294. +* - ReferenceTime = +*((RDTSC() * ReferenceTscScale) >> 64) + ReferenceTscOffset +* - READ ReferenceTscSequence again. In case its value has changed +* since our first reading we need to discard ReferenceTime and repeat +* the whole sequence as the hypervisor was updating the page in +* between. +*/ + while (1) { + sequence = tsc_pg->tsc_sequence; + if (!sequence) + break; + /* +* Make sure we read sequence before we read other values from +* TSC page. +*/ + virt_rmb(); + + scale = tsc_pg->tsc_scale; + offset = tsc_pg->tsc_offset; + rdtscll(cur_tsc); + + current_tick = mul_u64_u64_shr(cur_tsc, scale, 64) + offset; + + /* +* Make sure we read sequence after we read all other values +* from TSC page. +*/ + virt_rmb(); + + if (tsc_pg->tsc_sequence == sequence) + return current_tick; + } + + return U64_MAX; +} + #else static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void) { -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/3] x86/hyperv: implement hv_get_tsc_page()
To use Hyper-V TSC page clocksource from vDSO we need to make tsc_pg available. Implement hv_get_tsc_page() and add CONFIG_HYPERV_TSCPAGE to make #ifdef-s simple. Signed-off-by: Vitaly Kuznetsov --- arch/x86/hyperv/hv_init.c | 9 +++-- arch/x86/include/asm/mshyperv.h | 8 drivers/hv/Kconfig | 3 +++ 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index b371d0e..0ce8485 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -27,10 +27,15 @@ #include -#ifdef CONFIG_X86_64 +#ifdef CONFIG_HYPERV_TSCPAGE static struct ms_hyperv_tsc_page *tsc_pg; +struct ms_hyperv_tsc_page *hv_get_tsc_page(void) +{ + return tsc_pg; +} + static u64 read_hv_clock_tsc(struct clocksource *arg) { u64 current_tick; @@ -136,7 +141,7 @@ void hyperv_init(void) /* * Register Hyper-V specific clocksource. */ -#ifdef CONFIG_X86_64 +#ifdef CONFIG_HYPERV_TSCPAGE if (ms_hyperv.features & HV_X64_MSR_REFERENCE_TSC_AVAILABLE) { union hv_x64_msr_hypercall_contents tsc_msr; diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyperv.h index f8dc370..14dd92c 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -173,4 +173,12 @@ void hyperv_report_panic(struct pt_regs *regs); bool hv_is_hypercall_page_setup(void); void hyperv_cleanup(void); #endif +#ifdef CONFIG_HYPERV_TSCPAGE +struct ms_hyperv_tsc_page *hv_get_tsc_page(void); +#else +static inline struct ms_hyperv_tsc_page *hv_get_tsc_page(void) +{ + return NULL; +} +#endif #endif diff --git a/drivers/hv/Kconfig b/drivers/hv/Kconfig index 0403b51..c29cd53 100644 --- a/drivers/hv/Kconfig +++ b/drivers/hv/Kconfig @@ -7,6 +7,9 @@ config HYPERV Select this option to run Linux as a Hyper-V client operating system. +config HYPERV_TSCPAGE + def_bool HYPERV && X86_64 + config HYPERV_UTILS tristate "Microsoft Hyper-V Utilities driver" depends on HYPERV && CONNECTOR && NLS -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Tuesday, February 14, 2017 4:44 AM > To: x...@kernel.org; Andy Lutomirski > Cc: Thomas Gleixner ; Ingo Molnar ; > H. Peter Anvin ; KY Srinivasan ; > Haiyang Zhang ; Stephen Hemminger > ; Dexuan Cui ; linux- > ker...@vger.kernel.org; de...@linuxdriverproject.org; > virtualizat...@lists.linux-foundation.org > Subject: [PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support > > Hi, > > while we're still waiting for a definitive ACK from Microsoft that the > algorithm > is good for SMP case (as we can't prevent the code in vdso from migrating > between CPUs) I'd like to send v2 with some modifications to keep the > discussion going. I checked with the folks on the Hyper-V side and they have confirmed that we need to add memory barriers in the guest code to ensure the various reads from the TSC page are correctly ordered - especially, the initial read of the sequence counter must have acquire semantics. We should ensure that other reads from the TSC page are completed before the second read of the sequence counter. I am working with the Windows team to correctly reflect this algorithm in the Hyper-V specification. Regards, K. Y > > Changes since v1: > - Document the TSC page reading protocol [Thomas Gleixner]. > > - Separate the TSC page reading code from read_hv_clock_tsc() and put it to > asm/mshyperv.h to use from both hv_init.c and vdso. > > - Add explicit barriers [Thomas Gleixner] > > Original description: > > Hyper-V TSC page clocksource is suitable for vDSO, however, the protocol > defined by the hypervisor is different from VCLOCK_PVCLOCK. Implemented > the required support. Simple sysbench test shows the following results: > > Before: > # time sysbench --test=memory --max-requests=50 run ... > real1m22.618s > user0m50.193s > sys 0m32.268s > > After: > # time sysbench --test=memory --max-requests=50 run ... > real 0m47.241s > user 0m47.117s > sys 0m0.008s > > Patches 1 and 2 are made on top of K. Y.'s code refactoring which moved tsc > page clocksource to arch/x86/hyperv/hv_init.c, this is currently present in > Greg's char-misc-next tree. > > Vitaly Kuznetsov (3): > x86/hyperv: implement hv_get_tsc_page() > x86/hyperv: move TSC reading method to asm/mshyperv.h > x86/vdso: Add VCLOCK_HVCLOCK vDSO clock read method > > arch/x86/entry/vdso/vclock_gettime.c | 24 +++ > arch/x86/entry/vdso/vdso-layout.lds.S | 3 +- > arch/x86/entry/vdso/vdso2c.c | 3 ++ > arch/x86/entry/vdso/vma.c | 7 + > arch/x86/hyperv/hv_init.c | 48 + > arch/x86/include/asm/clocksource.h| 3 +- > arch/x86/include/asm/mshyperv.h | 58 > +++ > arch/x86/include/asm/vdso.h | 1 + > drivers/hv/Kconfig| 3 ++ > 9 files changed, 114 insertions(+), 36 deletions(-) > > -- > 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support
On Tue, 14 Feb 2017, Vitaly Kuznetsov wrote: > Hi, > > while we're still waiting for a definitive ACK from Microsoft that the > algorithm is good for SMP case (as we can't prevent the code in vdso from > migrating between CPUs) I'd like to send v2 with some modifications to keep > the discussion going. Migration is irrelevant. The TSC page is guest global so updates will happen on some (random) host CPU and therefor you need the usual barriers like we have them in our seqcounts unless an access to the sequence will trap into the host, which would defeat the whole purpose of the TSC page. Thanks, tglx ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support
Thomas Gleixner writes: > On Tue, 14 Feb 2017, Vitaly Kuznetsov wrote: > >> Hi, >> >> while we're still waiting for a definitive ACK from Microsoft that the >> algorithm is good for SMP case (as we can't prevent the code in vdso from >> migrating between CPUs) I'd like to send v2 with some modifications to keep >> the discussion going. > > Migration is irrelevant. The TSC page is guest global so updates will > happen on some (random) host CPU and therefor you need the usual barriers > like we have them in our seqcounts unless an access to the sequence will > trap into the host, which would defeat the whole purpose of the TSC page. > KY Srinivasan writes: > I checked with the folks on the Hyper-V side and they have confirmed that we > need to > add memory barriers in the guest code to ensure the various reads from the > TSC page are > correctly ordered - especially, the initial read of the sequence counter must > have acquire > semantics. We should ensure that other reads from the TSC page are completed > before the > second read of the sequence counter. I am working with the Windows team to > correctly > reflect this algorithm in the Hyper-V specification. Thank you, do I get it right that combining the above I only need to replace virt_rmb() barriers with plain rmb() to get 'lfence' in hv_read_tsc_page (PATCH 2)? As members of struct ms_hyperv_tsc_page are volatile we don't need READ_ONCE(), compilers are not allowed to merge accesses. The resulting code looks good to me: (gdb) disassemble read_hv_clock_tsc Dump of assembler code for function read_hv_clock_tsc: 0x8102ca60 <+0>: callq 0x816c7500 <__fentry__> 0x8102ca65 <+5>: mov0xf67974(%rip),%rcx# 0x81f943e0 0x8102ca6c <+12>:jmp0x8102ca87 0x8102ca6e <+14>:lfence 0x8102ca71 <+17>:mov0x8(%rcx),%r9 0x8102ca75 <+21>:mov0x10(%rcx),%r8 0x8102ca79 <+25>:nop 0x8102ca7a <+26>:nop 0x8102ca7b <+27>:nop 0x8102ca7c <+28>:rdtsc 0x8102ca7e <+30>:lfence 0x8102ca81 <+33>:mov(%rcx),%edi 0x8102ca83 <+35>:cmp%edi,%esi 0x8102ca85 <+37>:je 0x8102caa3 0x8102ca87 <+39>:mov(%rcx),%esi 0x8102ca89 <+41>:test %esi,%esi 0x8102ca8b <+43>:jne0x8102ca6e 0x8102ca8d <+45>:push %rbp 0x8102ca8e <+46>:mov$0x4020,%edi 0x8102ca93 <+51>:mov%rsp,%rbp 0x8102ca96 <+54>:and$0xfff0,%rsp 0x8102ca9a <+58>:callq *0x81c36330 0x8102caa1 <+65>:leaveq 0x8102caa2 <+66>:retq 0x8102caa3 <+67>:shl$0x20,%rdx 0x8102caa7 <+71>:or %rdx,%rax 0x8102caaa <+74>:mul%r9 0x8102caad <+77>:mov%rdx,%rax 0x8102cab0 <+80>:add%r8,%rax 0x8102cab3 <+83>:cmp$0x,%rax 0x8102cab7 <+87>:je 0x8102ca8d 0x8102cab9 <+89>:repz retq End of assembler dump. -- Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/3 staging-next] mm: Remove RCU and tasklocks from lmk
From: Peter Enderborg Fundamental changes: 1 Does NOT take any RCU lock in shrinker functions. 2 It returns same result for scan and counts, so we dont need to do shinker will know when it is pointless to call scan. 3 It does not lock any other process than the one that is going to be killed. Background. The low memory killer scans for process that can be killed to free memory. This can be cpu consuming when there is a high demand for memory. This can be seen by analysing the kswapd0 task work. The stats function added in earler patch adds a counter for waste work. How it works. This patch create a structure within the lowmemory killer that caches the user spaces processes that it might kill. It is done with a sorted rbtree so we can very easy find the candidate to be killed, and knows its properies as memory usage and sorted by oom_score_adj to look up the task with highest oom_score_adj. To be able to achive this it uses oom_score_notify events. This patch also as a other effect, we are now free to do other lowmemorykiller configurations. Without the patch there is a need for a tradeoff between freed memory and task and rcu locks. This is no longer a concern for tuning lmk. This patch is not intended to do any calculation changes other than we do use the cache for calculate the count values and that makes kswapd0 to shrink other areas. Signed-off-by: Peter Enderborg --- drivers/staging/android/Kconfig | 1 + drivers/staging/android/Makefile| 1 + drivers/staging/android/lowmemorykiller.c | 294 +++- drivers/staging/android/lowmemorykiller.h | 15 ++ drivers/staging/android/lowmemorykiller_stats.c | 24 ++ drivers/staging/android/lowmemorykiller_stats.h | 14 +- drivers/staging/android/lowmemorykiller_tasks.c | 220 ++ drivers/staging/android/lowmemorykiller_tasks.h | 35 +++ 8 files changed, 498 insertions(+), 106 deletions(-) create mode 100644 drivers/staging/android/lowmemorykiller.h create mode 100644 drivers/staging/android/lowmemorykiller_tasks.c create mode 100644 drivers/staging/android/lowmemorykiller_tasks.h diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 96e86c7..899186c 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -16,6 +16,7 @@ config ASHMEM config ANDROID_LOW_MEMORY_KILLER bool "Android Low Memory Killer" + select OOM_SCORE_NOTIFIER ---help--- Registers processes to be killed when low memory conditions, this is useful as there is no particular swap space on android. diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index d710eb2..b7a8036 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -4,4 +4,5 @@ obj-y += ion/ obj-$(CONFIG_ASHMEM) += ashmem.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o +obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller_tasks.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER_STATS) += lowmemorykiller_stats.o diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index 15c1b38..1e275b1 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -41,10 +41,14 @@ #include #include #include +#include #include +#include +#include "lowmemorykiller.h" #include "lowmemorykiller_stats.h" +#include "lowmemorykiller_tasks.h" -static u32 lowmem_debug_level = 1; +u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { 0, 1, @@ -62,135 +66,212 @@ static int lowmem_minfree[6] = { static int lowmem_minfree_size = 4; -static unsigned long lowmem_deathpending_timeout; - -#define lowmem_print(level, x...) \ - do {\ - if (lowmem_debug_level >= (level)) \ - pr_info(x); \ - } while (0) - -static unsigned long lowmem_count(struct shrinker *s, - struct shrink_control *sc) -{ - lmk_inc_stats(LMK_COUNT); - return global_node_page_state(NR_ACTIVE_ANON) + - global_node_page_state(NR_ACTIVE_FILE) + - global_node_page_state(NR_INACTIVE_ANON) + - global_node_page_state(NR_INACTIVE_FILE); -} +struct calculated_params { + long selected_tasksize; + long minfree; + int other_file; + int other_free; + int dynamic_max_queue_len; + short selected_oom_score_adj; + short min_score_adj; +}; -static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) +static int kill_needed(int level, struct shrink_control *sc, + struct calculated_params *cp) { - struct task_struct *tsk; - struct task_stru
[PATCH 2/3 staging-next] oom: Add notification for oom_score_adj
From: Peter Enderborg This adds subscribtion for changes in oom_score_adj, this value is important to android systems. For task that uses oom_score_adj they read the task list. This can be long and need rcu locks and has a impact on the system. Let the user track the changes based on oom_score_adj changes and keep them in their own context so they do their actions with minimal system impact. Signed-off-by: Peter Enderborg --- fs/proc/base.c | 13 +++ include/linux/oom_score_notifier.h | 47 kernel/Makefile| 1 + kernel/fork.c | 6 +++ kernel/oom_score_notifier.c| 75 ++ mm/Kconfig | 9 + 6 files changed, 151 insertions(+) create mode 100644 include/linux/oom_score_notifier.h create mode 100644 kernel/oom_score_notifier.c diff --git a/fs/proc/base.c b/fs/proc/base.c index 87c9a9a..60c2d9b 100644 --- a/fs/proc/base.c +++ b/fs/proc/base.c @@ -87,6 +87,7 @@ #include #include #include +#include #ifdef CONFIG_HARDWALL #include #endif @@ -1057,6 +1058,7 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy) static DEFINE_MUTEX(oom_adj_mutex); struct mm_struct *mm = NULL; struct task_struct *task; + int old_oom_score_adj; int err = 0; task = get_proc_task(file_inode(file)); @@ -1102,9 +1104,20 @@ static int __set_oom_adj(struct file *file, int oom_adj, bool legacy) } } + old_oom_score_adj = task->signal->oom_score_adj; task->signal->oom_score_adj = oom_adj; if (!legacy && has_capability_noaudit(current, CAP_SYS_RESOURCE)) task->signal->oom_score_adj_min = (short)oom_adj; + +#ifdef CONFIG_OOM_SCORE_NOTIFIER + err = oom_score_notify_update(task, old_oom_score_adj); + if (err) { + /* rollback and error handle. */ + task->signal->oom_score_adj = old_oom_score_adj; + goto err_unlock; + } +#endif + trace_oom_score_adj_update(task); if (mm) { diff --git a/include/linux/oom_score_notifier.h b/include/linux/oom_score_notifier.h new file mode 100644 index 000..c5cea47 --- /dev/null +++ b/include/linux/oom_score_notifier.h @@ -0,0 +1,47 @@ +/* + * oom_score_notifier interface + * Copyright (C) 2017 Sony Mobile Communications Inc. + * + * Author: Peter Enderborg + * + * 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. + */ + +#ifndef _LINUX_OOM_SCORE_NOTIFIER_H +#define _LINUX_OOM_SCORE_NOTIFIER_H + +#ifdef CONFIG_OOM_SCORE_NOTIFIER + +#include +#include +#include + +enum osn_msg_type { + OSN_NEW, + OSN_FREE, + OSN_UPDATE +}; + +extern struct atomic_notifier_head oom_score_notifier; +extern int oom_score_notifier_register(struct notifier_block *n); +extern int oom_score_notifier_unregister(struct notifier_block *n); +extern int oom_score_notify_free(struct task_struct *tsk); +extern int oom_score_notify_new(struct task_struct *tsk); +extern int oom_score_notify_update(struct task_struct *tsk, int old_score); + +struct oom_score_notifier_struct { + struct task_struct *tsk; + int old_score; +}; + +#else + +#define oom_score_notify_free(t) do {} while (0) +#define oom_score_notify_new(t) false +#define oom_score_notify_update(t, s) do {} while (0) + +#endif /* CONFIG_OOM_SCORE_NOTIFIER */ + +#endif /* _LINUX_OOM_SCORE_NOTIFIER_H */ diff --git a/kernel/Makefile b/kernel/Makefile index 12c679f..747c66c 100644 --- a/kernel/Makefile +++ b/kernel/Makefile @@ -91,6 +91,7 @@ obj-$(CONFIG_SYSCTL) += utsname_sysctl.o obj-$(CONFIG_TASK_DELAY_ACCT) += delayacct.o obj-$(CONFIG_TASKSTATS) += taskstats.o tsacct.o obj-$(CONFIG_TRACEPOINTS) += tracepoint.o +obj-$(CONFIG_OOM_SCORE_NOTIFIER) += oom_score_notifier.o obj-$(CONFIG_LATENCYTOP) += latencytop.o obj-$(CONFIG_ELFCORE) += elfcore.o obj-$(CONFIG_FUNCTION_TRACER) += trace/ diff --git a/kernel/fork.c b/kernel/fork.c index 11c5c8a..f8a1a89 100644 --- a/kernel/fork.c +++ b/kernel/fork.c @@ -73,6 +73,7 @@ #include #include #include +#include #include #include #include @@ -391,6 +392,7 @@ void __put_task_struct(struct task_struct *tsk) exit_creds(tsk); delayacct_tsk_free(tsk); put_signal_struct(tsk->signal); + oom_score_notify_free(tsk); if (!profile_handoff_task(tsk)) free_task(tsk); @@ -1790,6 +1792,10 @@ static __latent_entropy struct task_struct *copy_process( init_task_pid(p, PIDTYPE_PID, pid); if (thread_group_leader(p)) { + retval = oom_score_notify_new(p); + if (retval) + goto bad_fork_cancel_cgroup; + init_task_pid(p,
[PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
From: Peter Enderborg This collects stats for shrinker calls and how much waste work we do within the lowmemorykiller. Signed-off-by: Peter Enderborg --- drivers/staging/android/Kconfig | 11 drivers/staging/android/Makefile| 1 + drivers/staging/android/lowmemorykiller.c | 9 ++- drivers/staging/android/lowmemorykiller_stats.c | 85 + drivers/staging/android/lowmemorykiller_stats.h | 29 + 5 files changed, 134 insertions(+), 1 deletion(-) create mode 100644 drivers/staging/android/lowmemorykiller_stats.c create mode 100644 drivers/staging/android/lowmemorykiller_stats.h diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig index 6c00d6f..96e86c7 100644 --- a/drivers/staging/android/Kconfig +++ b/drivers/staging/android/Kconfig @@ -24,6 +24,17 @@ config ANDROID_LOW_MEMORY_KILLER scripts (/init.rc), and it defines priority values with minimum free memory size for each priority. +config ANDROID_LOW_MEMORY_KILLER_STATS + bool "Android Low Memory Killer: collect statistics" + depends on ANDROID_LOW_MEMORY_KILLER + default n + help + Create a file in /proc/lmkstats that includes + collected statistics about kills, scans and counts + and interaction with the shrinker. Its content + will be different depeding on lmk implementation used. + + source "drivers/staging/android/ion/Kconfig" endif # if ANDROID diff --git a/drivers/staging/android/Makefile b/drivers/staging/android/Makefile index 7ed1be7..d710eb2 100644 --- a/drivers/staging/android/Makefile +++ b/drivers/staging/android/Makefile @@ -4,3 +4,4 @@ obj-y += ion/ obj-$(CONFIG_ASHMEM) += ashmem.o obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER)+= lowmemorykiller.o +obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER_STATS) += lowmemorykiller_stats.o diff --git a/drivers/staging/android/lowmemorykiller.c b/drivers/staging/android/lowmemorykiller.c index ec3b665..15c1b38 100644 --- a/drivers/staging/android/lowmemorykiller.c +++ b/drivers/staging/android/lowmemorykiller.c @@ -42,6 +42,7 @@ #include #include #include +#include "lowmemorykiller_stats.h" static u32 lowmem_debug_level = 1; static short lowmem_adj[6] = { @@ -72,6 +73,7 @@ static unsigned long lowmem_deathpending_timeout; static unsigned long lowmem_count(struct shrinker *s, struct shrink_control *sc) { + lmk_inc_stats(LMK_COUNT); return global_node_page_state(NR_ACTIVE_ANON) + global_node_page_state(NR_ACTIVE_FILE) + global_node_page_state(NR_INACTIVE_ANON) + @@ -95,6 +97,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) global_node_page_state(NR_SHMEM) - total_swapcache_pages(); + lmk_inc_stats(LMK_SCAN); if (lowmem_adj_size < array_size) array_size = lowmem_adj_size; if (lowmem_minfree_size < array_size) @@ -134,6 +137,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) if (task_lmk_waiting(p) && time_before_eq(jiffies, lowmem_deathpending_timeout)) { task_unlock(p); + lmk_inc_stats(LMK_TIMEOUT); rcu_read_unlock(); return 0; } @@ -179,7 +183,9 @@ static unsigned long lowmem_scan(struct shrinker *s, struct shrink_control *sc) other_free * (long)(PAGE_SIZE / 1024)); lowmem_deathpending_timeout = jiffies + HZ; rem += selected_tasksize; - } + lmk_inc_stats(LMK_KILL); + } else + lmk_inc_stats(LMK_WASTE); lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n", sc->nr_to_scan, sc->gfp_mask, rem); @@ -196,6 +202,7 @@ static struct shrinker lowmem_shrinker = { static int __init lowmem_init(void) { register_shrinker(&lowmem_shrinker); + init_procfs_lmk(); return 0; } device_initcall(lowmem_init); diff --git a/drivers/staging/android/lowmemorykiller_stats.c b/drivers/staging/android/lowmemorykiller_stats.c new file mode 100644 index 000..673691c --- /dev/null +++ b/drivers/staging/android/lowmemorykiller_stats.c @@ -0,0 +1,85 @@ +/* + * lowmemorykiller_stats + * + * Copyright (C) 2017 Sony Mobile Communications Inc. + * + * Author: Peter Enderborg + * + * 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 code is bookkeeping of statistical information + * from lowmemorykiller and provide a node in proc "/proc/lmkstats". + */ + +#include +#include +#include "
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
On Tue, Feb 14, 2017 at 05:09:30PM +0100, peter.enderb...@sonymobile.com wrote: > From: Peter Enderborg > > This collects stats for shrinker calls and how much > waste work we do within the lowmemorykiller. > > Signed-off-by: Peter Enderborg > --- > drivers/staging/android/Kconfig | 11 > drivers/staging/android/Makefile| 1 + > drivers/staging/android/lowmemorykiller.c | 9 ++- > drivers/staging/android/lowmemorykiller_stats.c | 85 > + > drivers/staging/android/lowmemorykiller_stats.h | 29 + > 5 files changed, 134 insertions(+), 1 deletion(-) > create mode 100644 drivers/staging/android/lowmemorykiller_stats.c > create mode 100644 drivers/staging/android/lowmemorykiller_stats.h > > diff --git a/drivers/staging/android/Kconfig b/drivers/staging/android/Kconfig > index 6c00d6f..96e86c7 100644 > --- a/drivers/staging/android/Kconfig > +++ b/drivers/staging/android/Kconfig > @@ -24,6 +24,17 @@ config ANDROID_LOW_MEMORY_KILLER > scripts (/init.rc), and it defines priority values with minimum free > memory size > for each priority. > > +config ANDROID_LOW_MEMORY_KILLER_STATS > + bool "Android Low Memory Killer: collect statistics" > + depends on ANDROID_LOW_MEMORY_KILLER > + default n > + help > + Create a file in /proc/lmkstats that includes > + collected statistics about kills, scans and counts > + and interaction with the shrinker. Its content > + will be different depeding on lmk implementation used. Ick, no new /proc files please, this isn't a "process" value. What's wrong with debugfs? Also note the minor ' ' usage in your first sentence of the help text. > source "drivers/staging/android/ion/Kconfig" > > endif # if ANDROID > diff --git a/drivers/staging/android/Makefile > b/drivers/staging/android/Makefile > index 7ed1be7..d710eb2 100644 > --- a/drivers/staging/android/Makefile > +++ b/drivers/staging/android/Makefile > @@ -4,3 +4,4 @@ obj-y += ion/ > > obj-$(CONFIG_ASHMEM) += ashmem.o > obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER) += lowmemorykiller.o > +obj-$(CONFIG_ANDROID_LOW_MEMORY_KILLER_STATS)+= > lowmemorykiller_stats.o > diff --git a/drivers/staging/android/lowmemorykiller.c > b/drivers/staging/android/lowmemorykiller.c > index ec3b665..15c1b38 100644 > --- a/drivers/staging/android/lowmemorykiller.c > +++ b/drivers/staging/android/lowmemorykiller.c > @@ -42,6 +42,7 @@ > #include > #include > #include > +#include "lowmemorykiller_stats.h" > > static u32 lowmem_debug_level = 1; > static short lowmem_adj[6] = { > @@ -72,6 +73,7 @@ static unsigned long lowmem_deathpending_timeout; > static unsigned long lowmem_count(struct shrinker *s, > struct shrink_control *sc) > { > + lmk_inc_stats(LMK_COUNT); > return global_node_page_state(NR_ACTIVE_ANON) + > global_node_page_state(NR_ACTIVE_FILE) + > global_node_page_state(NR_INACTIVE_ANON) + > @@ -95,6 +97,7 @@ static unsigned long lowmem_scan(struct shrinker *s, struct > shrink_control *sc) > global_node_page_state(NR_SHMEM) - > total_swapcache_pages(); > > + lmk_inc_stats(LMK_SCAN); > if (lowmem_adj_size < array_size) > array_size = lowmem_adj_size; > if (lowmem_minfree_size < array_size) > @@ -134,6 +137,7 @@ static unsigned long lowmem_scan(struct shrinker *s, > struct shrink_control *sc) > if (task_lmk_waiting(p) && > time_before_eq(jiffies, lowmem_deathpending_timeout)) { > task_unlock(p); > + lmk_inc_stats(LMK_TIMEOUT); > rcu_read_unlock(); > return 0; > } > @@ -179,7 +183,9 @@ static unsigned long lowmem_scan(struct shrinker *s, > struct shrink_control *sc) >other_free * (long)(PAGE_SIZE / 1024)); > lowmem_deathpending_timeout = jiffies + HZ; > rem += selected_tasksize; > - } > + lmk_inc_stats(LMK_KILL); > + } else > + lmk_inc_stats(LMK_WASTE); > > lowmem_print(4, "lowmem_scan %lu, %x, return %lu\n", >sc->nr_to_scan, sc->gfp_mask, rem); > @@ -196,6 +202,7 @@ static struct shrinker lowmem_shrinker = { > static int __init lowmem_init(void) > { > register_shrinker(&lowmem_shrinker); > + init_procfs_lmk(); > return 0; > } > device_initcall(lowmem_init); > diff --git a/drivers/staging/android/lowmemorykiller_stats.c > b/drivers/staging/android/lowmemorykiller_stats.c > new file mode 100644 > index 000..673691c > --- /dev/null > +++ b/drivers/staging/android/lowmemorykiller_stats.c > @@ -0,0 +1,85 @@ > +/* > + * lowmemorykiller_stats > + * > + * Copyright (C) 2017 Sony Mobile Communications Inc.
Re: [PATCH 1/3 staging-next] android: Collect statistics from lowmemorykiller
On Tue, Feb 14, 2017 at 05:09:30PM +0100, peter.enderb...@sonymobile.com wrote: > From: Peter Enderborg > > This collects stats for shrinker calls and how much > waste work we do within the lowmemorykiller. > > Signed-off-by: Peter Enderborg Wait, what changed from the previous versions of this patch? Did you take the review comments into consideration, or is this just a resend of the original patches in a format that isn't corrupted? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: gdm724x: Fix sparse warnings
El 14/02/17 a las 10:24, maomao xu escribió: drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment (different base types) drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 [addressable] [assigned] [usertype] icmp6_cksum drivers/staging/gdm724x/gdm_lte.c:311:39:got int Signed-off-by: maomao xu diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index a3e046c..ddec6d0 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -308,7 +308,7 @@ static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) memcpy(icmp_na + sizeof(struct icmp6hdr), &na, sizeof(struct neighbour_advertisement)); - icmp6_out.icmp6_cksum = icmp6_checksum(&ipv6_out, + icmp6_out.icmp6_cksum = (__force __sum16)icmp6_checksum(&ipv6_out, (u16 *)icmp_na, sizeof(icmp_na)); } else { return -1; This is not correct. You should use the kernel checksum functions in icmp6_checksum. I have a patch ready to be submitted. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 21/24] media: imx: Add MIPI CSI-2 Receiver subdev driver
Hi Steve, On Mon, 2017-02-13 at 15:20 -0800, Steve Longerbeam wrote: [...] > > It seems the OV5640 driver never puts its the CSI-2 lanes into stop > > state while not streaming. > > Yes I found that as well. > > But good news, I finally managed to coax the OV5640's clock lane > into LP-11 state! It was accomplished by setting bit 5 in OV5640 register > 0x4800. The datasheet describes this bit as "Gate clock lane when no > packet to transmit". But I may have also got this to work with the > additional > write 1 to bits 4-6 in register 0x3019 ("MIPI CLK/data lane state in sleep > mode" - setting 1 to these bits selects LP-11 for sleep mode). > > So I am now finally able to call csi2_dphy_wait_stopstate() in > csi2_s_stream(ON). That's good news. > So for the TC35874, you shouldn't see a timeout in csi2_s_stream(ON) > any longer. > > I have updated both ov5640.c and imx6-mipi-csi2.c in the wip branch. > Can you try again? I have not applied your patch below, because I > don't think that is needed anymore. Thanks, I'll test tomorrow. > And speaking of the TC35874, I received this module for the SabreLite > from Boundary Devices (thanks BD!). So I can finally help you with > debug/test. Are there any patches you need to send to me (against > wip branch) for this support, or can I use what exists now in media > tree? Also any scripts or help with running. That's even better news. I have pushed my my wip branch, which contains some colorspace work and experiments to pass through query/g_/s_std subdev calls so bypassing the pipeline can be avoided. Also, there's the Nitrogen6X device tree that I've been using to test: https://git.pengutronix.de/git/pza/linux imx-media-staging-md-wip > > With the recent s_stream reordering, > > streaming from TC358743 does not work anymore, since imx6-mipi-csi2 > > s_stream is called before tc358743 s_stream, while all lanes are still > > in stop state. Then it waits for the clock lane to become active and > > fails. I have applied the following patch to revert the reordering > > locally to get it to work again. > > > > The initialization order, as Russell pointed out, should be: > > > > 1. reset the D-PHY. > > 2. place MIPI sensor in LP-11 state > > 3. perform D-PHY initialisation > > 4. configure CSI2 lanes and de-assert resets and shutdown signals > > > > So csi2_s_stream should wait for stop state on all lanes (the result of > > 2.) before dphy_init (3.), not wait for active clock afterwards. That > > should happen only after sensor_s_stream was called. So unless we are > > allowed to reorder steps 1. and 2., we might need the prepare_stream > > callback after all. > > Agreed! > > See my new FIXME comment in imx6-mipi-csi2.c. Looks good. I wonder if enabling the phy clock isn't part of step 3. though. > I agree we might need a new subdev op .prepare_stream(). This > op would be implemented by imx6-mipi-csi2.c, and would carry > out steps 3, 4, 5 (instead of currently by csi2_s_stream()). Then > step 6 would finally become available as csi2_s_stream(). > > And then we must re-order stream on to start sensor first, then > csi2, as in your patch below. regards Philipp ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging:nvec:nvec_ps2.c: Prefering kzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct serio)...)
Prefer kzalloc(sizeof(*ser_dev)...) over kzalloc(sizeof(struct serio)...) as reported by checkpatch.pl. Signed-off-by: Arushi Singhal --- drivers/staging/nvec/nvec_ps2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/nvec/nvec_ps2.c b/drivers/staging/nvec/nvec_ps2.c index 499952c8ef39..3b7bce3ffd19 100644 --- a/drivers/staging/nvec/nvec_ps2.c +++ b/drivers/staging/nvec/nvec_ps2.c @@ -107,7 +107,7 @@ static int nvec_mouse_probe(struct platform_device *pdev) struct nvec_chip *nvec = dev_get_drvdata(pdev->dev.parent); struct serio *ser_dev; - ser_dev = kzalloc(sizeof(struct serio), GFP_KERNEL); + ser_dev = kzalloc(sizeof(*ser_dev), GFP_KERNEL); if (!ser_dev) return -ENOMEM; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/1] Staging: vc04_services: Fix the "wrong indent" code style errors
On Mon, Feb 13, 2017 at 06:12:31PM +0900, Mandel Benjamin wrote: > > This patch fixes the following code style errors: > > ERROR: code indent should use tabs where possible > > Signed-off-by: Mandel Benjamin > --- > drivers/staging/vc04_services/interface/vchi/vchi_common.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) How can this be patch 0/1 when it really is a patch? Please fix this up, and resend all of your stuff, I've dropped all of your pending patches from my queues as I don't know what to do with them at the moment. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: vt6656: Alignment match open parenthesis
On Mon, Feb 13, 2017 at 04:01:13AM +0530, Arushi Singhal wrote: > Fix checkpatch issues: "CHECK: Alignment should match open parenthesis" > > Signed-off-by: Arushi Singhal > --- > drivers/staging/vt6656/firmware.c | 34 +- > drivers/staging/vt6656/key.h | 2 +- > drivers/staging/vt6656/rf.c | 12 ++-- > drivers/staging/vt6656/usbpipe.c | 12 ++-- > drivers/staging/vt6656/wcmd.c | 2 +- > 5 files changed, 31 insertions(+), 31 deletions(-) You sent two different patches that do different things, yet you have the same exact subject line. Please fix up and resend both of them with unique subjects. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCHv6 1/3] staging: wlan-ng: move logical continuations at the end of line
On Mon, Feb 13, 2017 at 09:25:49AM -0500, Maksymilian Piechota wrote: > move logical continuations at the end of line > > Signed-off-by: Maksymilian Piechota > --- > drivers/staging/wlan-ng/prism2mgmt.c | 5 ++--- > 1 file changed, 2 insertions(+), 3 deletions(-) > > diff --git a/drivers/staging/wlan-ng/prism2mgmt.c > b/drivers/staging/wlan-ng/prism2mgmt.c > index 16fb2d3..64a9ebc 100644 > --- a/drivers/staging/wlan-ng/prism2mgmt.c > +++ b/drivers/staging/wlan-ng/prism2mgmt.c > @@ -1308,9 +1308,8 @@ int prism2mgmt_wlansniff(struct wlandevice *wlandev, > void *msgp) > hw->sniffhdr = 0; > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; > } else > - if ((msg->wlanheader.status == > - P80211ENUM_msgitem_status_data_ok) > - && (msg->wlanheader.data == P80211ENUM_truth_true)) { > + if ((msg->wlanheader.status == > P80211ENUM_msgitem_status_data_ok) && > + (msg->wlanheader.data == P80211ENUM_truth_true)) { > hw->sniffhdr = 1; > wlandev->netdev->type = ARPHRD_IEEE80211_PRISM; > } else { This patch has checkpatch.pl errors. Please always use checkpatch so you don't get emails from grumpy maintainers telling you to fix the checkpatch errors :) Please fix up and resend the whole series. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: gdm724x: modify icmp6_checksum for returning a correct data type.
The icmp6_checksum was returning an invalid data type as the expected type is __sum16. For returning such data type, icmp6_checksum, now, is using the kernel functions for computing the checksum. Here, the sparse message: drivers/staging/gdm724x/gdm_lte.c:311:39: warning: incorrect type in assignment (different base types) drivers/staging/gdm724x/gdm_lte.c:311:39:expected restricted __sum16 [addressable] [assigned] [usertype] icmp6_cksum drivers/staging/gdm724x/gdm_lte.c:311:39:got int Signed-off-by: Javier Rodriguez --- drivers/staging/gdm724x/gdm_lte.c | 15 ++- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/drivers/staging/gdm724x/gdm_lte.c b/drivers/staging/gdm724x/gdm_lte.c index 6792a1d..b6e59e6 100644 --- a/drivers/staging/gdm724x/gdm_lte.c +++ b/drivers/staging/gdm724x/gdm_lte.c @@ -178,10 +178,10 @@ static int gdm_lte_emulate_arp(struct sk_buff *skb_in, u32 nic_type) return 0; } -static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len) +static __sum16 icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len) { unsigned short *w = ptr; - int sum = 0; + __wsum sum = 0; int i; union { @@ -203,19 +203,16 @@ static int icmp6_checksum(struct ipv6hdr *ipv6, u16 *ptr, int len) w = (u16 *)&pseudo_header; for (i = 0; i < ARRAY_SIZE(pseudo_header.pa); i++) - sum += pseudo_header.pa[i]; + sum = csum_add(sum, csum_unfold( + (__force __sum16)pseudo_header.pa[i])); w = ptr; while (len > 1) { - sum += *w++; + sum = csum_add(sum, csum_unfold((__force __sum16)*w++)); len -= 2; } - sum = (sum >> 16) + (sum & 0x); - sum += (sum >> 16); - sum = ~sum & 0x; - - return sum; + return csum_fold(sum); } static int gdm_lte_emulate_ndp(struct sk_buff *skb_in, u32 nic_type) -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: wlan-ng: Fixed code style issue:
On Mon, Feb 13, 2017 at 09:20:05AM -0500, Bo YU wrote: > Statements should start on a tabstop > > Signed-off-by: YU Bo > --- > drivers/staging/wlan-ng/prism2mgmt.c |3 +-- > 1 file changed, 1 insertion(+), 2 deletions(-) Patch does not apply to my tree :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH]staging: fbtft: Fix sparse warnings about endianness
On Tue, Feb 14, 2017 at 04:53:10PM +0800, maomao xu wrote: > Fixed sparse warnings about endianness. E.g.: > > warning: incorrect type in assignment (different base types) Why are these lines indented? > Signed-off-by: maomao xu > > diff --git a/drivers/staging/fbtft/fbtft-io.c > b/drivers/staging/fbtft/fbtft-io.c > index d868405..ffb9a3b 100644 > --- a/drivers/staging/fbtft/fbtft-io.c > +++ b/drivers/staging/fbtft/fbtft-io.c > @@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void > *buf, size_t len) > src++; > } > tmp |= ((*src & 0x0100) ? 1 : 0); > - *(u64 *)dst = cpu_to_be64(tmp); > + *(__be64 *)dst = cpu_to_be64(tmp); Really? That seems very odd. I need a maintainer's ack for this before I can take it... thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 01/25] Staging: rtl8192u: r819xU_phy.c - style fix
On Mon, Feb 13, 2017 at 06:39:06PM +1300, Derek Robson wrote: > Fixed style of block comments > Found using checkpatch > > Signed-off-by: Derek Robson > --- > drivers/staging/rtl8192u/r819xU_phy.c | 41 > +++ > 1 file changed, 27 insertions(+), 14 deletions(-) This patch is already in my tree. Please rebase your series against my latest tree and resend only the ones that I need to apply. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/15] staging: rtl8192u: fixing white space issue
On Tue, Feb 14, 2017 at 02:33:34AM +0530, simran singhal wrote: > Fix the following checkpatch.pl error and warnings: > WARNING: please, no space before tabs > > Signed-off-by: simran singhal > --- > drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) You said this is a 15 patch patch series, yet I only received 9 of them. Please fix and resend all of them, properly threaded (hint, git send-email will do this for you automatically, or you can do it by hand with a good email client like mutt), so that I know I get them all and can review and apply them. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/3] x86/vdso: Add Hyper-V TSC page clocksource support
On Tue, Feb 14, 2017 at 7:50 AM, Vitaly Kuznetsov wrote: > Thomas Gleixner writes: > >> On Tue, 14 Feb 2017, Vitaly Kuznetsov wrote: >> >>> Hi, >>> >>> while we're still waiting for a definitive ACK from Microsoft that the >>> algorithm is good for SMP case (as we can't prevent the code in vdso from >>> migrating between CPUs) I'd like to send v2 with some modifications to keep >>> the discussion going. >> >> Migration is irrelevant. The TSC page is guest global so updates will >> happen on some (random) host CPU and therefor you need the usual barriers >> like we have them in our seqcounts unless an access to the sequence will >> trap into the host, which would defeat the whole purpose of the TSC page. >> > > KY Srinivasan writes: > >> I checked with the folks on the Hyper-V side and they have confirmed that we >> need to >> add memory barriers in the guest code to ensure the various reads from the >> TSC page are >> correctly ordered - especially, the initial read of the sequence counter >> must have acquire >> semantics. We should ensure that other reads from the TSC page are completed >> before the >> second read of the sequence counter. I am working with the Windows team to >> correctly >> reflect this algorithm in the Hyper-V specification. > > > Thank you, > > do I get it right that combining the above I only need to replace > virt_rmb() barriers with plain rmb() to get 'lfence' in hv_read_tsc_page > (PATCH 2)? As members of struct ms_hyperv_tsc_page are volatile we don't > need READ_ONCE(), compilers are not allowed to merge accesses. The > resulting code looks good to me: No, on multiple counts, unfortunately. 1. LFENCE is basically useless except for IO and for (Intel only) rdtsc_ordered(). AFAIK there is literally no scenario under which LFENCE is useful for access to normal memory. 2. The problem here has little to do with barriers. You're doing: read seq; read var1; read var2; read tsc; read seq again; If the hypervisor updates things between reading var1 and var2 or between reading var2 and tsc, you aren't guaranteed to notice unless something fancy is going on regardless of barriers. Similarly, if the hypervisor starts updating, then you start and finish the whole function, and then the hypervisor finishes, what guarantees you notice? This really needs a spec from the hypervisor folks as to what's going on. KVM does this horrible thing in which it sometimes freezes all vCPUs when updating, for better or for worse. Mostly for worse. If MS does the same thing, they should document it. 3. You need rdtsc_ordered(). Plain RDTSC is not ordered wrt other memory access, and it can observably screw up as a result. Also, Linux tries to avoid volatile variables, so please use READ_ONCE(). > > (gdb) disassemble read_hv_clock_tsc > Dump of assembler code for function read_hv_clock_tsc: >0x8102ca60 <+0>: callq 0x816c7500 <__fentry__> >0x8102ca65 <+5>: mov0xf67974(%rip),%rcx# > 0x81f943e0 >0x8102ca6c <+12>:jmp0x8102ca87 > >0x8102ca6e <+14>:lfence >0x8102ca71 <+17>:mov0x8(%rcx),%r9 >0x8102ca75 <+21>:mov0x10(%rcx),%r8 >0x8102ca79 <+25>:nop >0x8102ca7a <+26>:nop >0x8102ca7b <+27>:nop >0x8102ca7c <+28>:rdtsc >0x8102ca7e <+30>:lfence >0x8102ca81 <+33>:mov(%rcx),%edi >0x8102ca83 <+35>:cmp%edi,%esi >0x8102ca85 <+37>:je 0x8102caa3 > >0x8102ca87 <+39>:mov(%rcx),%esi >0x8102ca89 <+41>:test %esi,%esi >0x8102ca8b <+43>:jne0x8102ca6e > >0x8102ca8d <+45>:push %rbp >0x8102ca8e <+46>:mov$0x4020,%edi >0x8102ca93 <+51>:mov%rsp,%rbp >0x8102ca96 <+54>:and$0xfff0,%rsp >0x8102ca9a <+58>:callq *0x81c36330 >0x8102caa1 <+65>:leaveq >0x8102caa2 <+66>:retq >0x8102caa3 <+67>:shl$0x20,%rdx >0x8102caa7 <+71>:or %rdx,%rax >0x8102caaa <+74>:mul%r9 >0x8102caad <+77>:mov%rdx,%rax >0x8102cab0 <+80>:add%r8,%rax >0x8102cab3 <+83>:cmp$0x,%rax >0x8102cab7 <+87>:je 0x8102ca8d > >0x8102cab9 <+89>:repz retq > End of assembler dump. > > -- > Vitaly -- Andy Lutomirski AMA Capital Management, LLC ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/15] staging: rtl8192u: fixing white space issue
While resending them ...do I have to mention v2. On Tue, Feb 14, 2017 at 10:54 PM, Greg KH wrote: > On Tue, Feb 14, 2017 at 02:33:34AM +0530, simran singhal wrote: >> Fix the following checkpatch.pl error and warnings: >> WARNING: please, no space before tabs >> >> Signed-off-by: simran singhal >> --- >> drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) > > You said this is a 15 patch patch series, yet I only received 9 of them. > > Please fix and resend all of them, properly threaded (hint, git > send-email will do this for you automatically, or you can do it by hand > with a good email client like mutt), so that I know I get them all and > can review and apply them. > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fwserial: replace 'a' with '(a)' to avoid precedence issues
Macro argument 'a' may be better as '(a)' to avoid precedence issues as reported by checkpatch.pl Signed-off-by: Arushi Singhal --- drivers/staging/fwserial/fwserial.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fwserial/fwserial.c b/drivers/staging/fwserial/fwserial.c index 41a49c8194e5..bdfc0a8c7af3 100644 --- a/drivers/staging/fwserial/fwserial.c +++ b/drivers/staging/fwserial/fwserial.c @@ -98,7 +98,7 @@ struct fwtty_transaction { }; }; -#define to_device(a, b)(a->b) +#define to_device((a), b) (a->b) #define fwtty_err(p, fmt, ...) \ dev_err(to_device(p, device), fmt, ##__VA_ARGS__) #define fwtty_info(p, fmt, ...) \ -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fwserial: replace 'a' with '(a)' to avoid precedence issues
On Tue, Feb 14, 2017 at 11:26:20PM +0530, Arushi Singhal wrote: > Macro argument 'a' may be better as '(a)' to avoid precedence issues as > reported by checkpatch.pl > > Signed-off-by: Arushi Singhal > --- > drivers/staging/fwserial/fwserial.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/fwserial/fwserial.c > b/drivers/staging/fwserial/fwserial.c > index 41a49c8194e5..bdfc0a8c7af3 100644 > --- a/drivers/staging/fwserial/fwserial.c > +++ b/drivers/staging/fwserial/fwserial.c > @@ -98,7 +98,7 @@ struct fwtty_transaction { > }; > }; > > -#define to_device(a, b) (a->b) > +#define to_device((a), b)(a->b) Really? Why do we even have this macro at all? Can it just be removed? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 01/15] staging: rtl8192u: fixing white space issue
On Tue, Feb 14, 2017 at 11:16:59PM +0530, SIMRAN SINGHAL wrote: > While resending them ...do I have to mention v2. Of course, why wouldn't you? :) thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: vt6656: Alignment should match open parenthesis
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis" Signed-off-by: Arushi Singhal --- drivers/staging/vt6656/firmware.c | 34 +- drivers/staging/vt6656/key.h | 2 +- drivers/staging/vt6656/rf.c | 12 ++-- drivers/staging/vt6656/usbpipe.c | 12 ++-- drivers/staging/vt6656/wcmd.c | 2 +- 5 files changed, 31 insertions(+), 31 deletions(-) diff --git a/drivers/staging/vt6656/firmware.c b/drivers/staging/vt6656/firmware.c index 1b48f9c86f63..282f665aacfa 100644 --- a/drivers/staging/vt6656/firmware.c +++ b/drivers/staging/vt6656/firmware.c @@ -64,11 +64,11 @@ int vnt_download_firmware(struct vnt_private *priv) memcpy(buffer, fw->data + ii, length); status = vnt_control_out(priv, - 0, - 0x1200+ii, - 0x, - length, - buffer); +0, +0x1200+ii, +0x, +length, +buffer); dev_dbg(dev, "Download firmware...%d %zu\n", ii, fw->size); @@ -94,11 +94,11 @@ int vnt_firmware_branch_to_sram(struct vnt_private *priv) dev_dbg(&priv->usb->dev, ">Branch to Sram\n"); status = vnt_control_out(priv, - 1, - 0x1200, - 0x, - 0, - NULL); +1, +0x1200, +0x, +0, +NULL); return status == STATUS_SUCCESS; } @@ -107,14 +107,14 @@ int vnt_check_firmware_version(struct vnt_private *priv) int status; status = vnt_control_in(priv, - MESSAGE_TYPE_READ, - 0, - MESSAGE_REQUEST_VERSION, - 2, - (u8 *)&priv->firmware_version); + MESSAGE_TYPE_READ, + 0, + MESSAGE_REQUEST_VERSION, + 2, + (u8 *)&priv->firmware_version); dev_dbg(&priv->usb->dev, "Firmware Version [%04x]\n", - priv->firmware_version); + priv->firmware_version); if (status != STATUS_SUCCESS) { dev_dbg(&priv->usb->dev, "Firmware Invalid.\n"); @@ -126,7 +126,7 @@ int vnt_check_firmware_version(struct vnt_private *priv) } dev_dbg(&priv->usb->dev, "Firmware Version [%04x]\n", - priv->firmware_version); + priv->firmware_version); if (priv->firmware_version < FIRMWARE_VERSION) { /* branch to loader for download new firmware */ diff --git a/drivers/staging/vt6656/key.h b/drivers/staging/vt6656/key.h index 7861faf5138f..7be423004386 100644 --- a/drivers/staging/vt6656/key.h +++ b/drivers/staging/vt6656/key.h @@ -46,6 +46,6 @@ int vnt_key_init_table(struct vnt_private *); int vnt_set_keys(struct ieee80211_hw *hw, struct ieee80211_sta *sta, - struct ieee80211_vif *vif, struct ieee80211_key_conf *key); + struct ieee80211_vif *vif, struct ieee80211_key_conf *key); #endif /* __KEY_H__ */ diff --git a/drivers/staging/vt6656/rf.c b/drivers/staging/vt6656/rf.c index 6101a35582b6..068c1c89f653 100644 --- a/drivers/staging/vt6656/rf.c +++ b/drivers/staging/vt6656/rf.c @@ -771,7 +771,7 @@ int vnt_rf_set_txpower(struct vnt_private *priv, u8 power, u32 rate) ret &= vnt_rf_write_embedded(priv, 0x015C0800); } else { dev_dbg(&priv->usb->dev, - " vnt_rf_set_txpower> 11G mode\n"); + " vnt_rf_set_txpower> 11G mode\n"); power_setting = ((0x3f - power) << 20) | (0x7 << 8); @@ -876,7 +876,7 @@ void vnt_rf_table_download(struct vnt_private *priv) memcpy(array, addr1, length1); vnt_control_out(priv, MESSAGE_TYPE_WRITE, 0, - MESSAGE_REQUEST_RF_INIT, length1, array); + MESSAGE_REQUEST_RF_INIT, length1, array); /* Channel Table 0 */ value = 0; @@ -889,7 +889,7 @@ void vnt_rf_table_download(struct vnt_private *priv) memcpy(array, addr2, length);
Re: [PATCH] staging: wlan-ng/p80211conv.c: Fix warnings regarding types.
On Mon, Feb 13, 2017 at 03:15:26PM +0100, Anthony Brandon wrote: > Fix several warnings in p80211conv.c emitted when using make C=1 by turning > the type member in wlan_ethhdr and wlan_snap into __be16 and changing > le16_to_cpu into ntohs. > > Signed-off-by: Anthony Brandon > --- > drivers/staging/wlan-ng/p80211conv.c | 2 +- > drivers/staging/wlan-ng/p80211conv.h | 4 ++-- > 2 files changed, 3 insertions(+), 3 deletions(-) Patch does not apply to my tree :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH]staging: fbtft: Fix sparse warnings about endianness
On Tue, Feb 14, 2017 at 09:18:25AM -0800, Greg KH wrote: > On Tue, Feb 14, 2017 at 04:53:10PM +0800, maomao xu wrote: > > Fixed sparse warnings about endianness. E.g.: > > > > warning: incorrect type in assignment (different base types) > > Why are these lines indented? > > > Signed-off-by: maomao xu > > > > diff --git a/drivers/staging/fbtft/fbtft-io.c > > b/drivers/staging/fbtft/fbtft-io.c > > index d868405..ffb9a3b 100644 > > --- a/drivers/staging/fbtft/fbtft-io.c > > +++ b/drivers/staging/fbtft/fbtft-io.c > > @@ -71,7 +71,7 @@ int fbtft_write_spi_emulate_9(struct fbtft_par *par, void > > *buf, size_t len) > > src++; > > } > > tmp |= ((*src & 0x0100) ? 1 : 0); > > - *(u64 *)dst = cpu_to_be64(tmp); > > + *(__be64 *)dst = cpu_to_be64(tmp); > > Really? That seems very odd. I need a maintainer's ack for this before > I can take it... If anything, I would turn the inner loop into tmp = 0; for (j = 0; j < 7; j++) { tmp <<= 9; tmp |= *src++ & 0x1ff; } tmp <<= 1; there - the whole thing looks like an obfuscated "take an array of 9-bit values, each stored in host-endian 16bit, repack them into octets". Which architecture is that supposed to run on? Anything that doesn't like unaligned stores won't be happy with that code... Another interesting part is that we have size = len / 2 and verify that len is a multiple of 8. I.e. that size is only guaranteed to be a multiple of 4. Each pass through the outer loop consumes 8 16bit values and decrements size by 8, so if len is e.g. 24 we'll end up accepting that, get size equal to 12, pass through the outer loop twice and chew through 32 bytes of buf... ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: vt6656: Alignment match open parenthesis
Fix checkpatch issues: "CHECK: Alignment should match open parenthesis" Signed-off-by: Arushi Singhal --- drivers/staging/vt6656/rxtx.c | 54 +-- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index aa59e7f14ab3..02820894ff27 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -90,7 +90,7 @@ static struct vnt_usb_send_context if (!context->in_use) { context->in_use = true; memset(context->data, 0, - MAX_TOTAL_SIZE_WITH_ALL_HEADERS); + MAX_TOTAL_SIZE_WITH_ALL_HEADERS); context->hdr = NULL; @@ -114,19 +114,19 @@ static __le16 vnt_time_stamp_off(struct vnt_private *priv, u16 rate) } static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) + u32 frame_length, u16 rate, int need_ack) { u32 data_time, ack_time; data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - frame_length, rate); + frame_length, rate); if (pkt_type == PK_TYPE_11B) ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, (u16)priv->top_cck_basic_rate); + 14, (u16)priv->top_cck_basic_rate); else ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, (u16)priv->top_ofdm_basic_rate); + 14, (u16)priv->top_ofdm_basic_rate); if (need_ack) return data_time + priv->sifs + ack_time; @@ -135,21 +135,21 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, } static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, - u32 frame_length, u16 rate, int need_ack) +u32 frame_length, u16 rate, int need_ack) { return cpu_to_le16((u16)vnt_get_rsvtime(priv, pkt_type, frame_length, rate, need_ack)); } static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, - u8 rsv_type, u8 pkt_type, u32 frame_length, u16 current_rate) +u8 rsv_type, u8 pkt_type, u32 frame_length, u16 current_rate) { u32 rrv_time, rts_time, cts_time, ack_time, data_time; rrv_time = rts_time = cts_time = ack_time = data_time = 0; data_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - frame_length, current_rate); + frame_length, current_rate); if (rsv_type == 0) { rts_time = vnt_get_frame_time(priv->preamble_type, @@ -160,19 +160,19 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 20, priv->top_cck_basic_rate); cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_cck_basic_rate); + 14, priv->top_cck_basic_rate); ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_ofdm_basic_rate); + 14, priv->top_ofdm_basic_rate); } else if (rsv_type == 2) { rts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 20, priv->top_ofdm_basic_rate); + 20, priv->top_ofdm_basic_rate); cts_time = ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, priv->top_ofdm_basic_rate); } else if (rsv_type == 3) { cts_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_cck_basic_rate); + 14, priv->top_cck_basic_rate); ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, - 14, priv->top_ofdm_basic_rate); + 14, priv->top_ofdm_basic_rate); rrv_time = cts_time + ack_time + data_time + 2 * priv->sifs; @@ -185,7 +185,7 @@ static __le16 vnt_get_rtscts_rsvtime_le(struct vnt_private *priv, } static __le16 vnt_get_duration_le(struct vnt_private *priv, - u8 pkt_type, int need_ack) + u8 pkt_type, int need_ack) { u32 ack_time = 0; @@ -220,17 +220,17 @@ static __le16 vnt_get_rtscts_duration_le(st
Re: [PATCH 2/3 staging-next] oom: Add notification for oom_score_adj (fwd)
It looks like an unlock is missing before line 1797. julia -- Forwarded message -- Date: Wed, 15 Feb 2017 03:07:29 +0800 From: kbuild test robot To: kbu...@01.org Cc: Julia Lawall Subject: Re: [PATCH 2/3 staging-next] oom: Add notification for oom_score_adj Hi Peter, [auto build test WARNING on staging/staging-testing] [also build test WARNING on v4.10-rc8 next-20170214] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/peter-enderborg-sonymobile-com/android-Collect-statistics-from-lowmemorykiller/20170215-004327 :: branch date: 2 hours ago :: commit date: 2 hours ago >> kernel/fork.c:1887:1-7: preceding lock on line 1766 kernel/fork.c:1887:1-7: preceding lock on line 1755 git remote add linux-review https://github.com/0day-ci/linux git remote update linux-review git checkout 0174c40bf153def3ac7b287f000a885b15048a38 vim +1887 kernel/fork.c 2d5516cbb Oleg Nesterov 2009-03-02 1760p->parent_exec_id = current->parent_exec_id; 2d5516cbb Oleg Nesterov 2009-03-02 1761} else { ^1da177e4 Linus Torvalds2005-04-16 1762p->real_parent = current; 2d5516cbb Oleg Nesterov 2009-03-02 1763p->parent_exec_id = current->self_exec_id; 2d5516cbb Oleg Nesterov 2009-03-02 1764} ^1da177e4 Linus Torvalds2005-04-16 1765 ^1da177e4 Linus Torvalds2005-04-16 @1766 spin_lock(¤t->sighand->siglock); 4a2c7a783 Oleg Nesterov 2006-03-28 1767 4a2c7a783 Oleg Nesterov 2006-03-28 1768/* dbd952127 Kees Cook 2014-06-27 1769 * Copy seccomp details explicitly here, in case they were changed dbd952127 Kees Cook 2014-06-27 1770 * before holding sighand lock. dbd952127 Kees Cook 2014-06-27 1771 */ dbd952127 Kees Cook 2014-06-27 1772copy_seccomp(p); dbd952127 Kees Cook 2014-06-27 1773 dbd952127 Kees Cook 2014-06-27 1774/* 4a2c7a783 Oleg Nesterov 2006-03-28 1775 * Process group and session signals need to be delivered to just the 4a2c7a783 Oleg Nesterov 2006-03-28 1776 * parent before the fork or both the parent and the child after the 4a2c7a783 Oleg Nesterov 2006-03-28 1777 * fork. Restart if a signal comes in before we add the new process to 4a2c7a783 Oleg Nesterov 2006-03-28 1778 * it's process group. 4a2c7a783 Oleg Nesterov 2006-03-28 1779 * A fatal signal pending means that current will exit, so the new 4a2c7a783 Oleg Nesterov 2006-03-28 1780 * thread can't slip out of an OOM kill (or normal SIGKILL). 4a2c7a783 Oleg Nesterov 2006-03-28 1781*/ 4a2c7a783 Oleg Nesterov 2006-03-28 1782recalc_sigpending(); 4a2c7a783 Oleg Nesterov 2006-03-28 1783if (signal_pending(current)) { 4a2c7a783 Oleg Nesterov 2006-03-28 1784 spin_unlock(¤t->sighand->siglock); 4a2c7a783 Oleg Nesterov 2006-03-28 1785 write_unlock_irq(&tasklist_lock); 4a2c7a783 Oleg Nesterov 2006-03-28 1786retval = -ERESTARTNOINTR; 7e47682ea Aleksa Sarai 2015-06-09 1787goto bad_fork_cancel_cgroup; 4a2c7a783 Oleg Nesterov 2006-03-28 1788} 4a2c7a783 Oleg Nesterov 2006-03-28 1789 73b9ebfe1 Oleg Nesterov 2006-03-28 1790if (likely(p->pid)) { 4b9d33e6d Tejun Heo 2011-06-17 1791ptrace_init_task(p, (clone_flags & CLONE_PTRACE) || trace); ^1da177e4 Linus Torvalds2005-04-16 1792 819077398 Oleg Nesterov 2013-07-03 1793init_task_pid(p, PIDTYPE_PID, pid); ^1da177e4 Linus Torvalds2005-04-16 1794if (thread_group_leader(p)) { 0174c40bf Peter Enderborg 2017-02-14 1795retval = oom_score_notify_new(p); 0174c40bf Peter Enderborg 2017-02-14 1796if (retval) 0174c40bf Peter Enderborg 2017-02-14 1797goto bad_fork_cancel_cgroup; 0174c40bf Peter Enderborg 2017-02-14 1798 819077398 Oleg Nesterov 2013-07-03 1799 init_task_pid(p, PIDTYPE_PGID, task_pgrp(current)); 819077398 Oleg Nesterov 2013-07-03 1800 init_task_pid(p, PIDTYPE_SID, task_session(current)); 819077398 Oleg Nesterov 2013-07-03 1801 1c4042c29 Eric W. Biederman 2010-07-12 1802if (is_child_reaper(pid)) { 17cf22c33 Eric W. Biederman 2010-03-02 1803 ns_of_pid(pid)->child_reaper = p; 1c4042c29 Eric W. Biederman 2010-07-12 1804 p->signal->flags |= SIGNAL_UNKILLABLE; 1c4042c29 Eric W. Biederman 2010-07-12 1805} 5cd17569f Eric W. Biederman 2007-12-04 1806 fea9d1755 Oleg Nesterov 2008-02-08 1807 p->signal->leader_pid = pid; 9c9f4ded9 Alan Cox 2008-10-13 1808p->signal->tty
[PATCH v2 1/9] staging: rtl8192u: fixing white space issue
Fix the following checkpatch.pl error and warnings: WARNING: please, no space before tabs Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index 873969c..a54dfad 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -30,7 +30,7 @@ typedef struct _TX_TS_RECORD{ u16 TxCurSeq; BA_RECORD TxPendingBARecord; /* For BA Originator */ BA_RECORD TxAdmittedBARecord; /* For BA Originator */ -/* QOS_DL_RECORD DLRecord; */ +/* QOS_DL_RECORD DLRecord; */ u8 bAddBaReqInProgress; u8 bAddBaReqDelayed; u8 bUsingBa; @@ -48,7 +48,7 @@ typedef struct _RX_TS_RECORD { u16 RxLastSeqNum; u8 RxLastFragNum; u8 num; -/* QOS_DL_RECORD DLRecord; */ +/* QOS_DL_RECORDLRecord; */ } RX_TS_RECORD, *PRX_TS_RECORD; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/9] staging: rtl8192u: Adding space after struct definition
Fixes checkpatch.pl warning: WARNING: missing space after struct definition Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h index a54dfad..7c4959a 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_TS.h @@ -14,7 +14,7 @@ typedef enum _TR_SELECT { RX_DIR = 1, } TR_SELECT, *PTR_SELECT; -typedef struct _TS_COMMON_INFO{ +typedef struct _TS_COMMON_INFO { struct list_headList; struct timer_list SetupTimer; struct timer_list InactTimer; @@ -25,7 +25,7 @@ typedef struct _TS_COMMON_INFO{ u8 TClasNum; } TS_COMMON_INFO, *PTS_COMMON_INFO; -typedef struct _TX_TS_RECORD{ +typedef struct _TX_TS_RECORD { TS_COMMON_INFO TsCommonInfo; u16 TxCurSeq; BA_RECORD TxPendingBARecord; /* For BA Originator */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/9] staging: rtl8192u: Adding space after enum and struct definition
Fixes checkpatch.pl warning: WARNING: missing space after struct definition WARNING: missing space after enum definition Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h | 38 - 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h index c3aabba..5f54d93 100644 --- a/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h +++ b/drivers/staging/rtl8192u/ieee80211/rtl819x_HT.h @@ -35,7 +35,7 @@ #define HT_SUPPORTED_MCS_1SS_2SS_BITMAP HT_MCS_1SS_BITMAP|HT_MCS_1SS_2SS_BITMAP -typedef enum _HT_MCS_RATE{ +typedef enum _HT_MCS_RATE { HT_MCS0 = 0x0001, HT_MCS1 = 0x0002, HT_MCS2 = 0x0004, @@ -58,7 +58,7 @@ typedef enum _HT_MCS_RATE{ // // Represent Channel Width in HT Capabilities // -typedef enum _HT_CHANNEL_WIDTH{ +typedef enum _HT_CHANNEL_WIDTH { HT_CHANNEL_WIDTH_20 = 0, HT_CHANNEL_WIDTH_20_40 = 1, }HT_CHANNEL_WIDTH, *PHT_CHANNEL_WIDTH; @@ -67,14 +67,14 @@ typedef enum _HT_CHANNEL_WIDTH{ // Represent Extension Channel Offset in HT Capabilities // This is available only in 40Mhz mode. // -typedef enum _HT_EXTCHNL_OFFSET{ +typedef enum _HT_EXTCHNL_OFFSET { HT_EXTCHNL_OFFSET_NO_EXT = 0, HT_EXTCHNL_OFFSET_UPPER = 1, HT_EXTCHNL_OFFSET_NO_DEF = 2, HT_EXTCHNL_OFFSET_LOWER = 3, }HT_EXTCHNL_OFFSET, *PHT_EXTCHNL_OFFSET; -typedef enum _CHNLOP{ +typedef enum _CHNLOP { CHNLOP_NONE = 0, // No Action now CHNLOP_SCAN = 1, // Scan in progress CHNLOP_SWBW = 2, // Bandwidth switching in progress @@ -119,7 +119,7 @@ typedef union _HT_CAPABILITY_MACPARA{ }HT_CAPABILITY_MACPARA, *PHT_CAPABILITY_MACPARA; */ -typedef enum _HT_ACTION{ +typedef enum _HT_ACTION { ACT_RECOMMAND_WIDTH = 0, ACT_MIMO_PWR_SAVE = 1, ACT_PSMP= 2, @@ -134,14 +134,14 @@ typedef enum _HT_ACTION{ /* 2007/06/07 MH Define sub-carrier mode for 40MHZ. */ -typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier{ +typedef enum _HT_Bandwidth_40MHZ_Sub_Carrier { SC_MODE_DUPLICATE = 0, SC_MODE_LOWER = 1, SC_MODE_UPPER = 2, SC_MODE_FULL40MHZ = 3, }HT_BW40_SC_E; -typedefstruct _HT_CAPABILITY_ELE{ +typedefstruct _HT_CAPABILITY_ELE { //HT capability info u8 AdvCoding:1; @@ -184,7 +184,7 @@ typedef struct _HT_CAPABILITY_ELE{ // Only AP is required to include this element // -typedef struct _HT_INFORMATION_ELE{ +typedef struct _HT_INFORMATION_ELE { u8 ControlChl; u8 ExtChlOffset:2; @@ -215,18 +215,18 @@ typedef struct _HT_INFORMATION_ELE{ // MIMO Power Save control field. // This is appear in MIMO Power Save Action Frame // -typedef struct _MIMOPS_CTRL{ +typedef struct _MIMOPS_CTRL { u8 MimoPsEnable:1; u8 MimoPsMode:1; u8 Reserved:6; } MIMOPS_CTRL, *PMIMOPS_CTRL; -typedef enum _HT_SPEC_VER{ +typedef enum _HT_SPEC_VER { HT_SPEC_VER_IEEE = 0, HT_SPEC_VER_EWC = 1, }HT_SPEC_VER, *PHT_SPEC_VER; -typedef enum _HT_AGGRE_MODE_E{ +typedef enum _HT_AGGRE_MODE_E { HT_AGG_AUTO = 0, HT_AGG_FORCE_ENABLE = 1, HT_AGG_FORCE_DISABLE = 2, @@ -238,7 +238,7 @@ typedef enum _HT_AGGRE_MODE_E{ // to default value in HTInitializeHTInfo() // -typedef struct _RT_HIGH_THROUGHPUT{ +typedef struct _RT_HIGH_THROUGHPUT { u8 bEnableHT; u8 bCurrentHTSupport; @@ -347,7 +347,7 @@ typedef struct _RT_HIGH_THROUGHPUT{ // when card is configured as "AP mode" // -typedef struct _RT_HTINFO_STA_ENTRY{ +typedef struct _RT_HTINFO_STA_ENTRY { u8 bEnableHT; u8 bSupportCck; @@ -377,7 +377,7 @@ typedef struct _RT_HTINFO_STA_ENTRY{ // when card is configured as "STA mode" // -typedef struct _BSS_HT{ +typedef struct _BSS_HT { u8 bdSupportHT; @@ -395,7 +395,7 @@ typedef struct _BSS_HT{ u8 bdRT2RTLongSlotTime; } __attribute__ ((packed)) BSS_HT, *PBSS_HT; -typedef struct _MIMO_RSSI{ +typedef struct _MIMO_RSSI { u32 EnableAntenna; u32 AntennaA; u32 AntennaB; @@ -404,12 +404,12 @@ typedef struct _MIMO_RSSI{ u32 Average; }MIMO_RSSI, *PMIMO_RSSI; -typedef struct _MIMO_EVM{ +typedef struct _MIMO_EVM { u32 EVM1; u32EVM2; }MIMO_EVM, *PMIMO_EVM; -typedef struct _FALSE_ALARM_STATISTICS{ +typedef struct
[PATCH v2 4/9] staging: rtl8192u: blank lines aren't necessary before a close brace '}'
Fix checkpatch issues: "CHECK: Blank lines aren't necessary before a close brace '}'". Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 814ab5a..2481c21 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -623,7 +623,6 @@ int ieee80211_wx_set_encode_ext(struct ieee80211_device *ieee, goto done; } *crypt = new_crypt; - } if (ext->key_len > 0 && (*crypt)->ops->set_key && @@ -725,7 +724,6 @@ int ieee80211_wx_get_encode_ext(struct ieee80211_device *ieee, (ext->alg == IW_ENCODE_ALG_TKIP || ext->alg == IW_ENCODE_ALG_CCMP)) ext->ext_flags |= IW_ENCODE_EXT_TX_SEQ_VALID; - } return 0; @@ -839,6 +837,5 @@ int ieee80211_wx_set_gen_ie(struct ieee80211_device *ieee, u8 *ie, size_t len) ieee->wpa_ie_len = 0; } return 0; - } EXPORT_SYMBOL(ieee80211_wx_set_gen_ie); -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min
Use min_t instead of min function in ieee80211/ieee80211_wx.c fixed warning: WARNING: min() should probably be min_t(u8, network->ssid_len, 32) Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index 2481c21..fff2020 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -80,7 +80,7 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, iwe.u.data.length = sizeof(""); start = iwe_stream_add_point(info, start, stop, &iwe, ""); } else { - iwe.u.data.length = min(network->ssid_len, (u8)32); + iwe.u.data.length = min_t(u8, network->ssid_len, 32); start = iwe_stream_add_point(info, start, stop, &iwe, network->ssid); } /* Add the protocol name */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 6/9] staging: rtl8192u: Fixing coding style issues
fixed errors and warnings: ERROR: spaces required around that '=' ERROR: spaces required around that '<' ERROR: space required before the open parenthesis '(' CHECK: spaces preferred around that '&' CHECK: spaces preferred around that '<<' ERROR: space required after that ',' ERROR: spaces required around that '+=' WARNING: Missing a blank line after declarations CHECK: spaces required around that '?' CHECK: spaces required around that ':' Signed-off-by: simran singhal --- drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c | 17 + 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c index fff2020..c846223 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c @@ -85,10 +85,10 @@ static inline char *rtl819x_translate_scan(struct ieee80211_device *ieee, } /* Add the protocol name */ iwe.cmd = SIOCGIWNAME; - for(i=0; imode&(1bssht.bdHTCapBuf, EWC11NHTCap, 4)) ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[4]; else ht_cap = (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[0]; - is40M = (ht_cap->ChlWidth)?1:0; - isShortGI = (ht_cap->ChlWidth)? - ((ht_cap->ShortGI40Mhz)?1:0): - ((ht_cap->ShortGI20Mhz)?1:0); + is40M = (ht_cap->ChlWidth) ? 1 : 0; + isShortGI = (ht_cap->ChlWidth) ? + ((ht_cap->ShortGI40Mhz) ? 1 : 0) : + ((ht_cap->ShortGI20Mhz) ? 1 : 0); max_mcs = HTGetHighestMCSRate(ieee, ht_cap->MCS, MCS_FILTER_ALL); rate = MCS_DATA_RATE[is40M][isShortGI][max_mcs&0x7f]; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 7/9] staging: rtl8192u: Fixing style issues in r8180_93cx6.c
Fixing the following checkpatch.pl errors and warning: WARNING: Block comments use * on subsequent lines CHECK: Please don't use multiple blank lines CHECK: Alignment should match open parenthesis CHECK: spaces preferred around that '<<' CHECK: spaces preferred around that '-' CHECK: Alignment should match open parenthesis Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8180_93cx6.c | 71 -- 1 file changed, 33 insertions(+), 38 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.c b/drivers/staging/rtl8192u/r8180_93cx6.c index f35defc..6a293e3 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.c +++ b/drivers/staging/rtl8192u/r8180_93cx6.c @@ -1,22 +1,22 @@ /* - This files contains card eeprom (93c46 or 93c56) programming routines, - memory is addressed by 16 bits words. - - This is part of rtl8180 OpenSource driver. - Copyright (C) Andrea Merello 2004 - Released under the terms of GPL (General Public Licence) - - Parts of this driver are based on the GPL part of the - official realtek driver. - - Parts of this driver are based on the rtl8180 driver skeleton - from Patric Schenke & Andres Salomon. - - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. - - We want to thank the Authors of those projects and the Ndiswrapper - project Authors. -*/ + * This files contains card eeprom (93c46 or 93c56) programming routines, + * memory is addressed by 16 bits words. + * + * This is part of rtl8180 OpenSource driver. + * Copyright (C) Andrea Merello 2004 + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the + * official realtek driver. + * + * Parts of this driver are based on the rtl8180 driver skeleton + * from Patric Schenke & Andres Salomon. + * + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver. + * + * We want to thank the Authors of those projects and the Ndiswrapper + * project Authors. + */ #include "r8180_93cx6.h" @@ -39,7 +39,6 @@ static void eprom_cs(struct net_device *dev, short bit) udelay(EPROM_DELAY); } - static void eprom_ck_cycle(struct net_device *dev) { u8 cmdreg; @@ -58,7 +57,6 @@ static void eprom_ck_cycle(struct net_device *dev) udelay(EPROM_DELAY); } - static void eprom_w(struct net_device *dev, short bit) { u8 cmdreg; @@ -76,7 +74,6 @@ static void eprom_w(struct net_device *dev, short bit) udelay(EPROM_DELAY); } - static short eprom_r(struct net_device *dev) { u8 bit; @@ -94,7 +91,6 @@ static short eprom_r(struct net_device *dev) return 0; } - static void eprom_send_bits_string(struct net_device *dev, short b[], int len) { int i; @@ -105,7 +101,6 @@ static void eprom_send_bits_string(struct net_device *dev, short b[], int len) } } - int eprom_read(struct net_device *dev, u32 addr) { struct r8192_priv *priv = ieee80211_priv(dev); @@ -119,27 +114,27 @@ int eprom_read(struct net_device *dev, u32 addr) ret = 0; /* enable EPROM programming */ write_nic_byte_E(dev, EPROM_CMD, - (EPROM_CMD_PROGRAM
[PATCH v2 9/9] staging: rtl8192u: fixing block comments use * on subsequent lines
Fixed checkpatch.pl warning: WARNING: Block comments use * on subsequent lines Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8190_rtl8256.h | 19 +-- 1 file changed, 9 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.h b/drivers/staging/rtl8192u/r8190_rtl8256.h index 1ba4f83..5878f42 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.h +++ b/drivers/staging/rtl8192u/r8190_rtl8256.h @@ -1,14 +1,13 @@ /* - This is part of the rtl8180-sa2400 driver - released under the GPL (See file COPYING for details). - Copyright (c) 2005 Andrea Merello - - This files contains programming code for the rtl8256 - radio frontend. - - *Many* thanks to Realtek Corp. for their great support! - -*/ + * This is part of the rtl8180-sa2400 driver + * released under the GPL (See file COPYING for details). + * Copyright (c) 2005 Andrea Merello + * + * This files contains programming code for the rtl8256 + * radio frontend. + * + * Many* thanks to Realtek Corp. for their great support! + */ #ifndef RTL8225H #define RTL8225H -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 8/9] staging: rtl8192u: Fixing style issues in r8180_93cx6.h
Fixing the following checkpatch.pl errors and warning: WARNING: Block comments use * on subsequent lines CHECK: Please don't use multiple blank lines Signed-off-by: simran singhal --- drivers/staging/rtl8192u/r8180_93cx6.h | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/staging/rtl8192u/r8180_93cx6.h b/drivers/staging/rtl8192u/r8180_93cx6.h index 9cf7f58..643d465 100644 --- a/drivers/staging/rtl8192u/r8180_93cx6.h +++ b/drivers/staging/rtl8192u/r8180_93cx6.h @@ -1,17 +1,17 @@ /* - This is part of rtl8187 OpenSource driver - Copyright (C) Andrea Merello 2004-2005 - Released under the terms of GPL (General Public Licence) - - Parts of this driver are based on the GPL part of the - official realtek driver - Parts of this driver are based on the rtl8180 driver skeleton - from Patric Schenke & Andres Salomon - Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver - - We want to thank the Authors of such projects and the Ndiswrapper - project Authors. -*/ + * This is part of rtl8187 OpenSource driver + * Copyright (C) Andrea Merello 2004-2005 + * Released under the terms of GPL (General Public Licence) + * + * Parts of this driver are based on the GPL part of the + * official realtek driver + * Parts of this driver are based on the rtl8180 driver skeleton + * from Patric Schenke & Andres Salomon + * Parts of this driver are based on the Intel Pro Wireless 2100 GPL driver + * + * We want to thank the Authors of such projects and the Ndiswrapper + * project Authors. + */ /*This files contains card eeprom (93c46 or 93c56) programming routines*/ /*memory is addressed by WORDS*/ @@ -39,5 +39,4 @@ #define EPROM_TXPW2 0x1b #define EPROM_TXPW1 0x3d - int eprom_read(struct net_device *dev, u32 addr); /* reads a 16 bits word */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fwserial: replace 'a' with '(a)' to avoid precedence issues
Hi Arushi, [auto build test ERROR on staging/staging-testing] [also build test ERROR on v4.10-rc8 next-20170214] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Arushi-Singhal/staging-fwserial-replace-a-with-a-to-avoid-precedence-issues/20170215-020955 config: i386-randconfig-s0-02131304 (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All error/warnings (new ones prefixed by >>): >> drivers/staging/fwserial/fwserial.c:101:19: error: "(" may not appear in >> macro parameter list #define to_device((a), b) (a->b) ^ In file included from drivers/staging/fwserial/fwserial.c:21:0: drivers/staging/fwserial/fwserial.c: In function 'fwtty_log_tx_error': >> drivers/staging/fwserial/fwserial.c:111:22: error: implicit declaration of >> function 'to_device' [-Werror=implicit-function-declaration] dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro >> 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro >> 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ >> drivers/staging/fwserial/fwserial.c:111:35: error: 'device' undeclared >> (first use in this function) dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro >> 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro >> 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ drivers/staging/fwserial/fwserial.c:111:35: note: each undeclared identifier is reported only once for each function it appears in dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^~~ >> drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro >> 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^~~ >> drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro >> 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ In file included from include/linux/printk.h:320:0, from include/linux/kernel.h:13, from include/linux/sched.h:17, from drivers/staging/fwserial/fwserial.c:19: drivers/staging/fwserial/fwserial.c: In function '__fwtty_restart_tx': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^~~ >> drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro >> 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^~~ >> drivers/staging/fwserial/fwserial.c:290:2: note: in expansion of macro >> 'fwtty_dbg' fwtty_dbg(port, "fifo len: %d avail: %d\n", len, avail); ^ drivers/staging/fwserial/fwserial.c: In function 'fwtty_update_port_status': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic
[PATCH] staging: xgifb: function definition argument should also have an identifier name
function definition argument 'struct vb_device_info *' should also have an identifier name. Signed-off-by: Arushi Singhal --- drivers/staging/xgifb/vb_init.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h index 500cabe41a3c..022486a516d6 100644 --- a/drivers/staging/xgifb/vb_init.h +++ b/drivers/staging/xgifb/vb_init.h @@ -1,6 +1,6 @@ #ifndef _VBINIT_ #define _VBINIT_ unsigned char XGIInitNew(struct pci_dev *pdev); -void XGIRegInit(struct vb_device_info *, unsigned long); +void XGIRegInit(struct vb_device_info *pVBInfo, unsigned long); #endif -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: xgifb: function definition argument should also have an identifier name
On Wed, 2017-02-15 at 02:03 +0530, Arushi Singhal wrote: > function definition argument 'struct vb_device_info *' should also have > an identifier name. [] > diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_init.h [] > @@ -1,6 +1,6 @@ > #ifndef _VBINIT_ > #define _VBINIT_ > unsigned char XGIInitNew(struct pci_dev *pdev); > -void XGIRegInit(struct vb_device_info *, unsigned long); > +void XGIRegInit(struct vb_device_info *pVBInfo, unsigned long); Why do one argument but not the other? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 5/9] staging: rtl8192u: Use min_t instead of min
On Wed, 2017-02-15 at 01:43 +0530, simran singhal wrote: > Use min_t instead of min function in ieee80211/ieee80211_wx.c > fixed warning: > WARNING: min() should probably be min_t(u8, network->ssid_len, 32) [] > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c [] > @@ -80,7 +80,7 @@ static inline char *rtl819x_translate_scan(struct > ieee80211_device *ieee, > iwe.u.data.length = sizeof(""); > start = iwe_stream_add_point(info, start, stop, &iwe, > ""); > } else { > - iwe.u.data.length = min(network->ssid_len, (u8)32); > + iwe.u.data.length = min_t(u8, network->ssid_len, 32); Umm, no. A checkpatch message that says "probably", is not a reason to do what it says. It's _maybe_ something that could be investigated. ssid_len is size_t and u.data.length is u16. Why should it be truncated to a u8? It'd be getter to remove the u8 cast altogether. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 6/9] staging: rtl8192u: Fixing coding style issues
On Wed, 2017-02-15 at 01:44 +0530, simran singhal wrote: [] > diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c > b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c [] > @@ -150,14 +150,15 @@ static inline char *rtl819x_translate_scan(struct > ieee80211_device *ieee, > PHT_CAPABILITY_ELE ht_cap = NULL; > bool is40M = false, isShortGI = false; > u8 max_mcs = 0; > + > if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4)) > ht_cap = > (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[4]; > else > ht_cap = > (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[0]; > - is40M = (ht_cap->ChlWidth)?1:0; > - isShortGI = (ht_cap->ChlWidth)? > - ((ht_cap->ShortGI40Mhz)?1:0): > - ((ht_cap->ShortGI20Mhz)?1:0); > + is40M = (ht_cap->ChlWidth) ? 1 : 0; > + isShortGI = (ht_cap->ChlWidth) ? > + ((ht_cap->ShortGI40Mhz) ? 1 : > 0) : > + ((ht_cap->ShortGI20Mhz) ? 1 : > 0); You have a brain, checkpatch is brainless. Please remember to do more than just shut-up checkpatch. This could be simplified by removing parentheses and ternaries to isShortGI = ht_cap->Ch1Width ? ht_cap->ShortGI40Mhz : ht_cap->ShortGI20Mhz; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fwserial: replace 'a' with '(a)' to avoid precedence issues
Hi Arushi, [auto build test ERROR on staging/staging-testing] [also build test ERROR on v4.10-rc8 next-20170214] [if your patch is applied to the wrong git tree, please drop us a note to help improve the system] url: https://github.com/0day-ci/linux/commits/Arushi-Singhal/staging-fwserial-replace-a-with-a-to-avoid-precedence-issues/20170215-020955 config: m68k-allyesconfig (attached as .config) compiler: m68k-linux-gcc (GCC) 4.9.0 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=m68k All error/warnings (new ones prefixed by >>): drivers/staging/fwserial/fwserial.c:101:19: error: "(" may not appear in macro parameter list #define to_device((a), b) (a->b) ^ In file included from include/linux/device.h:27:0, from drivers/staging/fwserial/fwserial.c:21: drivers/staging/fwserial/fwserial.c: In function 'fwtty_log_tx_error': >> include/linux/ratelimit.h:36:9: error: implicit declaration of function >> 'to_device' [-Werror=implicit-function-declaration] struct ratelimit_state name = \ ^ >> include/linux/device.h:1360:9: note: in expansion of macro >> 'DEFINE_RATELIMIT_STATE' static DEFINE_RATELIMIT_STATE(_rs,\ ^ >> include/linux/device.h:1374:2: note: in expansion of macro >> 'dev_level_ratelimited' dev_level_ratelimited(dev_err, dev, fmt, ##__VA_ARGS__) ^ drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ In file included from drivers/staging/fwserial/fwserial.c:21:0: drivers/staging/fwserial/fwserial.c:111:35: error: 'device' undeclared (first use in this function) dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^ drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ drivers/staging/fwserial/fwserial.c:111:35: note: each undeclared identifier is reported only once for each function it appears in dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ include/linux/device.h:1364:13: note: in definition of macro 'dev_level_ratelimited' dev_level(dev, fmt, ##__VA_ARGS__); \ ^ drivers/staging/fwserial/fwserial.c:111:2: note: in expansion of macro 'dev_err_ratelimited' dev_err_ratelimited(to_device(p, device), fmt, ##__VA_ARGS__) ^ drivers/staging/fwserial/fwserial.c:201:3: note: in expansion of macro 'fwtty_err_ratelimited' fwtty_err_ratelimited(port, "card busy\n"); ^ In file included from include/linux/printk.h:320:0, from include/linux/kernel.h:13, from include/linux/sched.h:17, from drivers/staging/fwserial/fwserial.c:19: drivers/staging/fwserial/fwserial.c: In function '__fwtty_restart_tx': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ include/linux/dynamic_debug.h:134:34: note: in definition of macro 'dynamic_dev_dbg' __dynamic_dev_dbg(&descriptor, dev, fmt, \ ^ drivers/staging/fwserial/fwserial.c:109:2: note: in expansion of macro 'dev_dbg' dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__) ^ drivers/staging/fwserial/fwserial.c:290:2: note: in expansion of macro 'fwtty_dbg' fwtty_dbg(port, "fifo len: %d avail: %d\n", len, avail); ^ drivers/staging/fwserial/fwserial.c: In function 'fwtty_update_port_status': drivers/staging/fwserial/fwserial.c:109:23: error: 'device' undeclared (first use in this function) dev_dbg(to_device(p, device), "%s: " fmt, __func__, ##__VA_ARGS__)
[PATCH] hv: hide unused label
This new 32-bit warning just showed up: arch/x86/hyperv/hv_init.c: In function 'hyperv_init': arch/x86/hyperv/hv_init.c:167:1: error: label 'register_msr_cs' defined but not used [-Werror=unused-label] The easiest solution is to move the label up into the existing #ifdef that has the goto. Fixes: dee863b571b0 ("hv: export current Hyper-V clocksource") Signed-off-by: Arnd Bergmann --- arch/x86/hyperv/hv_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index db64baf0e500..8bef70e7f3cc 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -158,13 +158,13 @@ void hyperv_init(void) clocksource_register_hz(&hyperv_cs_tsc, NSEC_PER_SEC/100); return; } +register_msr_cs: #endif /* * For 32 bit guests just use the MSR based mechanism for reading * the partition counter. */ -register_msr_cs: hyperv_cs = &hyperv_cs_msr; if (ms_hyperv.features & HV_X64_MSR_TIME_REF_COUNT_AVAILABLE) clocksource_register_hz(&hyperv_cs_msr, NSEC_PER_SEC/100); -- 2.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 1/2] Staging: vc04_services: Fix the "wrong indent" code style errors
Fixes the following code style errors: ERROR: code indent should use tabs where possible Signed-off-by: Mandel Benjamin --- drivers/staging/vc04_services/interface/vchi/vchi_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index 3f7d843..cedb24e 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -121,8 +121,8 @@ //Callback used by all services / bulk transfers typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param - VCHI_CALLBACK_REASON_T reason, - void *handle ); //for transmitting msg's only +VCHI_CALLBACK_REASON_T reason, +void *handle ); //for transmitting msg's only -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v3 2/2] Staging: vc04_services: Fix the "space prohibited" code style errors
Fixes the following code style errors: ERROR: space prohibited after/before that open/closed parenthesis Signed-off-by: Mandel Benjamin --- drivers/staging/vc04_services/interface/vchi/vchi_common.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchi/vchi_common.h b/drivers/staging/vc04_services/interface/vchi/vchi_common.h index cedb24e..45c2070 100644 --- a/drivers/staging/vc04_services/interface/vchi/vchi_common.h +++ b/drivers/staging/vc04_services/interface/vchi/vchi_common.h @@ -120,9 +120,9 @@ //Callback used by all services / bulk transfers -typedef void (*VCHI_CALLBACK_T)( void *callback_param, //my service local param +typedef void (*VCHI_CALLBACK_T)(void *callback_param, //my service local param VCHI_CALLBACK_REASON_T reason, -void *handle ); //for transmitting msg's only +void *handle); //for transmitting msg's only -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/9] staging:r8188eu: use DIV_ROUND_UP() in rtw_signal_stat_timer_hdl()
DIV_ROUND_UP macro is shorter and look better than if-else construction. DIV_ROUND_UP used in rtw_signal_stat_timer_hdl(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_recv.c | 10 ++ 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_recv.c b/drivers/staging/rtl8188eu/core/rtw_recv.c index 53dc33c..556be8c 100644 --- a/drivers/staging/rtl8188eu/core/rtw_recv.c +++ b/drivers/staging/rtl8188eu/core/rtw_recv.c @@ -2050,19 +2050,13 @@ static void rtw_signal_stat_timer_hdl(unsigned long data) if (check_fwstate(&adapter->mlmepriv, _FW_UNDER_SURVEY) == false) { tmp_s = avg_signal_strength + (_alpha - 1) * recvpriv->signal_strength; - if (tmp_s % _alpha) - tmp_s = tmp_s / _alpha + 1; - else - tmp_s = tmp_s / _alpha; + tmp_s = DIV_ROUND_UP(tmp_s, _alpha); if (tmp_s > 100) tmp_s = 100; tmp_q = avg_signal_qual + (_alpha - 1) * recvpriv->signal_qual; - if (tmp_q % _alpha) - tmp_q = tmp_q / _alpha + 1; - else - tmp_q = tmp_q / _alpha; + tmp_q = DIV_ROUND_UP(tmp_q, _alpha); if (tmp_q > 100) tmp_q = 100; -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/9] staging:r8188eu: refactor HT_caps_handler() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor HT_caps_handler(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_wlan_util.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c index f6f1b09..2db8a5d 100644 --- a/drivers/staging/rtl8188eu/core/rtw_wlan_util.c +++ b/drivers/staging/rtl8188eu/core/rtw_wlan_util.c @@ -708,7 +708,6 @@ static void bwmode_update_check(struct adapter *padapter, struct ndis_802_11_var void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) { unsigned inti; - u8 rf_type; u8 max_AMPDU_len, min_MPDU_spacing; struct mlme_ext_priv*pmlmeext = &padapter->mlmeextpriv; struct mlme_ext_info*pmlmeinfo = &(pmlmeext->mlmext_info); @@ -744,15 +743,9 @@ void HT_caps_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) } } - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - /* update the MCS rates */ - for (i = 0; i < 16; i++) { - if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; - else - ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_2R[i]; - } + for (i = 0; i < 16; i++) + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; } void HT_info_handler(struct adapter *padapter, struct ndis_802_11_var_ie *pIE) -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 9/9] staging:r8188eu: remove unused MCS_rate_2R array
MCS_rate_2R[] does not used. Remove it. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 1 - drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 1 - drivers/staging/rtl8188eu/include/rtw_mlme.h | 1 - 3 files changed, 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index 0ac63a6..fce7c26 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -28,7 +28,6 @@ #include #include -extern unsigned char MCS_rate_2R[16]; extern unsigned char MCS_rate_1R[16]; int rtw_init_mlme_priv(struct adapter *padapter) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index 51584c8..30dd4ed 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -47,7 +47,6 @@ extern unsigned char REALTEK_96B_IE[]; / MCS rate definitions */ -unsigned char MCS_rate_2R[16] = {0xff, 0xff, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; unsigned char MCS_rate_1R[16] = {0xff, 0x00, 0x0, 0x0, 0x01, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0}; / diff --git a/drivers/staging/rtl8188eu/include/rtw_mlme.h b/drivers/staging/rtl8188eu/include/rtw_mlme.h index 7324a95..5c5d0ae 100644 --- a/drivers/staging/rtl8188eu/include/rtw_mlme.h +++ b/drivers/staging/rtl8188eu/include/rtw_mlme.h @@ -216,7 +216,6 @@ void hostapd_mode_unload(struct adapter *padapter); extern unsigned char WPA_TKIP_CIPHER[4]; extern unsigned char RSN_TKIP_CIPHER[4]; extern unsigned char REALTEK_96B_IE[]; -extern unsigned char MCS_rate_2R[16]; extern unsigned char MCS_rate_1R[16]; void rtw_joinbss_event_prehandle(struct adapter *adapter, u8 *pbuf); -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/9] staging:r8188eu: refactor rtw_get_cur_max_rate() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor rtw_get_cur_max_rate(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_ioctl_set.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c index 67508a6..d8d88b5 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c +++ b/drivers/staging/rtl8188eu/core/rtw_ioctl_set.c @@ -569,7 +569,6 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) struct registry_priv *pregistrypriv = &adapter->registrypriv; struct mlme_priv*pmlmepriv = &adapter->mlmepriv; struct wlan_bssid_ex *pcur_bss = &pmlmepriv->cur_network.network; - u8 rf_type = 0; u8 bw_40MHz = 0, short_GI_20 = 0, short_GI_40 = 0; u32 ht_ielen = 0; @@ -586,9 +585,8 @@ u16 rtw_get_cur_max_rate(struct adapter *adapter) short_GI_20 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & IEEE80211_HT_CAP_SGI_20) ? 1 : 0; short_GI_40 = (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & IEEE80211_HT_CAP_SGI_40) ? 1 : 0; - rtw_hal_get_hwreg(adapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); max_rate = rtw_mcs_rate( - rf_type, + RF_1T1R, bw_40MHz & (pregistrypriv->cbw40_enable), short_GI_20, short_GI_40, -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/9] staging:r8188eu: remove unused HW_VAR_RF_TYPE parameter of HT_caps_handler
rtw_hal_get_hwreg() does not used with HW_VAR_RF_TYPE parameter. Remove HW_VAR_RF_TYPE switch case in rtw_hal_get_hwreg and definition. Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/hal/usb_halinit.c | 3 --- drivers/staging/rtl8188eu/include/hal_intf.h | 1 - 2 files changed, 4 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 3675edb..c87ab7d 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -1745,9 +1745,6 @@ void rtw_hal_get_hwreg(struct adapter *Adapter, u8 variable, u8 *val) /* BCN_VALID, BIT16 of REG_TDECTRL = BIT0 of REG_TDECTRL+2 */ val[0] = (BIT(0) & usb_read8(Adapter, REG_TDECTRL+2)) ? true : false; break; - case HW_VAR_RF_TYPE: - val[0] = RF_1T1R; - break; case HW_VAR_FWLPS_RF_ON: { /* When we halt NIC, we should check if FW LPS is leave. */ diff --git a/drivers/staging/rtl8188eu/include/hal_intf.h b/drivers/staging/rtl8188eu/include/hal_intf.h index e1114a9..dfdbd02 100644 --- a/drivers/staging/rtl8188eu/include/hal_intf.h +++ b/drivers/staging/rtl8188eu/include/hal_intf.h @@ -57,7 +57,6 @@ enum hw_variables { HW_VAR_ACK_PREAMBLE, HW_VAR_SEC_CFG, HW_VAR_BCN_VALID, - HW_VAR_RF_TYPE, HW_VAR_DM_FUNC_OP, HW_VAR_DM_FUNC_SET, HW_VAR_DM_FUNC_CLR, -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/9] staging:r8188eu: refactor rtw_check_beacon_data() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor rtw_check_beacon_data(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_ap.c | 9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 49ab1b4..255c30e 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -1024,15 +1024,12 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) p = rtw_get_ie(ie + _BEACON_IE_OFFSET_, _HT_CAPABILITY_IE_, &ie_len, (pbss_network->IELength - _BEACON_IE_OFFSET_)); if (p && ie_len > 0) { - u8 rf_type; struct ieee80211_ht_cap *pht_cap = (struct ieee80211_ht_cap *)(p + 2); pHT_caps_ie = p; ht_cap = true; network_type |= WIRELESS_11_24N; - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if ((psecuritypriv->wpa_pairwise_cipher & WPA_CIPHER_CCMP) || (psecuritypriv->wpa2_pairwise_cipher & WPA_CIPHER_CCMP)) pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_DENSITY & (0x07 << 2)); @@ -1042,10 +1039,8 @@ int rtw_check_beacon_data(struct adapter *padapter, u8 *pbuf, int len) /* set Max Rx AMPDU size to 64K */ pht_cap->ampdu_params_info |= (IEEE80211_HT_CAP_AMPDU_FACTOR & 0x03); - if (rf_type == RF_1T1R) { - pht_cap->mcs.rx_mask[0] = 0xff; - pht_cap->mcs.rx_mask[1] = 0x0; - } + pht_cap->mcs.rx_mask[0] = 0xff; + pht_cap->mcs.rx_mask[1] = 0x0; memcpy(&pmlmepriv->htpriv.ht_cap, p+2, ie_len); } -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/9] staging:r8188eu: refactor issue_assocreq() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor issue_assocreq(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_mlme_ext.c | 24 1 file changed, 4 insertions(+), 20 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c index f45af40..51584c8 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme_ext.c @@ -1027,7 +1027,7 @@ static void issue_assocreq(struct adapter *padapter) struct ieee80211_hdr *pwlanhdr; __le16 *fctrl; unsigned inti, j, ie_len, index = 0; - unsigned char rf_type, bssrate[NumRates], sta_bssrate[NumRates]; + unsigned char bssrate[NumRates], sta_bssrate[NumRates]; struct ndis_802_11_var_ie *pIE; struct registry_priv*pregpriv = &padapter->registrypriv; struct xmit_priv*pxmitpriv = &(padapter->xmitpriv); @@ -1150,25 +1150,9 @@ static void issue_assocreq(struct adapter *padapter) /* todo: disable SM power save mode */ pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x000c); - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - switch (rf_type) { - case RF_1T1R: - if (pregpriv->rx_stbc) - pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */ - memcpy((u8 *)&pmlmeinfo->HT_caps.mcs, MCS_rate_1R, 16); - break; - case RF_2T2R: - case RF_1T2R: - default: - if ((pregpriv->rx_stbc == 0x3) ||/* enable for 2.4/5 GHz */ - ((pmlmeext->cur_wireless_mode & WIRELESS_11_24N) && (pregpriv->rx_stbc == 0x1)) || /* enable for 2.4GHz */ - (pregpriv->wifi_spec == 1)) { - DBG_88E("declare supporting RX STBC\n"); - pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x0200);/* RX STBC two spatial stream */ - } - memcpy(&pmlmeinfo->HT_caps.mcs, MCS_rate_2R, 16); - break; - } + if (pregpriv->rx_stbc) + pmlmeinfo->HT_caps.cap_info |= cpu_to_le16(0x0100);/* RX STBC One spatial stream */ + memcpy((u8 *)&pmlmeinfo->HT_caps.mcs, MCS_rate_1R, 16); pframe = rtw_set_ie(pframe, _HT_CAPABILITY_IE_, ie_len, (u8 *)(&(pmlmeinfo->HT_caps)), &(pattrib->pktlen)); } } -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/9] staging:r8188eu: refactor rtw_update_ht_cap() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor rtw_update_ht_cap(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_mlme.c | 11 ++- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_mlme.c b/drivers/staging/rtl8188eu/core/rtw_mlme.c index a719289..0ac63a6 100644 --- a/drivers/staging/rtl8188eu/core/rtw_mlme.c +++ b/drivers/staging/rtl8188eu/core/rtw_mlme.c @@ -2018,17 +2018,10 @@ void rtw_update_ht_cap(struct adapter *padapter, u8 *pie, uint ie_len) (le16_to_cpu(pmlmeinfo->HT_caps.cap_info) & BIT(1)) && (pmlmeinfo->HT_info.infos[0] & BIT(2))) { int i; - u8 rf_type; - - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); /* update the MCS rates */ - for (i = 0; i < 16; i++) { - if ((rf_type == RF_1T1R) || (rf_type == RF_1T2R)) - ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; - else - ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_2R[i]; - } + for (i = 0; i < 16; i++) + ((u8 *)&pmlmeinfo->HT_caps.mcs)[i] &= MCS_rate_1R[i]; /* switch to the 40M Hz mode according to the AP */ pmlmeext->cur_bwmode = HT_CHANNEL_WIDTH_40; switch ((pmlmeinfo->HT_info.infos[0] & 0x3)) { -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/9] staging:r8188eu: refactor add_RATid() - remove rtw_hal_get_hwreg() call
rtw_hal_get_hwreg(..., HW_VAR_RF_TYPE,...) always return RF_1T1R value. Replace the function call with RF_1T1R value and refactor add_RATid(). Signed-off-by: Ivan Safonov --- drivers/staging/rtl8188eu/core/rtw_ap.c | 13 ++--- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8188eu/core/rtw_ap.c b/drivers/staging/rtl8188eu/core/rtw_ap.c index 1c8fa3a..49ab1b4 100644 --- a/drivers/staging/rtl8188eu/core/rtw_ap.c +++ b/drivers/staging/rtl8188eu/core/rtw_ap.c @@ -448,10 +448,8 @@ void expire_timeout_chk(struct adapter *padapter) void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) { int i; - u8 rf_type; u32 init_rate = 0; unsigned char sta_band = 0, raid, shortGIrate = false; - unsigned char limit; unsigned int tx_ra_bitmap = 0; struct ht_priv *psta_ht = NULL; struct mlme_priv *pmlmepriv = &padapter->mlmepriv; @@ -472,16 +470,9 @@ void add_RATid(struct adapter *padapter, struct sta_info *psta, u8 rssi_level) } /* n mode ra_bitmap */ if (psta_ht->ht_option) { - rtw_hal_get_hwreg(padapter, HW_VAR_RF_TYPE, (u8 *)(&rf_type)); - if (rf_type == RF_2T2R) - limit = 16;/* 2R */ - else - limit = 8;/* 1R */ - - for (i = 0; i < limit; i++) { - if (psta_ht->ht_cap.mcs.rx_mask[i / 8] & BIT(i % 8)) + for (i = 0; i < 8; i++) + if (psta_ht->ht_cap.mcs.rx_mask[0] & BIT(i)) tx_ra_bitmap |= BIT(i + 12); - } /* max short GI rate */ shortGIrate = psta_ht->sgi; -- 2.10.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch] Staging: bcm2835-audio: && vs & typo
We intended to mask away the upper bits but there is a "&&" vs "&" typo so it's broken. Fixes: 23b028c871e1 ("staging: bcm2835-audio: initial staging submission") Signed-off-by: Dan Carpenter diff --git a/drivers/staging/bcm2835-audio/bcm2835-ctl.c b/drivers/staging/bcm2835-audio/bcm2835-ctl.c index bfb7e9f74176..a4ffa1bf53e5 100644 --- a/drivers/staging/bcm2835-audio/bcm2835-ctl.c +++ b/drivers/staging/bcm2835-audio/bcm2835-ctl.c @@ -209,7 +209,7 @@ static int snd_bcm2835_spdif_default_get(struct snd_kcontrol *kcontrol, for (i = 0; i < 4; i++) ucontrol->value.iec958.status[i] = - (chip->spdif_status >> (i * 8)) && 0xff; + (chip->spdif_status >> (i * 8)) & 0xff; mutex_unlock(&chip->audio_mutex); return 0; ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[patch] staging: bcm2835-audio: allocate enough data for work queues
We accidentally allocate sizeof(void *) bytes instead of 112 bytes. It results in memory corruption. Fixes: 23b028c871e1 ("staging: bcm2835-audio: initial staging submission") Signed-off-by: Dan Carpenter diff --git a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c index d11f2cdd1014..f5c6a83569f3 100644 --- a/drivers/staging/bcm2835-audio/bcm2835-vchiq.c +++ b/drivers/staging/bcm2835-audio/bcm2835-vchiq.c @@ -134,8 +134,9 @@ int bcm2835_audio_start(struct bcm2835_alsa_stream *alsa_stream) int ret = -1; LOG_DBG(" .. IN\n"); if (alsa_stream->my_wq) { - struct bcm2835_audio_work *work = - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC); + struct bcm2835_audio_work *work; + + work = kmalloc(sizeof(*work), GFP_ATOMIC); /*--- Queue some work (item 1) ---*/ if (work) { INIT_WORK(&work->my_work, my_wq_function); @@ -155,8 +156,9 @@ int bcm2835_audio_stop(struct bcm2835_alsa_stream *alsa_stream) int ret = -1; LOG_DBG(" .. IN\n"); if (alsa_stream->my_wq) { - struct bcm2835_audio_work *work = - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC); + struct bcm2835_audio_work *work; + + work = kmalloc(sizeof(*work), GFP_ATOMIC); /*--- Queue some work (item 1) ---*/ if (work) { INIT_WORK(&work->my_work, my_wq_function); @@ -177,8 +179,9 @@ int bcm2835_audio_write(struct bcm2835_alsa_stream *alsa_stream, int ret = -1; LOG_DBG(" .. IN\n"); if (alsa_stream->my_wq) { - struct bcm2835_audio_work *work = - kmalloc(sizeof(struct bcm2835_audio_work *), GFP_ATOMIC); + struct bcm2835_audio_work *work; + + work = kmalloc(sizeof(*work), GFP_ATOMIC); /*--- Queue some work (item 1) ---*/ if (work) { INIT_WORK(&work->my_work, my_wq_function); ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] greybus: fw-management: Replace strncpy with strlcpy
Greybus currently uses strncpy() coupled with a check for '\0' on the last byte of various buffers. strncpy() is passed size parameter equal to the size of the buffer in all instances. If the source string is larger than the destination buffer the check catches this and, after logging the error, returns an error value. In one instance the immediate return is not required. Using strncpy() with the manual check adds code that could be removed by the use of strlcpy(), although truncation then needs to be checked. Replace calls to strncpy() with calls to strlcpy(). Replace null termination checks with checks for truncated string. Add log message if string is truncated but do not return an error code. Signed-off-by: Tobin C. Harding --- drivers/staging/greybus/fw-management.c | 59 +++-- 1 file changed, 19 insertions(+), 40 deletions(-) diff --git a/drivers/staging/greybus/fw-management.c b/drivers/staging/greybus/fw-management.c index 3cd6cf0..1cd5a45 100644 --- a/drivers/staging/greybus/fw-management.c +++ b/drivers/staging/greybus/fw-management.c @@ -108,6 +108,7 @@ static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt, struct gb_connection *connection = fw_mgmt->connection; struct gb_fw_mgmt_interface_fw_version_response response; int ret; + size_t len; ret = gb_operation_sync(connection, GB_FW_MGMT_TYPE_INTERFACE_FW_VERSION, NULL, 0, @@ -121,18 +122,11 @@ static int fw_mgmt_interface_fw_version_operation(struct fw_mgmt *fw_mgmt, fw_info->major = le16_to_cpu(response.major); fw_info->minor = le16_to_cpu(response.minor); - strncpy(fw_info->firmware_tag, response.firmware_tag, + len = strlcpy(fw_info->firmware_tag, response.firmware_tag, GB_FIRMWARE_TAG_MAX_SIZE); - - /* -* The firmware-tag should be NULL terminated, otherwise throw error but -* don't fail. -*/ - if (fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { + if (len >= GB_FIRMWARE_TAG_MAX_SIZE) dev_err(fw_mgmt->parent, - "fw-version: firmware-tag is not NULL terminated\n"); - fw_info->firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] = '\0'; - } + "fw-version: firmware-tag has been truncated\n"); return 0; } @@ -142,6 +136,7 @@ static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt, { struct gb_fw_mgmt_load_and_validate_fw_request request; int ret; + size_t len; if (load_method != GB_FW_LOAD_METHOD_UNIPRO && load_method != GB_FW_LOAD_METHOD_INTERNAL) { @@ -151,16 +146,10 @@ static int fw_mgmt_load_and_validate_operation(struct fw_mgmt *fw_mgmt, } request.load_method = load_method; - strncpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE); - - /* -* The firmware-tag should be NULL terminated, otherwise throw error and -* fail. -*/ - if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { - dev_err(fw_mgmt->parent, "load-and-validate: firmware-tag is not NULL terminated\n"); - return -EINVAL; - } + len = strlcpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE); + if (len >= GB_FIRMWARE_TAG_MAX_SIZE) + dev_err(fw_mgmt->parent, + "load-and-validate: firmware-tag has been truncated\n"); /* Allocate ids from 1 to 255 (u8-max), 0 is an invalid id */ ret = ida_simple_get(&fw_mgmt->id_map, 1, 256, GFP_KERNEL); @@ -247,18 +236,13 @@ static int fw_mgmt_backend_fw_version_operation(struct fw_mgmt *fw_mgmt, struct gb_fw_mgmt_backend_fw_version_request request; struct gb_fw_mgmt_backend_fw_version_response response; int ret; + size_t len; - strncpy(request.firmware_tag, fw_info->firmware_tag, + len = strlcpy(request.firmware_tag, fw_info->firmware_tag, GB_FIRMWARE_TAG_MAX_SIZE); - - /* -* The firmware-tag should be NULL terminated, otherwise throw error and -* fail. -*/ - if (request.firmware_tag[GB_FIRMWARE_TAG_MAX_SIZE - 1] != '\0') { - dev_err(fw_mgmt->parent, "backend-version: firmware-tag is not NULL terminated\n"); - return -EINVAL; - } + if (len >= GB_FIRMWARE_TAG_MAX_SIZE) + dev_err(fw_mgmt->parent, + "backend-version: firmware-tag has been truncated\n"); ret = gb_operation_sync(connection, GB_FW_MGMT_TYPE_BACKEND_FW_VERSION, &request, @@ -301,17 +285,12 @@ static int fw_mgmt_backend_fw_update_operation(struct fw_mgmt *fw_mgmt, { struct gb_fw_mgmt_backend_fw_update_request request; int ret; + size_t len; - strncpy(request.firmware_tag, tag, GB_FIRMWARE_TAG_MAX_SIZE)
[PATCH] staging: fbtft: Fix buffer overflow vulnerability
Module copies a user supplied string (module parameter) into a buffer using strncpy() and does not check that the buffer is null terminated. Replace call to strncpy() with call to strlcpy() ensuring that the buffer is null terminated. Signed-off-by: Tobin C. Harding --- drivers/staging/fbtft/fbtft_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index de46f8d..7b7223b 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1483,7 +1483,7 @@ static int __init fbtft_device_init(void) displays[i].pdev->name = name; displays[i].spi = NULL; } else { - strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); + strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); displays[i].pdev = NULL; } } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: fbtft: Fix buffer overflow vulnerability
On Wed, Feb 15, 2017 at 11:42:54AM +1100, Tobin C. Harding wrote: > Module copies a user supplied string (module parameter) into a buffer > using strncpy() and does not check that the buffer is null terminated. > > Replace call to strncpy() with call to strlcpy() ensuring that the > buffer is null terminated. > > Signed-off-by: Tobin C. Harding > --- > drivers/staging/fbtft/fbtft_device.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/fbtft/fbtft_device.c > b/drivers/staging/fbtft/fbtft_device.c > index de46f8d..7b7223b 100644 > --- a/drivers/staging/fbtft/fbtft_device.c > +++ b/drivers/staging/fbtft/fbtft_device.c > @@ -1483,7 +1483,7 @@ static int __init fbtft_device_init(void) > displays[i].pdev->name = name; > displays[i].spi = NULL; > } else { > - strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); > + strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); Shouldn't we properly check the return value here to know if the buffer did get truncated? Or do we really care? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v3 00/24] i.MX Media Driver
Hi Philipp, I've created a test branch off my imx-media-staging-md-wip called tc358743, which cherry-picks a couple of your commits from your imx-media-staging-md-wip branch: [media] tc358743: set entity function to video interface bridge [media] tc358743: put lanes in STOP state before starting streaming And one more commit that enables the tc358743 in the DT for sabrelite: ARM: dts: imx6-sabrelite: switch to tc358743 which is based off your work in imx6qdl-nitrogen6x-bd-hdmi-mipi.dtsi. With that the tc358743 is loading fine, and is present in the media graph: root@mx6q:~# dmesg | grep -i tc358 [ 11.056799] imx-media: Registered subdev tc358743 1-000f [ 11.122133] imx-media: imx_media_create_link: tc358743 1-000f:0 -> imx6-mipi-csi2:0 [ 11.490274] tc358743 1-000f: tc358743 found @ 0x1e (21a4000.i2c) But I'm not able to get to testing streaming yet, see below. On 01/31/2017 05:54 AM, Philipp Zabel wrote: Hi Steve, I have just tested the imx-media-staging-md-wip branch on a Nitrogen6X with a tc358743 (BD_HDMI_MIPI HDMI to MIPI CSI-2 receiver board). Some observations: # Link pipeline media-ctl -l "'tc358743 1-000f':0->'imx6-mipi-csi2':0[1]" media-ctl -l "'imx6-mipi-csi2':1->'ipu1_csi0_mux':0[1]" media-ctl -l "'ipu1_csi0_mux':2->'ipu1_csi0':0[1]" media-ctl -l "'ipu1_csi0':2->'ipu1_csi0 capture':0[1]" This works fine, I can create these links. # Provide an EDID to the HDMI source v4l2-ctl -d /dev/v4l-subdev2 --set-edid=file=edid-1080p.hex I can probably generate this Intel hex file myself from sysfs edid outputs, but for convenience do you mind sending me this file? I have a 1080p HDMI source I can plug into the tc358743. The other problem here is that my version of v4l2-ctl, built from master branch of g...@github.com:gjasny/v4l-utils.git, does not support taking a subdev node: root@mx6q:~# v4l2-ctl -d /dev/v4l-subdev15 --get-edid=format=hex VIDIOC_QUERYCAP: failed: Inappropriate ioctl for device /dev/v4l-subdev15: not a v4l2 node Is this something you added yourself, or where can I find this version of v4l2-ctrl? Thanks, Steve # At this point the HDMI source is enabled and sends a 1080p60 signal # Configure detected DV timings media-ctl --set-dv "'tc358743 1-000f':0" # Set pad formats media-ctl --set-v4l2 "'tc358743 1-000f':0[fmt:UYVY/1920x1080]" media-ctl --set-v4l2 "'imx6-mipi-csi2':1[fmt:UYVY2X8/1920x1080]" media-ctl --set-v4l2 "'ipu1_csi0_mux':2[fmt:UYVY2X8/1920x1080]" media-ctl --set-v4l2 "'ipu1_csi0':2[fmt:AYUV32/1920x1080]" v4l2-ctl -d /dev/video4 -V # This still is configured to 640x480, which is inconsistent with # the 'ipu1_csi0':2 pad format. The pad set_fmt above should # have set this, too. v4l2-ctl --list-formats -d /dev/video4 # This lists all the RGB formats, which it shouldn't. There is # no CSC in this pipeline, so we should be limited to YUV formats # only. # Set capture format v4l2-ctl -d /dev/video4 -v width=1920,height=1080,pixelformat=UYVY v4l2-ctl -d /dev/video4 -V # Now the capture format is correctly configured to 1920x1080. v4l2-ctl -d 4 --list-frameintervals=width=1920,height=1080,pixelformat=UYVY # This lists nothing. We should at least provide the 'ipu1_csi0':2 pad # frame interval. In the future this should list fractions achievable # via frame skipping. v4l2-compliance -d /dev/video4 # This fails two tests: # fail: v4l2-test-input-output.cpp(383): std == 0 # fail: v4l2-test-input-output.cpp(449): invalid attributes for input 0 # test VIDIOC_G/S/ENUMINPUT: FAIL # and # fail: v4l2-test-controls.cpp(782): subscribe event for control 'User Controls' failed # test VIDIOC_(UN)SUBSCRIBE_EVENT/DQEVENT: FAIL # (Slowly) stream JPEG images to a display host: gst-launch-1.0 -v v4l2src device=/dev/video4 ! jpegenc ! rtpjpegpay ! udpsink I've done this a few times, and sometimes I only get a "ipu1_csi0: EOF timeout" message when starting streaming. regards Philipp ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8712: Fix sparse warnings about endianness
drivers/staging/rtl8712/rtl871x_xmit.c:350:44: warning: restricted __le32 degrades to integer Signed-off-by: maomao xu diff --git a/drivers/staging/rtl8712/rtl871x_xmit.c b/drivers/staging/rtl8712/rtl871x_xmit.c index 4ab82ba..1c2ac28 100644 --- a/drivers/staging/rtl8712/rtl871x_xmit.c +++ b/drivers/staging/rtl8712/rtl871x_xmit.c @@ -347,7 +347,7 @@ sint r8712_update_attrib(struct _adapter *padapter, _pkt *pkt, * some settings above. */ if (check_fwstate(pmlmepriv, WIFI_MP_STATE)) - pattrib->priority = (txdesc.txdw1 >> QSEL_SHT) & 0x1f; + pattrib->priority = (le32_to_cpu(txdesc.txdw1) >> QSEL_SHT) & 0x1f; return _SUCCESS; } -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 6/9] staging: rtl8192u: Fixing coding style issues
Yes, I totally agree with joe. But as there is no coding style issue in this patch. So, do I have to resend the complete patch series again? On Wed, Feb 15, 2017 at 1:53 AM, Joe Perches wrote: > On Wed, 2017-02-15 at 01:44 +0530, simran singhal wrote: > [] >> diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c >> b/drivers/staging/rtl8192u/ieee80211/ieee80211_wx.c > [] >> @@ -150,14 +150,15 @@ static inline char *rtl819x_translate_scan(struct >> ieee80211_device *ieee, >> PHT_CAPABILITY_ELE ht_cap = NULL; >> bool is40M = false, isShortGI = false; >> u8 max_mcs = 0; >> + >> if (!memcmp(network->bssht.bdHTCapBuf, EWC11NHTCap, 4)) >> ht_cap = >> (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[4]; >> else >> ht_cap = >> (PHT_CAPABILITY_ELE)&network->bssht.bdHTCapBuf[0]; >> - is40M = (ht_cap->ChlWidth)?1:0; >> - isShortGI = (ht_cap->ChlWidth)? >> - ((ht_cap->ShortGI40Mhz)?1:0): >> - ((ht_cap->ShortGI20Mhz)?1:0); >> + is40M = (ht_cap->ChlWidth) ? 1 : 0; >> + isShortGI = (ht_cap->ChlWidth) ? >> + ((ht_cap->ShortGI40Mhz) ? 1 : >> 0) : >> + ((ht_cap->ShortGI20Mhz) ? 1 : >> 0); > > You have a brain, checkpatch is brainless. > Please remember to do more than just shut-up checkpatch. > > This could be simplified by removing parentheses and ternaries to > > isShortGI = ht_cap->Ch1Width ? ht_cap->ShortGI40Mhz > : ht_cap->ShortGI20Mhz; > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/3] staging: fbtft: Fix buffer overflow vulnerability
Module copies a user supplied string (module parameter) into a buffer using strncpy() and does not check that the buffer is null terminated. Replace call to strncpy() with call to strlcpy() ensuring that the buffer is null terminated. Replace magic number with pre-existing compile time constant. Check return value of call to strlcpy() and throw warning if source string is truncated. v1 was a single patch. v2 adds 2 extra patches while retaining the original v1 patch as the first of the series. v2: - Replace magic number - Check return value of call to strlcpy() Tobin C. Harding (3): staging: fbtft: Fix buffer overflow vulnerability staging: fbtft: Replace magic number with constant staging: fbtft: Add check on strlcpy() return value drivers/staging/fbtft/fbtft_device.c | 10 -- 1 file changed, 8 insertions(+), 2 deletions(-) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/3] staging: fbtft: Add check on strlcpy() return value
Return value of strlcpy() is not checked. Name string is silently truncated if longer that SPI_NAME_SIZE, whilst not detrimental to the program logic it would be nice to notify the user. Module is currently quite verbose, adding extra pr_warn() calls will not overly impact this verbosity. Check return value from call to strlcpy(). If source string is truncated call pr_warn() to notify user. Signed-off-by: Tobin C. Harding --- drivers/staging/fbtft/fbtft_device.c | 8 +++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 5fbdd37..78baf46 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1483,7 +1483,13 @@ static int __init fbtft_device_init(void) displays[i].pdev->name = name; displays[i].spi = NULL; } else { - strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); + size_t len; + + len = strlcpy(displays[i].spi->modalias, name, + SPI_NAME_SIZE); + if (len >= SPI_NAME_SIZE) + pr_warn("modalias (name) truncated to: %s\n", + displays[i].spi->modalias); displays[i].pdev = NULL; } } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/3] staging: fbtft: Replace magic number with constant
Current call to strncmp() uses a magic number. There is a compile time constant defined for this buffer, included and used already at other sites in the file. Remove magic number. Replace with pre-existing compile time constant. Signed-off-by: Tobin C. Harding --- drivers/staging/fbtft/fbtft_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index 7b7223b..5fbdd37 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1489,7 +1489,7 @@ static int __init fbtft_device_init(void) } for (i = 0; i < ARRAY_SIZE(displays); i++) { - if (strncmp(name, displays[i].name, 32) == 0) { + if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) { if (displays[i].spi) { spi = displays[i].spi; spi->chip_select = cs; -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/3] staging: fbtft: Fix buffer overflow vulnerability
Module copies a user supplied string (module parameter) into a buffer using strncpy() and does not check that the buffer is null terminated. Replace call to strncpy() with call to strlcpy() ensuring that the buffer is null terminated. Signed-off-by: Tobin C. Harding --- drivers/staging/fbtft/fbtft_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/fbtft/fbtft_device.c b/drivers/staging/fbtft/fbtft_device.c index de46f8d..7b7223b 100644 --- a/drivers/staging/fbtft/fbtft_device.c +++ b/drivers/staging/fbtft/fbtft_device.c @@ -1483,7 +1483,7 @@ static int __init fbtft_device_init(void) displays[i].pdev->name = name; displays[i].spi = NULL; } else { - strncpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); + strlcpy(displays[i].spi->modalias, name, SPI_NAME_SIZE); displays[i].pdev = NULL; } } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/3] staging: fbtft: Replace magic number with constant
On Wed, 2017-02-15 at 14:27 +1100, Tobin C. Harding wrote: > Current call to strncmp() uses a magic number. There is a compile > time constant defined for this buffer, included and used already at > other sites in the file. > > Remove magic number. Replace with pre-existing compile time constant. OK thanks, as well: > diff --git a/drivers/staging/fbtft/fbtft_device.c > b/drivers/staging/fbtft/fbtft_device.c [] > @@ -1489,7 +1489,7 @@ static int __init fbtft_device_init(void) > } > > for (i = 0; i < ARRAY_SIZE(displays); i++) { > - if (strncmp(name, displays[i].name, 32) == 0) { > + if (strncmp(name, displays[i].name, SPI_NAME_SIZE) == 0) { Maybe change this to: if (strncmp(name, displays[i].name, SPI_NAME_SIZE) != 0) continue; and reduce the indentation of the rest of the block. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: xgifb: function definition argument should also have an identifier name
On Wed, 2017-02-15 at 09:01 +0530, Arushi Singhal wrote: > Hi Joe > Sorry but I am unable to find the identifier of "unsigned long" .Shall you > please help me in how to find the identifier. > Thanks > Arushi Singhal $ git grep -w XGIRegInit drivers/staging/xgifb/XGI_main_26.c:void XGIRegInit(struct vb_device_info *XGI_Pr, unsigned long BaseAddr) > On Wed, Feb 15, 2017 at 2:13 AM, Joe Perches wrote: > > > On Wed, 2017-02-15 at 02:03 +0530, Arushi Singhal wrote: > > > function definition argument 'struct vb_device_info *' should also have > > > an identifier name. > > > > [] > > > diff --git a/drivers/staging/xgifb/vb_init.h b/drivers/staging/xgifb/vb_ > > > > init.h > > [] > > > @@ -1,6 +1,6 @@ > > > #ifndef _VBINIT_ > > > #define _VBINIT_ > > > unsigned char XGIInitNew(struct pci_dev *pdev); > > > -void XGIRegInit(struct vb_device_info *, unsigned long); > > > +void XGIRegInit(struct vb_device_info *pVBInfo, unsigned long); > > > > Why do one argument but not the other? > > > > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: wlan-ng: Fixed the code style issue:
WARNING: Block comments should align the * on each line Signed-off-by: Bo YU --- drivers/staging/wlan-ng/p80211metastruct.h | 88 ++-- 1 file changed, 44 insertions(+), 44 deletions(-) diff --git a/drivers/staging/wlan-ng/p80211metastruct.h b/drivers/staging/wlan-ng/p80211metastruct.h index 850d897fc163..c2ffec4daa90 100644 --- a/drivers/staging/wlan-ng/p80211metastruct.h +++ b/drivers/staging/wlan-ng/p80211metastruct.h @@ -1,48 +1,48 @@ /* This file is GENERATED AUTOMATICALLY. DO NOT EDIT OR MODIFY. -* -* -* Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. -* -* -* linux-wlan -* -* The contents of this file are subject to the Mozilla Public -* License Version 1.1 (the "License"); you may not use this file -* except in compliance with the License. You may obtain a copy of -* the License at http://www.mozilla.org/MPL/ -* -* Software distributed under the License is distributed on an "AS -* IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or -* implied. See the License for the specific language governing -* rights and limitations under the License. -* -* Alternatively, the contents of this file may be used under the -* terms of the GNU Public License version 2 (the "GPL"), in which -* case the provisions of the GPL are applicable instead of the -* above. If you wish to allow the use of your version of this file -* only under the terms of the GPL and not to allow others to use -* your version of this file under the MPL, indicate your decision -* by deleting the provisions above and replace them with the notice -* and other provisions required by the GPL. If you do not delete -* the provisions above, a recipient may use your version of this -* file under either the MPL or the GPL. -* -* -* -* Inquiries regarding the linux-wlan Open Source project can be -* made directly to: -* -* AbsoluteValue Systems Inc. -* i...@linux-wlan.com -* http://www.linux-wlan.com -* -* -* -* Portions of the development of this software were funded by -* Intersil Corporation as part of PRISM(R) chipset product development. -* -* -*/ + * + * + * Copyright (C) 1999 AbsoluteValue Systems, Inc. All Rights Reserved. + * + * + * linux-wlan + * + * The contents of this file are subject to the Mozilla Public + * License Version 1.1 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS + * IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or + * implied. See the License for the specific language governing + * rights and limitations under the License. + * + * Alternatively, the contents of this file may be used under the + * terms of the GNU Public License version 2 (the "GPL"), in which + * case the provisions of the GPL are applicable instead of the + * above. If you wish to allow the use of your version of this file + * only under the terms of the GPL and not to allow others to use + * your version of this file under the MPL, indicate your decision + * by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL. If you do not delete + * the provisions above, a recipient may use your version of this + * file under either the MPL or the GPL. + * + * + * + * Inquiries regarding the linux-wlan Open Source project can be + * made directly to: + * + * AbsoluteValue Systems Inc. + * i...@linux-wlan.com + * http://www.linux-wlan.com + * + * + * + * Portions of the development of this software were funded by + * Intersil Corporation as part of PRISM(R) chipset product development. + * + * + */ #ifndef _P80211MKMETASTRUCT_H #define _P80211MKMETASTRUCT_H -- 1.7.10.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 6/9] staging: rtl8192u: Fixing coding style issues
On Wed, 2017-02-15 at 08:52 +0530, SIMRAN SINGHAL wrote: > Yes, I totally agree with joe. > > But as there is no coding style issue in this patch. Style is more than just checkpatch conformity. > So, do I have to resend the complete patch series again? I'm not applying any of these so that's entirely up to Greg. Perhaps he might apply the first 5 patches and reject this one, maybe he might apply all the patches. In any case, do strive to develop some reasonable semblance of style and do more than just checkpatch suggested patches and find and fix some actual defect somewhere. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/8] hyperv: fix warning about missing prototype
Compiling with warnings enabled finds missing prototype for hv_do_hypercall. Signed-off-by: Stephen Hemminger --- arch/x86/hyperv/hv_init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c index db64baf0e500..d4a5f820af5d 100644 --- a/arch/x86/hyperv/hv_init.c +++ b/arch/x86/hyperv/hv_init.c @@ -25,7 +25,7 @@ #include #include #include - +#include #ifdef CONFIG_X86_64 -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 5/8] vmbus: fix spelling errors
Several spelling errors in comments Signed-off-by: Stephen Hemminger --- drivers/hv/channel.c | 10 +- drivers/hv/hv_kvp.c | 10 +- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index 81a80c82f1bd..deb852238b2d 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -333,7 +333,7 @@ static int create_gpadl_header(void *kbuffer, u32 size, * Gpadl is u32 and we are using a pointer which could * be 64-bit * This is governed by the guest/host protocol and -* so the hypervisor gurantees that this is ok. +* so the hypervisor guarantees that this is ok. */ for (i = 0; i < pfncurr; i++) gpadl_body->pfn[i] = slow_virt_to_phys( @@ -380,7 +380,7 @@ static int create_gpadl_header(void *kbuffer, u32 size, } /* - * vmbus_establish_gpadl - Estabish a GPADL for the specified buffer + * vmbus_establish_gpadl - Establish a GPADL for the specified buffer * * @channel: a channel * @kbuffer: from kmalloc or vmalloc @@ -732,7 +732,7 @@ int vmbus_sendpacket_pagebuffer_ctl(struct vmbus_channel *channel, /* Setup the descriptor */ desc.type = VM_PKT_DATA_USING_GPA_DIRECT; desc.flags = flags; - desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */ + desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */ desc.length8 = (u16)(packetlen_aligned >> 3); desc.transactionid = requestid; desc.rangecount = pagecount; @@ -793,7 +793,7 @@ int vmbus_sendpacket_mpb_desc(struct vmbus_channel *channel, /* Setup the descriptor */ desc->type = VM_PKT_DATA_USING_GPA_DIRECT; desc->flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; - desc->dataoffset8 = desc_size >> 3; /* in 8-bytes grandularity */ + desc->dataoffset8 = desc_size >> 3; /* in 8-bytes granularity */ desc->length8 = (u16)(packetlen_aligned >> 3); desc->transactionid = requestid; desc->rangecount = 1; @@ -843,7 +843,7 @@ int vmbus_sendpacket_multipagebuffer(struct vmbus_channel *channel, /* Setup the descriptor */ desc.type = VM_PKT_DATA_USING_GPA_DIRECT; desc.flags = VMBUS_DATA_PACKET_FLAG_COMPLETION_REQUESTED; - desc.dataoffset8 = descsize >> 3; /* in 8-bytes grandularity */ + desc.dataoffset8 = descsize >> 3; /* in 8-bytes granularity */ desc.length8 = (u16)(packetlen_aligned >> 3); desc.transactionid = requestid; desc.rangecount = 1; diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index a65b7f88d7aa..b0a36e8a7268 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -69,7 +69,7 @@ static const int fw_versions[] = { * * While the request/response protocol is guaranteed by the host, we further * ensure this by serializing packet processing in this driver - we do not - * read additional packets from the VMBUs until the current packet is fully + * read additional packets from the VMBUS until the current packet is fully * handled. */ @@ -398,7 +398,7 @@ kvp_send_key(struct work_struct *dummy) * the max lengths specified. We will however, reserve room * for the string terminating character - in the utf16s_utf8s() * function we limit the size of the buffer where the converted -* string is placed to HV_KVP_EXCHANGE_MAX_*_SIZE -1 to gaurantee +* string is placed to HV_KVP_EXCHANGE_MAX_*_SIZE -1 to guarantee * that the strings can be properly terminated! */ @@ -532,7 +532,7 @@ kvp_respond_to_host(struct hv_kvp_msg *msg_to_host, int error) */ if (error) { /* -* Something failed or we have timedout; +* Something failed or we have timed out; * terminate the current host-side iteration. */ goto response_done; @@ -606,8 +606,8 @@ kvp_respond_to_host(struct hv_kvp_msg *msg_to_host, int error) * This callback is invoked when we get a KVP message from the host. * The host ensures that only one KVP transaction can be active at a time. * KVP implementation in Linux needs to forward the key to a user-mde - * component to retrive the corresponding value. Consequently, we cannot - * respond to the host in the conext of this callback. Since the host + * component to retrieve the corresponding value. Consequently, we cannot + * respond to the host in the context of this callback. Since the host * guarantees that at most only one transaction can be active at a time, * we stash away the transaction state in a set of global variables. */ -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/
[PATCH 0/8] vmbus: cleanup patches
These are non-critical cleanup patches to vmbus code. The only possible bug fix is the second one which relates to using RCU to avoid problems if there was guest/host confusion on shutdown. Stephen Hemminger (8): hyperv: fix warning about missing prototype vmbus: use rcu for per-cpu channel list vmbus: remove useless return's vmbus: remove unnecessary initialization vmbus: fix spelling errors vmbus: remove unused low_latency option hyperv: remove unnecessary return variable vmbus: make channel_message table constant arch/x86/hyperv/hv_init.c | 2 +- drivers/hv/channel.c | 12 +-- drivers/hv/channel_mgmt.c | 55 --- drivers/hv/hv_balloon.c | 2 -- drivers/hv/hv_fcopy.c | 2 -- drivers/hv/hv_kvp.c | 12 +-- drivers/hv/hv_snapshot.c | 2 -- drivers/hv/hyperv_vmbus.h | 2 +- drivers/hv/ring_buffer.c | 21 ++ drivers/hv/vmbus_drv.c| 8 --- include/linux/hyperv.h| 41 +-- 11 files changed, 58 insertions(+), 101 deletions(-) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 6/8] vmbus: remove unused low_latency option
This was intended for future use, but since the code is currently unused (and therefore dead and unused), remove it. It can be restored when there is a use case. Signed-off-by: Stephen Hemminger --- drivers/hv/channel.c | 2 +- include/linux/hyperv.h | 36 2 files changed, 1 insertion(+), 37 deletions(-) diff --git a/drivers/hv/channel.c b/drivers/hv/channel.c index deb852238b2d..01d5bdb69770 100644 --- a/drivers/hv/channel.c +++ b/drivers/hv/channel.c @@ -47,7 +47,7 @@ void vmbus_setevent(struct vmbus_channel *channel) * For channels marked as in "low latency" mode * bypass the monitor page mechanism. */ - if (channel->offermsg.monitor_allocated && !channel->low_latency) { + if (channel->offermsg.monitor_allocated) { vmbus_send_interrupt(channel->offermsg.child_relid); /* Get the child to parent monitor page */ diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index b8807da6ef72..09d10a4a34f4 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -853,32 +853,6 @@ struct vmbus_channel { struct rcu_head rcu; /* -* For performance critical channels (storage, networking -* etc,), Hyper-V has a mechanism to enhance the throughput -* at the expense of latency: -* When the host is to be signaled, we just set a bit in a shared page -* and this bit will be inspected by the hypervisor within a certain -* window and if the bit is set, the host will be signaled. The window -* of time is the monitor latency - currently around 100 usecs. This -* mechanism improves throughput by: -* -* A) Making the host more efficient - each time it wakes up, -*potentially it will process morev number of packets. The -*monitor latency allows a batch to build up. -* B) By deferring the hypercall to signal, we will also minimize -*the interrupts. -* -* Clearly, these optimizations improve throughput at the expense of -* latency. Furthermore, since the channel is shared for both -* control and data messages, control messages currently suffer -* unnecessary latency adversley impacting performance and boot -* time. To fix this issue, permit tagging the channel as being -* in "low latency" mode. In this mode, we will bypass the monitor -* mechanism. -*/ - bool low_latency; - - /* * NUMA distribution policy: * We support teo policies: * 1) Balanced: Here all performance critical channels are @@ -926,16 +900,6 @@ static inline void set_channel_pending_send_size(struct vmbus_channel *c, c->outbound.ring_buffer->pending_send_sz = size; } -static inline void set_low_latency_mode(struct vmbus_channel *c) -{ - c->low_latency = true; -} - -static inline void clear_low_latency_mode(struct vmbus_channel *c) -{ - c->low_latency = false; -} - void vmbus_onmessage(void *context); int vmbus_request_offers(void); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/8] vmbus: remove unnecessary initialization
Don't initialize variables that are then set a few lines later. Signed-off-by: Stephen Hemminger --- drivers/hv/ring_buffer.c | 13 + 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index d0ff5b41161a..52d0556a5a25 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -265,14 +265,13 @@ void hv_ringbuffer_cleanup(struct hv_ring_buffer_info *ring_info) int hv_ringbuffer_write(struct vmbus_channel *channel, const struct kvec *kv_list, u32 kv_count) { - int i = 0; + int i; u32 bytes_avail_towrite; - u32 totalbytes_towrite = 0; - + u32 totalbytes_towrite = sizeof(u64); u32 next_write_location; u32 old_write; - u64 prev_indices = 0; - unsigned long flags = 0; + u64 prev_indices; + unsigned long flags; struct hv_ring_buffer_info *outring_info = &channel->outbound; if (channel->rescind) @@ -281,8 +280,6 @@ int hv_ringbuffer_write(struct vmbus_channel *channel, for (i = 0; i < kv_count; i++) totalbytes_towrite += kv_list[i].iov_len; - totalbytes_towrite += sizeof(u64); - spin_lock_irqsave(&outring_info->ring_lock, flags); bytes_avail_towrite = hv_get_bytes_to_write(outring_info); @@ -339,7 +336,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, u64 *requestid, bool raw) { u32 bytes_avail_toread; - u32 next_read_location = 0; + u32 next_read_location; u64 prev_indices = 0; struct vmpacket_descriptor desc; u32 offset; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/8] vmbus: use rcu for per-cpu channel list
The per-cpu channel list is now referred to in the interrupt routine. This is mostly safe since the host will not normally generate an interrupt when channel is being deleted but if it did then there would be a use after free problem. To solve, this use RCU protection on ther per-cpu list. Signed-off-by: Stephen Hemminger --- drivers/hv/channel_mgmt.c | 7 --- drivers/hv/vmbus_drv.c| 6 +- include/linux/hyperv.h| 9 - 3 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index f33465d78a02..d2cfa3eb71a2 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -350,7 +350,8 @@ static struct vmbus_channel *alloc_channel(void) static void free_channel(struct vmbus_channel *channel) { tasklet_kill(&channel->callback_event); - kfree(channel); + + kfree_rcu(channel, rcu); } static void percpu_channel_enq(void *arg) @@ -359,14 +360,14 @@ static void percpu_channel_enq(void *arg) struct hv_per_cpu_context *hv_cpu = this_cpu_ptr(hv_context.cpu_context); - list_add_tail(&channel->percpu_list, &hv_cpu->chan_list); + list_add_tail_rcu(&channel->percpu_list, &hv_cpu->chan_list); } static void percpu_channel_deq(void *arg) { struct vmbus_channel *channel = arg; - list_del(&channel->percpu_list); + list_del_rcu(&channel->percpu_list); } diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index f7f6b9144b07..971ecb7c4795 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -937,8 +937,10 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) if (relid == 0) continue; + rcu_read_lock(); + /* Find channel based on relid */ - list_for_each_entry(channel, &hv_cpu->chan_list, percpu_list) { + list_for_each_entry_rcu(channel, &hv_cpu->chan_list, percpu_list) { if (channel->offermsg.child_relid != relid) continue; @@ -954,6 +956,8 @@ static void vmbus_chan_sched(struct hv_per_cpu_context *hv_cpu) tasklet_schedule(&channel->callback_event); } } + + rcu_read_unlock(); } } diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 62bbf3c1aa4a..9e80d8c3d3a5 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -844,7 +844,14 @@ struct vmbus_channel { * To support per-cpu lookup mapping of relid to channel, * link up channels based on their CPU affinity. */ - struct list_head percpu_list; + struct list_head __rcu percpu_list; + + /* +* Defer freeing channel until after all cpu's have +* gone through grace period. +*/ + struct rcu_head rcu; + /* * For performance critical channels (storage, networking * etc,), Hyper-V has a mechanism to enhance the throughput -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/8] vmbus: remove useless return's
No need for empty return at end of void function Signed-off-by: Stephen Hemminger --- drivers/hv/hv_balloon.c | 2 -- drivers/hv/hv_fcopy.c| 2 -- drivers/hv/hv_kvp.c | 2 -- drivers/hv/hv_snapshot.c | 2 -- drivers/hv/ring_buffer.c | 2 -- drivers/hv/vmbus_drv.c | 2 -- include/linux/hyperv.h | 2 -- 7 files changed, 14 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 5fd03e59cee5..f5728deff893 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -722,8 +722,6 @@ static void hv_mem_hot_add(unsigned long start, unsigned long size, 5*HZ); post_status(&dm_device); } - - return; } static void hv_online_page(struct page *pg) diff --git a/drivers/hv/hv_fcopy.c b/drivers/hv/hv_fcopy.c index 9aee6014339d..3ce7559d7b41 100644 --- a/drivers/hv/hv_fcopy.c +++ b/drivers/hv/hv_fcopy.c @@ -187,8 +187,6 @@ static void fcopy_send_data(struct work_struct *dummy) } } kfree(smsg_out); - - return; } /* diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index de263712e247..a65b7f88d7aa 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -484,8 +484,6 @@ kvp_send_key(struct work_struct *dummy) } kfree(message); - - return; } /* diff --git a/drivers/hv/hv_snapshot.c b/drivers/hv/hv_snapshot.c index bcc03f0748d6..216d02277759 100644 --- a/drivers/hv/hv_snapshot.c +++ b/drivers/hv/hv_snapshot.c @@ -213,8 +213,6 @@ static void vss_send_op(void) } kfree(vss_msg); - - return; } static void vss_handle_request(struct work_struct *dummy) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 87799e81af97..d0ff5b41161a 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -73,8 +73,6 @@ static void hv_signal_on_write(u32 old_write, struct vmbus_channel *channel) */ if (old_write == READ_ONCE(rbi->ring_buffer->read_index)) vmbus_setevent(channel); - - return; } /* Get the next write location for the specified ring buffer. */ diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 971ecb7c4795..9ddbf4d03536 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -785,8 +785,6 @@ static void vmbus_shutdown(struct device *child_device) if (drv->shutdown) drv->shutdown(dev); - - return; } diff --git a/include/linux/hyperv.h b/include/linux/hyperv.h index 9e80d8c3d3a5..b8807da6ef72 100644 --- a/include/linux/hyperv.h +++ b/include/linux/hyperv.h @@ -1507,8 +1507,6 @@ static inline void hv_signal_on_read(struct vmbus_channel *channel) cached_write_sz = hv_get_cached_bytes_to_write(rbi); if (cached_write_sz < pending_sz) vmbus_setevent(channel); - - return; } static inline void -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 8/8] vmbus: make channel_message table constant
This table is immutable and should be const. Cleanup indentation and whitespace for this as well. Signed-off-by: Stephen Hemminger --- drivers/hv/channel_mgmt.c | 48 +++ drivers/hv/hyperv_vmbus.h | 2 +- 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index d2cfa3eb71a2..e8f52c0f6dc6 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -1098,30 +1098,30 @@ static void vmbus_onversion_response( } /* Channel message dispatch table */ -struct vmbus_channel_message_table_entry - channel_message_table[CHANNELMSG_COUNT] = { - {CHANNELMSG_INVALID,0, NULL}, - {CHANNELMSG_OFFERCHANNEL, 0, vmbus_onoffer}, - {CHANNELMSG_RESCIND_CHANNELOFFER, 0, vmbus_onoffer_rescind}, - {CHANNELMSG_REQUESTOFFERS, 0, NULL}, - {CHANNELMSG_ALLOFFERS_DELIVERED,1, vmbus_onoffers_delivered}, - {CHANNELMSG_OPENCHANNEL,0, NULL}, - {CHANNELMSG_OPENCHANNEL_RESULT, 1, vmbus_onopen_result}, - {CHANNELMSG_CLOSECHANNEL, 0, NULL}, - {CHANNELMSG_GPADL_HEADER, 0, NULL}, - {CHANNELMSG_GPADL_BODY, 0, NULL}, - {CHANNELMSG_GPADL_CREATED, 1, vmbus_ongpadl_created}, - {CHANNELMSG_GPADL_TEARDOWN, 0, NULL}, - {CHANNELMSG_GPADL_TORNDOWN, 1, vmbus_ongpadl_torndown}, - {CHANNELMSG_RELID_RELEASED, 0, NULL}, - {CHANNELMSG_INITIATE_CONTACT, 0, NULL}, - {CHANNELMSG_VERSION_RESPONSE, 1, vmbus_onversion_response}, - {CHANNELMSG_UNLOAD, 0, NULL}, - {CHANNELMSG_UNLOAD_RESPONSE,1, vmbus_unload_response}, - {CHANNELMSG_18, 0, NULL}, - {CHANNELMSG_19, 0, NULL}, - {CHANNELMSG_20, 0, NULL}, - {CHANNELMSG_TL_CONNECT_REQUEST, 0, NULL}, +const struct vmbus_channel_message_table_entry +channel_message_table[CHANNELMSG_COUNT] = { + { CHANNELMSG_INVALID, 0, NULL }, + { CHANNELMSG_OFFERCHANNEL, 0, vmbus_onoffer }, + { CHANNELMSG_RESCIND_CHANNELOFFER, 0, vmbus_onoffer_rescind }, + { CHANNELMSG_REQUESTOFFERS, 0, NULL }, + { CHANNELMSG_ALLOFFERS_DELIVERED, 1, vmbus_onoffers_delivered }, + { CHANNELMSG_OPENCHANNEL, 0, NULL }, + { CHANNELMSG_OPENCHANNEL_RESULT,1, vmbus_onopen_result }, + { CHANNELMSG_CLOSECHANNEL, 0, NULL }, + { CHANNELMSG_GPADL_HEADER, 0, NULL }, + { CHANNELMSG_GPADL_BODY,0, NULL }, + { CHANNELMSG_GPADL_CREATED, 1, vmbus_ongpadl_created }, + { CHANNELMSG_GPADL_TEARDOWN,0, NULL }, + { CHANNELMSG_GPADL_TORNDOWN,1, vmbus_ongpadl_torndown }, + { CHANNELMSG_RELID_RELEASED,0, NULL }, + { CHANNELMSG_INITIATE_CONTACT, 0, NULL }, + { CHANNELMSG_VERSION_RESPONSE, 1, vmbus_onversion_response }, + { CHANNELMSG_UNLOAD,0, NULL }, + { CHANNELMSG_UNLOAD_RESPONSE, 1, vmbus_unload_response }, + { CHANNELMSG_18,0, NULL }, + { CHANNELMSG_19,0, NULL }, + { CHANNELMSG_20,0, NULL }, + { CHANNELMSG_TL_CONNECT_REQUEST,0, NULL }, }; /* diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index 884f83bba1ab..b552c3a4dd3c 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -376,7 +376,7 @@ struct vmbus_channel_message_table_entry { void (*message_handler)(struct vmbus_channel_message_header *msg); }; -extern struct vmbus_channel_message_table_entry +extern const struct vmbus_channel_message_table_entry channel_message_table[CHANNELMSG_COUNT]; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 7/8] hyperv: remove unnecessary return variable
hv_ringbuffer_read cleanup. Signed-off-by: Stephen Hemminger --- drivers/hv/ring_buffer.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hv/ring_buffer.c b/drivers/hv/ring_buffer.c index 52d0556a5a25..8a249740b4b4 100644 --- a/drivers/hv/ring_buffer.c +++ b/drivers/hv/ring_buffer.c @@ -341,13 +341,11 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, struct vmpacket_descriptor desc; u32 offset; u32 packetlen; - int ret = 0; struct hv_ring_buffer_info *inring_info = &channel->inbound; if (buflen <= 0) return -EINVAL; - *buffer_actual_len = 0; *requestid = 0; @@ -358,7 +356,7 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, * No error is set when there is even no header, drivers are * supposed to analyze buffer_actual_len. */ - return ret; + return 0; } init_cached_read_index(channel); @@ -403,5 +401,5 @@ int hv_ringbuffer_read(struct vmbus_channel *channel, hv_signal_on_read(channel); - return ret; + return 0; } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192u: Fix sparse warnings about endianness
drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c:175:36: warning: incorrect type in assignment (different base types) drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c:175:36:expected unsigned short [unsigned] [short] [usertype] drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c:175:36:got restricted __be16 [usertype] Signed-off-by: maomao xu diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c index 949c496..a1da90a 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_tx.c @@ -172,7 +172,7 @@ static inline int ieee80211_put_snap(u8 *data, u16 h_proto) snap->oui[1] = oui[1]; snap->oui[2] = oui[2]; - *(u16 *)(data + SNAP_SIZE) = htons(h_proto); + put_unaligned_be16(h_proto, data + SNAP_SIZE); return SNAP_SIZE + sizeof(u16); } -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8192u: Fix warnings about endianness
drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c:177:16: warning: cast to restricted __le16 Signed-off-by: maomao xu diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c index 2453413..fb171bd 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_crypt_tkip.c @@ -172,7 +172,7 @@ static inline u16 Mk16(u8 hi, u8 lo) } -static inline u16 Mk16_le(u16 *v) +static inline u16 Mk16_le(__le16 *v) { return le16_to_cpu(*v); } @@ -264,15 +264,15 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, PPK[5] = TTAK[4] + IV16; /* Step 2 - 96-bit bijective mixing using S-box */ - PPK[0] += _S_(PPK[5] ^ Mk16_le((u16 *) &TK[0])); - PPK[1] += _S_(PPK[0] ^ Mk16_le((u16 *) &TK[2])); - PPK[2] += _S_(PPK[1] ^ Mk16_le((u16 *) &TK[4])); - PPK[3] += _S_(PPK[2] ^ Mk16_le((u16 *) &TK[6])); - PPK[4] += _S_(PPK[3] ^ Mk16_le((u16 *) &TK[8])); - PPK[5] += _S_(PPK[4] ^ Mk16_le((u16 *) &TK[10])); - - PPK[0] += RotR1(PPK[5] ^ Mk16_le((u16 *) &TK[12])); - PPK[1] += RotR1(PPK[0] ^ Mk16_le((u16 *) &TK[14])); + PPK[0] += _S_(PPK[5] ^ Mk16_le((__le16 *) &TK[0])); + PPK[1] += _S_(PPK[0] ^ Mk16_le((__le16 *) &TK[2])); + PPK[2] += _S_(PPK[1] ^ Mk16_le((__le16 *) &TK[4])); + PPK[3] += _S_(PPK[2] ^ Mk16_le((__le16 *) &TK[6])); + PPK[4] += _S_(PPK[3] ^ Mk16_le((__le16 *) &TK[8])); + PPK[5] += _S_(PPK[4] ^ Mk16_le((__le16 *) &TK[10])); + + PPK[0] += RotR1(PPK[5] ^ Mk16_le((__le16 *) &TK[12])); + PPK[1] += RotR1(PPK[0] ^ Mk16_le((__le16 *) &TK[14])); PPK[2] += RotR1(PPK[1]); PPK[3] += RotR1(PPK[2]); PPK[4] += RotR1(PPK[3]); @@ -285,7 +285,7 @@ static void tkip_mixing_phase2(u8 *WEPSeed, const u8 *TK, const u16 *TTAK, WEPSeed[0] = Hi8(IV16); WEPSeed[1] = (Hi8(IV16) | 0x20) & 0x7F; WEPSeed[2] = Lo8(IV16); - WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((u16 *) &TK[0])) >> 1); + WEPSeed[3] = Lo8((PPK[5] ^ Mk16_le((__le16 *) &TK[0])) >> 1); #ifdef __BIG_ENDIAN { -- 1.7.9.5 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel