Re: [PATCH v2] staging: ccree: Strip trailing whitespace
On Wed, May 3, 2017 at 11:03 PM, Timothée Isnard wrote: > Fix the 994 trailing whitespace checkpatch errors out of 1571 > checkpatch issues in the ccree driver > > Signed-off-by: Timothée Isnard > --- > v2: Adds some changelog text > Patch reviewed, applies and compiles, so Acked-by: Gilad Ben-Yossef Thank you Timothée for your contribution :-) Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
I don't think the v2 patch made it to the list either. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v1] vmbus: Reuse uuid_le_to_bin() helper
On Wed, May 03, 2017 at 08:19:22PM +0300, Andy Shevchenko wrote: > On Wed, 2017-05-03 at 20:07 +0300, Andy Shevchenko wrote: > > Instead of open coded variant use generic helper to convert UUID > > strings > > to binary format. > > > @@ -677,12 +644,14 @@ static ssize_t remove_id_store(struct > > device_driver *driver, const char *buf, > > { > > struct hv_driver *drv = drv_to_hv_drv(driver); > > struct vmbus_dynid *dynid, *n; > > > > > - size_t retval = -ENODEV; > > > > + ssize_t retval; > > Just noticed, I'm fixing a bug here as well. It doesn't affect runtime. You can store negatives in unsigned types so long as they're uint or larger. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
On Thu, May 4, 2017 at 10:57 AM, Dan Carpenter wrote: > I don't think the v2 patch made it to the list either. > I see. Well, I'm working on a bigger ccree cruft reducing patch set anyway. I'll just carry it as part of the set with my SOB and send it together than. Timothée, you need to figure out what's broken in your email setup. Thanks, Gilad -- Gilad Ben-Yossef Chief Coffee Drinker "If you take a class in large-scale robotics, can you end up in a situation where the homework eats your dog?" -- Jean-Baptiste Queru ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
On Thu, May 04, 2017 at 11:08:07AM +0300, Gilad Ben-Yossef wrote: > On Thu, May 4, 2017 at 10:57 AM, Dan Carpenter > wrote: > > I don't think the v2 patch made it to the list either. > > > > I see. Well, I'm working on a bigger ccree cruft reducing patch set > anyway. I'll just carry it as part of the set with my SOB and send it > together than. > > Timothée, you need to figure out what's broken in your email setup. I see it in the mailman archive at [0], and Google seems to say that my headers look good now. Am I missing something? [0] http://driverdev.linuxdriverproject.org/pipermail/driverdev-devel/2017-May/105433.html > > Thanks, > Gilad > > -- > Gilad Ben-Yossef > Chief Coffee Drinker > > "If you take a class in large-scale robotics, can you end up in a > situation where the homework eats your dog?" > -- Jean-Baptiste Queru ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
That's very strange. It's not in my spam folder either. Sometimes driver-devel emails get delayed so maybe it will still arrive. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c
fix error: Macros with multiple statements should be enclosed in a do - while loop Detected by scripts/checkpatch.pl -f >From b1bcd6f9d31f5ea899799f0f9b4cf04a0558d2d8 Mon Sep 17 00:00:00 2001 From: Jamie Huang Date: Thu, 4 May 2017 14:49:26 +0800 Subject: [PATCH] staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c ERROR: Macros with multiple statements should be enclosed in a do - while loop Detected by scripts/checkpatch.pl -f Signed-off-by: Jamie Huang --- drivers/staging/rtl8723bs/core/rtw_security.c | 46 +-- 1 file changed, 30 insertions(+), 16 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index e832f16..8f90a0d 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -38,52 +38,64 @@ const char *security_type_str(u8 value) #ifdef DBG_SW_SEC_CNT #define WEP_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->wep_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->wep_sw_enc_cnt_mc++; \ - else \ - sec->wep_sw_enc_cnt_uc++; + else \ + sec->wep_sw_enc_cnt_uc++; \ +} while (0) #define WEP_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->wep_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->wep_sw_dec_cnt_mc++; \ - else \ - sec->wep_sw_dec_cnt_uc++; + else \ + sec->wep_sw_dec_cnt_uc++;\ +} while (0) #define TKIP_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->tkip_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->tkip_sw_enc_cnt_mc++; \ - else \ - sec->tkip_sw_enc_cnt_uc++; + else \ + sec->tkip_sw_enc_cnt_uc++;\ +} while (0) #define TKIP_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->tkip_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->tkip_sw_dec_cnt_mc++; \ - else \ - sec->tkip_sw_dec_cnt_uc++; + else \ + sec->tkip_sw_dec_cnt_uc++;\ +} while (0) #define AES_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->aes_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->aes_sw_enc_cnt_mc++; \ - else \ - sec->aes_sw_enc_cnt_uc++; + else \ + sec->aes_sw_enc_cnt_uc++;\ +} while (0) #define AES_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->aes_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->aes_sw_dec_cnt_mc++; \ - else \ - sec->aes_sw_dec_cnt_uc++; + else \ + sec->aes_sw_dec_cnt_uc++;\ +} while (0) #else #define WEP_SW_ENC_CNT_INC(sec, ra) #define WEP_SW_DEC_CNT_INC(sec, ra) @@ -2236,10 +2248,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 pt[16], u8 ct[16]) s3 = GETU32(pt + 12) ^ rk[3]; #define ROUND(i, d, s) \ -d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ -d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ -d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ -d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] +do { \ + d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ + d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ + d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ + d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] \ +} while (0) /* Nr - 1 full rounds: */ r = Nr >> 1; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c
Read the first couple paragraphs of Documentation/process/email-clients.rst for how to send patches. > @@ -2236,10 +2248,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 > pt[16], u8 ct[16]) > s3 = GETU32(pt + 12) ^ rk[3]; > > #define ROUND(i, d, s) \ > -d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ > -d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ > -d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ > -d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] > +do { \ > + d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ > + d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ > + d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ > + d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] \ > +} while (0) Does this compile? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vc04_services: Fix bulk cache maintenance
vchiq_arm supports transfers less than one page and at arbitrary alignment, using the dma-mapping API to perform its cache maintenance (even though the VPU drives the DMA hardware). Read (DMA_FROM_DEVICE) operations use cache invalidation for speed, falling back to clean+invalidate on partial cache lines, with writes (DMA_TO_DEVICE) using flushes. If a read transfer has ends which aren't page-aligned, performing cache maintenance as if they were whole pages can lead to memory corruption since the partial cache lines at the ends (and any cache lines before or after the transfer area) will be invalidated. This bug was masked until the disabling of the cache flush in flush_dcache_page(). Honouring the requested transfer start- and end-points prevents the corruption. Fixes: cf9caf192988 ("staging: vc04_services: Replace dmac_map_area with dmac_map_sg") Signed-off-by: Phil Elwell --- .../interface/vchiq_arm/vchiq_2835_arm.c | 31 +- 1 file changed, 19 insertions(+), 12 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c index 3aeffcb..02e9736 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_2835_arm.c @@ -501,8 +501,15 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) */ sg_init_table(scatterlist, num_pages); /* Now set the pages for each scatterlist */ - for (i = 0; i < num_pages; i++) - sg_set_page(scatterlist + i, pages[i], PAGE_SIZE, 0); + for (i = 0; i < num_pages; i++) { + unsigned int len = PAGE_SIZE - offset; + + if (len > count) + len = count; + sg_set_page(scatterlist + i, pages[i], len, offset); + offset = 0; + count -= len; + } dma_buffers = dma_map_sg(g_dev, scatterlist, @@ -523,20 +530,20 @@ int vchiq_platform_init(struct platform_device *pdev, VCHIQ_STATE_T *state) u32 addr = sg_dma_address(sg); /* Note: addrs is the address + page_count - 1 -* The firmware expects the block to be page +* The firmware expects blocks after the first to be page- * aligned and a multiple of the page size */ WARN_ON(len == 0); - WARN_ON(len & ~PAGE_MASK); - WARN_ON(addr & ~PAGE_MASK); + WARN_ON(i && (i != (dma_buffers - 1)) && (len & ~PAGE_MASK)); + WARN_ON(i && (addr & ~PAGE_MASK)); if (k > 0 && - ((addrs[k - 1] & PAGE_MASK) | - ((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT) - == addr) { - addrs[k - 1] += (len >> PAGE_SHIFT); - } else { - addrs[k++] = addr | ((len >> PAGE_SHIFT) - 1); - } + ((addrs[k - 1] & PAGE_MASK) + +(((addrs[k - 1] & ~PAGE_MASK) + 1) << PAGE_SHIFT)) + == (addr & PAGE_MASK)) + addrs[k - 1] += ((len + PAGE_SIZE - 1) >> PAGE_SHIFT); + else + addrs[k++] = (addr & PAGE_MASK) | + (((len + PAGE_SIZE - 1) >> PAGE_SHIFT) - 1); } /* Partial cache lines (fragments) require special measures */ -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 4/7] staging: rtl8723bs: Move braces to same line as conditional
On Mon, 2017-05-01 at 18:52 -0600, Justin Vreeland wrote: > Ensure checkpatch compliance > > > Signed-off-by: Justin Vreeland > --- > v2: > - Added commit message > - Fixed overly long lines > > drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c | 18 -- > drivers/staging/rtl8723bs/hal/rtl8723b_rf6052.c | 12 ++-- > drivers/staging/rtl8723bs/hal/rtl8723bs_xmit.c | 9 - > 3 files changed, 18 insertions(+), 21 deletions(-) > > diff --git a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > index 28d1a229c3a6..21ec890fd60c 100644 > --- a/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > +++ b/drivers/staging/rtl8723bs/hal/rtl8723b_phycfg.c > @@ -385,8 +385,7 @@ s32 PHY_MACConfig8723B(struct adapter *Adapter) > > /* Config MAC */ > > /* */ > > rtStatus = phy_ConfigMACWithParaFile(Adapter, pszMACRegFile); > > - if (rtStatus == _FAIL) > > - { > > + if (rtStatus == _FAIL) { > > ODM_ConfigMACWithHeaderFile(&pHalData->odmpriv); > > rtStatus = _SUCCESS; > > } > @@ -459,8 +458,7 @@ static int phy_BB8723b_Config_ParaFile(struct adapter > *Adapter) > > Adapter->registrypriv.RegEnableTxPowerLimit == 1 || > > (Adapter->registrypriv.RegEnableTxPowerLimit == 2 && > > pHalData->EEPROMRegulatory == 1) > > ) { > > - if (PHY_ConfigRFWithPowerLimitTableParaFile(Adapter, > > pszRFTxPwrLmtFile) == _FAIL) > > - { > > + if (PHY_ConfigRFWithPowerLimitTableParaFile(Adapter, > > pszRFTxPwrLmtFile) == _FAIL) { > > if (HAL_STATUS_SUCCESS != > > ODM_ConfigRFWithHeaderFile(&pHalData->odmpriv, CONFIG_RF_TXPWR_LMT, > > (ODM_RF_RADIO_PATH_E)0)) > > rtStatus = _FAIL; > > } > @@ -474,8 +472,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter > *Adapter) > > /* */ > > /* 1. Read PHY_REG.TXT BB INIT!! */ > > /* */ > > - if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) > > == _FAIL) > > - { > > + if (phy_ConfigBBWithParaFile(Adapter, pszBBRegFile, CONFIG_BB_PHY_REG) > > == > + _FAIL) { This and... > if (HAL_STATUS_SUCCESS != > ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG)) > > rtStatus = _FAIL; > > } > @@ -491,8 +489,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter > *Adapter) > > Adapter->registrypriv.RegEnableTxPowerByRate == 1 || > > (Adapter->registrypriv.RegEnableTxPowerByRate == 2 && > > pHalData->EEPROMRegulatory != 2) > > ) { > > - if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == > > _FAIL) > > - { > > + if (phy_ConfigBBWithPgParaFile(Adapter, pszBBRegPgFile) == > > + _FAIL) { > > if (HAL_STATUS_SUCCESS != > > ODM_ConfigBBWithHeaderFile(&pHalData->odmpriv, CONFIG_BB_PHY_REG_PG)) > > rtStatus = _FAIL; > > } > @@ -514,8 +512,8 @@ static int phy_BB8723b_Config_ParaFile(struct adapter > *Adapter) > > /* */ > > /* 2. Read BB AGC table Initialization */ > > /* */ > > - if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, > > CONFIG_BB_AGC_TAB) == _FAIL) > > - { > > + if (phy_ConfigBBWithParaFile(Adapter, pszAGCTableFile, > + CONFIG_BB_AGC_TAB) == _FAIL) { ...this and the other such changes below are just way ugly, whatever the coding style says. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 0/7] staging: rtl8732: Various checkpatch fixes
On Mon, 2017-05-01 at 18:52 -0600, Justin Vreeland wrote: > v2: > Added commit messages > Fixed overly long lines > Added Bastien Nocera's Reviewed-by tag > - Also fixed commit messages marked reviewed, hope that's OK. The > patch > contents are identical. > > Justin Vreeland (7): > staging: rtl8723bs: Fix initialization of static variables > staging: rtl8723bs: Wrap multi-line macros in do-while loop You can add: Reviewed-by: Bastien Nocera for those 2. Cheers ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 3/7] staging: rtl8723bs: Macros with complex values should be enclosed in parentheses
On Mon, 2017-05-01 at 18:52 -0600, Justin Vreeland wrote: > Enclosing macros with complex values ensures expression is evaluated > as > expected. > > Signed-off-by: Justin Vreeland > --- > v2: > - Added spaces around plus signs > - Fixed line over 80 columns > - Added commit message > > drivers/staging/rtl8723bs/hal/odm.h | 5 - > 1 file changed, 4 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/rtl8723bs/hal/odm.h > b/drivers/staging/rtl8723bs/hal/odm.h > index 0b3541a91548..87a76bafecb3 100644 > --- a/drivers/staging/rtl8723bs/hal/odm.h > +++ b/drivers/staging/rtl8723bs/hal/odm.h > @@ -209,7 +209,10 @@ typedef struct _ODM_RATE_ADAPTIVE { > > #define AVG_THERMAL_NUM 8 > #define IQK_Matrix_REG_NUM 8 > -#define IQK_Matrix_Settings_NUM 14+24+21 > /* Channels_2_4G_NUM + Channels_5G_20M_NUM + Channels_5G */ > +#define IQK_Matrix_Settings_NUM (14 + 24 + 21) > /* Channels_2_4G_NUM > + * + > Channels_5G_20M_NUM > + * + Channels_5G > + */ This does line up when applied, right? If so: Reviewed-by: Bastien Nocera ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
It was delayed then eventually deleted by gmail. Maybe it was too large and suspicious looking... The problem was on my end anyway. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2] staging: ccree: Strip trailing whitespace
On Thu, May 04, 2017 at 03:41:12PM +0300, Dan Carpenter wrote: > It was delayed then eventually deleted by gmail. Maybe it was too large > and suspicious looking... The problem was on my end anyway. That's good to know, thanks for the update! > regards, > dan carpenter Cheers, Timothée Isnard ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] ion: hisilicon: check the right value after ion_heap_create
From: Yisheng Xie It should check ipdev->heaps[i] whether it is error or null instead of ipdev->heaps, after ion_heap_create() for ipdev->heaps[i]. Signed-off-by: Yisheng Xie --- drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c b/drivers/staging/android/ion/hisilicon/hi6220_ion.c index 0de7897..7f8eda5 100644 --- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c @@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev) for (i = 0; i < ipdev->data->nr; i++) { ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]); - if (!ipdev->heaps) { + if (IS_ERR_OR_NULL(ipdev->heaps[i])) { ion_destroy_platform_data(ipdev->data); return -ENOMEM; } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c
On Thu, 4 May 2017 11:57:48 +0300 Dan Carpenter wrote: > Read the first couple paragraphs of > Documentation/process/email-clients.rst for how to send patches. > > > @@ -2236,10 +2248,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], > > u8 pt[16], u8 ct[16]) s3 = GETU32(pt + 12) ^ rk[3]; > > > > #define ROUND(i, d, s) \ > > -d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ > > -d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + > > 1]; \ -d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 > > * i + 2]; \ -d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ > > rk[4 * i + 3] +do { \ > > + d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ > > rk[4 * i]; \ > > + d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ > > rk[4 * i + 1]; \ > > + d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ > > rk[4 * i + 2]; \ > > + d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ > > rk[4 * i + 3] \ +} while (0) > > Does this compile? > > regards, > dan carpenter > Thank you for your replay, I'll do some change. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] hv_utils: drop .getcrosststamp() support from PTP driver
Turns out that our implementation of .getcrosststamp() never actually worked. Hyper-V is sending time samples every 5 seconds and this is too much for get_device_system_crosststamp() as it's interpolation algorithm (which nobody is currently using in kernel, btw) accounts for a 'slow' device but we're not slow in Hyper-V, our time reference is too far away. .getcrosststamp() is not currently used, get_device_system_crosststamp() almost always returns -EINVAL and client falls back to using PTP_SYS_OFFSET so this patch doesn't change much. I also tried doing interpolation manually (e.g. the same way hv_ptp_gettime() works and it turns out that we're getting even lower quality: PTP_SYS_OFFSET_PRECISE with manual interpolation: * PHC0 0 337 4 -3974ns[-5338ns] +/- 977ns * PHC0 0 377 7 +2227ns[+3184ns] +/- 576ns * PHC0 0 3 17710 +3060ns[+5220ns] +/- 548ns * PHC0 0 3 37712 +3937ns[+4371ns] +/- 1414ns * PHC0 0 3 377 6 +764ns[+1240ns] +/- 1047ns * PHC0 0 3 377 7 -1210ns[-3731ns] +/- 479ns * PHC0 0 3 377 9 +153ns[-1019ns] +/- 406ns * PHC0 0 3 37712 -872ns[-1793ns] +/- 443ns * PHC0 0 3 377 5 +701ns[+3599ns] +/- 426ns * PHC0 0 3 377 5 -923ns[ -375ns] +/- 1062ns PTP_SYS_OFFSET: * PHC0 0 3 7 5+72ns[+8020ns] +/- 251ns * PHC0 0 317 5 -885ns[-3661ns] +/- 254ns * PHC0 0 337 6 -454ns[-5732ns] +/- 258ns * PHC0 0 37710 +1183ns[+3754ns] +/- 164ns * PHC0 0 3 377 5 +579ns[+1137ns] +/- 110ns * PHC0 0 3 377 7 +501ns[+1064ns] +/- 96ns * PHC0 0 3 377 9 +1641ns[+3342ns] +/- 106ns * PHC0 0 3 377 8-47ns[ +77ns] +/- 160ns * PHC0 0 3 377 5+54ns[ +107ns] +/- 102ns * PHC0 0 3 377 8 -354ns[ -617ns] +/- 89ns This fact wasn't noticed during the initial testing of the PTP device somehow but got revealed now. Let's just drop .getcrosststamp() implementation for now as it doesn't seem to be suitable for us. Signed-off-by: Vitaly Kuznetsov --- drivers/hv/hv_util.c | 36 1 file changed, 36 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 186b100..2849143 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -248,7 +248,6 @@ static struct adj_time_work wrk; static struct { u64 host_time; u64 ref_time; - struct system_time_snapshot snap; spinlock_t lock; } host_ts; @@ -281,7 +280,6 @@ static inline void adj_guesttime(u64 hosttime, u64 reftime, u8 adj_flags) cur_reftime = hyperv_cs->read(hyperv_cs); host_ts.host_time = hosttime; host_ts.ref_time = cur_reftime; - ktime_get_snapshot(&host_ts.snap); /* * TimeSync v4 messages contain reference time (guest's Hyper-V @@ -538,46 +536,12 @@ static int hv_ptp_gettime(struct ptp_clock_info *info, struct timespec64 *ts) return 0; } -static int hv_ptp_get_syncdevicetime(ktime_t *device, -struct system_counterval_t *system, -void *ctx) -{ - system->cs = hyperv_cs; - system->cycles = host_ts.ref_time; - *device = ns_to_ktime((host_ts.host_time - WLTIMEDELTA) * 100); - - return 0; -} - -static int hv_ptp_getcrosststamp(struct ptp_clock_info *ptp, -struct system_device_crosststamp *xtstamp) -{ - unsigned long flags; - int ret; - - spin_lock_irqsave(&host_ts.lock, flags); - - /* -* host_ts contains the last time sample from the host and the snapshot -* of system time. We don't need to calculate the time delta between -* the reception and now as get_device_system_crosststamp() does the -* required interpolation. -*/ - ret = get_device_system_crosststamp(hv_ptp_get_syncdevicetime, - NULL, &host_ts.snap, xtstamp); - - spin_unlock_irqrestore(&host_ts.lock, flags); - - return ret; -} - static struct ptp_clock_info ptp_hyperv_info = { .name = "hyperv", .enable = hv_ptp_enable, .adjtime= hv_ptp_adjtime, .adjfreq= hv_ptp_adjfreq, .gettime64 = hv_ptp_gettime, - .getcrosststamp = hv_ptp_getcrosststamp, .settime64 = hv_ptp_settime, .owner = THIS_M
[PATCH v2 0/2] hv_utils: TimeSync fixes
This series is a succesor of the previously sent "hv_utils: drop .getcrosststamp() support from PTP driver" patch. A new unrelated issue with TimeSync on pre-TimeSync-v4 hosts was discovered but as these patches are tangled I'm sending them out in a single series. Vitaly Kuznetsov (2): hv_utils: drop .getcrosststamp() support from PTP driver hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts drivers/hv/hv_util.c | 164 +-- 1 file changed, 54 insertions(+), 110 deletions(-) -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/2] hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts
It was found that ICTIMESYNCFLAG_SYNC packets are handled incorrectly on WS2012R2, e.g. after the guest is paused and resumed its time is set to something different from host's time. The problem is that we call adj_guesttime() with reftime=0 for these old hosts and we don't account for that in 'if (adj_flags & ICTIMESYNCFLAG_SYNC)' branch and hv_set_host_time(). While we could've solved this by adding a check like 'if (ts_srv_version > TS_VERSION_3)' to hv_set_host_time() I prefer to do some refactoring. We don't need to have two separate containers for host samples, struct host_ts which we use for PTP is enough. Throw away 'struct adj_time_work' and create hv_get_adj_host_time() accessor to host_ts to avoid code duplication. Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source") Signed-off-by: Vitaly Kuznetsov --- drivers/hv/hv_util.c | 128 ++- 1 file changed, 54 insertions(+), 74 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 2849143..14dce25 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -202,27 +202,39 @@ static void shutdown_onchannelcallback(void *context) /* * Set the host time in a process context. */ +static struct work_struct adj_time_work; -struct adj_time_work { - struct work_struct work; - u64 host_time; - u64 ref_time; - u8 flags; -}; +/* + * The last time sample, received from the host. PTP device responds to + * requests by using this data and the current partition-wide time reference + * count. + */ +static struct { + u64 host_time; + u64 ref_time; + spinlock_t lock; +} host_ts; -static void hv_set_host_time(struct work_struct *work) +static struct timespec64 hv_get_adj_host_time(void) { - struct adj_time_work *wrk; - struct timespec64 host_ts; - u64 reftime, newtime; - - wrk = container_of(work, struct adj_time_work, work); + struct timespec64 ts; + u64 newtime, reftime; + unsigned long flags; + spin_lock_irqsave(&host_ts.lock, flags); reftime = hyperv_cs->read(hyperv_cs); - newtime = wrk->host_time + (reftime - wrk->ref_time); - host_ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100); + newtime = host_ts.host_time + (reftime - host_ts.ref_time); + ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100); + spin_unlock_irqrestore(&host_ts.lock, flags); - do_settimeofday64(&host_ts); + return ts; +} + +static void hv_set_host_time(struct work_struct *work) +{ + struct timespec64 ts = hv_get_adj_host_time(); + + do_settimeofday64(&ts); } /* @@ -238,60 +250,35 @@ static void hv_set_host_time(struct work_struct *work) * typically used as a hint to the guest. The guest is under no obligation * to discipline the clock. */ -static struct adj_time_work wrk; - -/* - * The last time sample, received from the host. PTP device responds to - * requests by using this data and the current partition-wide time reference - * count. - */ -static struct { - u64 host_time; - u64 ref_time; - spinlock_t lock; -} host_ts; - static inline void adj_guesttime(u64 hosttime, u64 reftime, u8 adj_flags) { unsigned long flags; u64 cur_reftime; /* -* This check is safe since we are executing in the -* interrupt context and time synch messages are always -* delivered on the same CPU. +* Save the adjusted time sample from the host and the snapshot +* of the current system time. */ - if (adj_flags & ICTIMESYNCFLAG_SYNC) { - /* Queue a job to do do_settimeofday64() */ - if (work_pending(&wrk.work)) - return; - - wrk.host_time = hosttime; - wrk.ref_time = reftime; - wrk.flags = adj_flags; - schedule_work(&wrk.work); - } else { - /* -* Save the adjusted time sample from the host and the snapshot -* of the current system time for PTP device. -*/ - spin_lock_irqsave(&host_ts.lock, flags); - - cur_reftime = hyperv_cs->read(hyperv_cs); - host_ts.host_time = hosttime; - host_ts.ref_time = cur_reftime; - - /* -* TimeSync v4 messages contain reference time (guest's Hyper-V -* clocksource read when the time sample was generated), we can -* improve the precision by adding the delta between now and the -* time of generation. -*/ - if (ts_srv_version > TS_VERSION_3) - host_ts.host_time += (cur_reftime - reftime); - - spin_unlock_
[PATCH v2 2/2] hv_utils: fix TimeSync job on pre-TimeSync-v4 hosts
It was found that ICTIMESYNCFLAG_SYNC packets are handled incorrectly on WS2012R2, e.g. after the guest is paused and resumed its time is set to something different from host's time. The problem is that we call adj_guesttime() with reftime=0 for these old hosts and we don't account for that in 'if (adj_flags & ICTIMESYNCFLAG_SYNC)' branch and hv_set_host_time(). While we could've solved this by adding a check like 'if (ts_srv_version > TS_VERSION_3)' to hv_set_host_time() I prefer to do some refactoring. We don't need to have two separate containers for host samples, struct host_ts which we use for PTP is enough. Throw away 'struct adj_time_work' and create hv_get_adj_host_time() accessor to host_ts to avoid code duplication. Fixes: 3716a49a81ba ("hv_utils: implement Hyper-V PTP source") Signed-off-by: Vitaly Kuznetsov --- drivers/hv/hv_util.c | 128 ++- 1 file changed, 54 insertions(+), 74 deletions(-) diff --git a/drivers/hv/hv_util.c b/drivers/hv/hv_util.c index 2849143..14dce25 100644 --- a/drivers/hv/hv_util.c +++ b/drivers/hv/hv_util.c @@ -202,27 +202,39 @@ static void shutdown_onchannelcallback(void *context) /* * Set the host time in a process context. */ +static struct work_struct adj_time_work; -struct adj_time_work { - struct work_struct work; - u64 host_time; - u64 ref_time; - u8 flags; -}; +/* + * The last time sample, received from the host. PTP device responds to + * requests by using this data and the current partition-wide time reference + * count. + */ +static struct { + u64 host_time; + u64 ref_time; + spinlock_t lock; +} host_ts; -static void hv_set_host_time(struct work_struct *work) +static struct timespec64 hv_get_adj_host_time(void) { - struct adj_time_work *wrk; - struct timespec64 host_ts; - u64 reftime, newtime; - - wrk = container_of(work, struct adj_time_work, work); + struct timespec64 ts; + u64 newtime, reftime; + unsigned long flags; + spin_lock_irqsave(&host_ts.lock, flags); reftime = hyperv_cs->read(hyperv_cs); - newtime = wrk->host_time + (reftime - wrk->ref_time); - host_ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100); + newtime = host_ts.host_time + (reftime - host_ts.ref_time); + ts = ns_to_timespec64((newtime - WLTIMEDELTA) * 100); + spin_unlock_irqrestore(&host_ts.lock, flags); - do_settimeofday64(&host_ts); + return ts; +} + +static void hv_set_host_time(struct work_struct *work) +{ + struct timespec64 ts = hv_get_adj_host_time(); + + do_settimeofday64(&ts); } /* @@ -238,60 +250,35 @@ static void hv_set_host_time(struct work_struct *work) * typically used as a hint to the guest. The guest is under no obligation * to discipline the clock. */ -static struct adj_time_work wrk; - -/* - * The last time sample, received from the host. PTP device responds to - * requests by using this data and the current partition-wide time reference - * count. - */ -static struct { - u64 host_time; - u64 ref_time; - spinlock_t lock; -} host_ts; - static inline void adj_guesttime(u64 hosttime, u64 reftime, u8 adj_flags) { unsigned long flags; u64 cur_reftime; /* -* This check is safe since we are executing in the -* interrupt context and time synch messages are always -* delivered on the same CPU. +* Save the adjusted time sample from the host and the snapshot +* of the current system time. */ - if (adj_flags & ICTIMESYNCFLAG_SYNC) { - /* Queue a job to do do_settimeofday64() */ - if (work_pending(&wrk.work)) - return; - - wrk.host_time = hosttime; - wrk.ref_time = reftime; - wrk.flags = adj_flags; - schedule_work(&wrk.work); - } else { - /* -* Save the adjusted time sample from the host and the snapshot -* of the current system time for PTP device. -*/ - spin_lock_irqsave(&host_ts.lock, flags); - - cur_reftime = hyperv_cs->read(hyperv_cs); - host_ts.host_time = hosttime; - host_ts.ref_time = cur_reftime; - - /* -* TimeSync v4 messages contain reference time (guest's Hyper-V -* clocksource read when the time sample was generated), we can -* improve the precision by adding the delta between now and the -* time of generation. -*/ - if (ts_srv_version > TS_VERSION_3) - host_ts.host_time += (cur_reftime - reftime); - - spin_unlock
Re: [PATCH v2 2/2] hv_utils: fix TimeSync job on pre-TimeSync-v4 hosts
I'm sorry I screwed up, this patch got sent twice in the series as I slightly changed the subject and forgot to remove the old version :-( Please disregard this one from series, "hv_utils: fix TimeSync work on pre-TimeSync-v4 hosts" is the right one. Thanks. -- Vitaly ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] vt6656: Coding style fixes
Fixed coding style warnings reported by checkpatch.pl. Signed-off-by: Simo Koskinen --- drivers/staging/vt6656/rxtx.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/staging/vt6656/rxtx.c b/drivers/staging/vt6656/rxtx.c index 6341349..2609c1e 100644 --- a/drivers/staging/vt6656/rxtx.c +++ b/drivers/staging/vt6656/rxtx.c @@ -123,10 +123,12 @@ static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, 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; @@ -142,7 +144,8 @@ static __le16 vnt_rxtx_rsvtime_le16(struct vnt_private *priv, u8 pkt_type, } 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; @@ -227,7 +230,8 @@ static __le16 vnt_get_rtscts_duration_le(struct vnt_usb_send_context *context, case RTSDUR_AA_F0: case RTSDUR_AA_F1: cts_time = vnt_get_frame_time(priv->preamble_type, - pkt_type, 14, priv->top_ofdm_basic_rate); + pkt_type, 14, + priv->top_ofdm_basic_rate); dur_time = cts_time + 2 * priv->sifs + vnt_get_rsvtime(priv, pkt_type, frame_length, rate, need_ack); @@ -684,7 +688,8 @@ static u16 vnt_rxtx_ab(struct vnt_usb_send_context *tx_context, static u16 vnt_generate_tx_parameter(struct vnt_usb_send_context *tx_context, struct vnt_tx_buffer *tx_buffer, - struct vnt_mic_hdr **mic_hdr, u32 need_mic, + struct vnt_mic_hdr **mic_hdr, + u32 need_mic, bool need_rts) { -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: Comedi driver for submission - contec_fit.c
On Thu, May 04, 2017 at 08:33:42AM -0500, Dan Naughton wrote: > First posting - hello all. > > I wanted to submit a driver for the linuxdriverproject. The driver is > contec_fit.c. It's a comedi data acquisition driver. I don't know if this > mailing list can take attachments, so maybe the following link to github on > comedi.org would work. We don't submit patches as attachments, take a look at Documentation/SubmittingPatches for how to send a patch we can review and hopefully apply. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] vt6656: Coding style fixes
On Thu, 2017-05-04 at 17:33 +0200, Simo Koskinen wrote: > Fixed coding style warnings reported by checkpatch.pl. Please strive to do more than shut up checkpatch. Think a little about what this code is doing. Spend the time to analyze the code and improve it. For instance, this function is currently: static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, 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); if (pkt_type == PK_TYPE_11B) ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 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); if (need_ack) return data_time + priv->sifs + ack_time; return data_time; } It is computing how long it takes to do something. It also is doing the ack_time calculation unnecessarily when need_ack is not set. Better code might be something like: static u32 vnt_get_rsvtime(struct vnt_private *priv, u8 pkt_type, 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); if (!need_ack) return data_time; if (pkt_type == PK_TYPE_11B) rate = priv->top_cck_basic_rate; else rate = priv->top_ofdm_basic_rate; ack_time = vnt_get_frame_time(priv->preamble_type, pkt_type, 14, rate); return data_time + priv->sifs + ack_time; } where the return of data_time is done when !need_ack and rate is calculated and a single vnt_get_frame_time call is used for ack_time only when necessary. It's slightly smaller object code and faster to execute when need_ack is not set. Ideally the hard-coded 14 value in the ack_time calculation should be a #define or a sizeof. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: lustre: lprocfs: Use seq_puts
Replace all occurrences of seq_printf with no formatting directives in lprocfs_status.c with seq_puts. Reported by checkpatch.pl: "WARNING: Prefer seq_puts to seq_printf". Signed-off-by: Mathias Rav --- .../staging/lustre/lustre/obdclass/lprocfs_status.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 338ce34d6514..b5e0e46777ea 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -716,7 +716,7 @@ static int obd_import_flags2str(struct obd_import *imp, struct seq_file *m) bool first = true; if (imp->imp_obd->obd_no_recov) { - seq_printf(m, "no_recov"); + seq_puts(m, "no_recov"); first = false; } @@ -782,15 +782,15 @@ int lprocfs_rd_import(struct seq_file *m, void *data) imp->imp_connect_data.ocd_instance); obd_connect_seq_flags2str(m, imp->imp_connect_data.ocd_connect_flags, ", "); - seq_printf(m, " ]\n"); + seq_puts(m, " ]\n"); obd_connect_data_seqprint(m, ocd); - seq_printf(m, "import_flags: [ "); + seq_puts(m, "import_flags: [ "); obd_import_flags2str(imp, m); - seq_printf(m, - " ]\n" - "connection:\n" - " failover_nids: [ "); + seq_puts(m, +" ]\n" +"connection:\n" +" failover_nids: [ "); spin_lock(&imp->imp_lock); j = 0; list_for_each_entry(conn, &imp->imp_conn_list, oic_item) { @@ -923,7 +923,7 @@ int lprocfs_rd_state(struct seq_file *m, void *data) seq_printf(m, "current_state: %s\n", ptlrpc_import_state_name(imp->imp_state)); - seq_printf(m, "state_history:\n"); + seq_puts(m, "state_history:\n"); k = imp->imp_state_hist_idx; for (j = 0; j < IMP_STATE_HIST_LEN; j++) { struct import_state_hist *ish = @@ -945,7 +945,7 @@ int lprocfs_at_hist_helper(struct seq_file *m, struct adaptive_timeout *at) for (i = 0; i < AT_BINS; i++) seq_printf(m, "%3u ", at->at_hist[i]); - seq_printf(m, "\n"); + seq_puts(m, "\n"); return 0; } EXPORT_SYMBOL(lprocfs_at_hist_helper); @@ -1013,7 +1013,7 @@ int lprocfs_rd_connect_flags(struct seq_file *m, void *data) flags = obd->u.cli.cl_import->imp_connect_data.ocd_connect_flags; seq_printf(m, "flags=%#llx\n", flags); obd_connect_seq_flags2str(m, flags, "\n"); - seq_printf(m, "\n"); + seq_puts(m, "\n"); up_read(&obd->u.cli.cl_sem); return 0; } -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: lustre: lprocfs: Use kstrtouint_from_user
Prefer kstrtouint_from_user to copy_from_user+simple_strtoul. The helper function lprocfs_wr_uint() is only used to implement "dump_granted_max" in debugfs. Note the slight change in semantics: The previous implementation using simple_strtoul allows garbage after the number, whereas kstrtox only allows a trailing line break. The previous implementation allowed a write of zero bytes whereas kstrtox will return -EINVAL. Since this only affects a single debugfs endpoint, this should be a permissible slight change of semantics in exchange for 18 fewer lines of code. Signed-off-by: Mathias Rav --- .../lustre/lustre/obdclass/lprocfs_status.c| 22 +- 1 file changed, 1 insertion(+), 21 deletions(-) diff --git a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c index 1ec6e3767d81..338ce34d6514 100644 --- a/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c +++ b/drivers/staging/lustre/lustre/obdclass/lprocfs_status.c @@ -399,27 +399,7 @@ EXPORT_SYMBOL(lprocfs_rd_uint); int lprocfs_wr_uint(struct file *file, const char __user *buffer, unsigned long count, void *data) { - unsigned *p = data; - char dummy[MAX_STRING_SIZE + 1], *end; - unsigned long tmp; - - if (count >= sizeof(dummy)) - return -EINVAL; - - if (count == 0) - return 0; - - if (copy_from_user(dummy, buffer, count)) - return -EFAULT; - - dummy[count] = '\0'; - - tmp = simple_strtoul(dummy, &end, 0); - if (dummy == end) - return -EINVAL; - - *p = (unsigned int)tmp; - return count; + return kstrtouint_from_user(buffer, count, 0, (unsigned int *)data); } EXPORT_SYMBOL(lprocfs_wr_uint); -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/2] staging: lustre: lprocfs: Fix coding style issues
This patchset fixes two style issues in lprocfs_status.c related to simple_strtoul and seq_printf (reported by checkpatch). There's a slight change in lustre debugfs write semantics: Using kstrtox causes EINVAL when the written number is followed by other (garbage) characters, whereas previously the garbage would be ignored and such a write would succeed. Mathias Rav (2): staging: lustre: lprocfs: Use kstrtouint_from_user staging: lustre: lprocfs: Use seq_puts .../lustre/lustre/obdclass/lprocfs_status.c| 42 ++--- 1 file changed, 11 insertions(+), 31 deletions(-) ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] ion: hisilicon: check the right value after ion_heap_create
On 05/04/2017 07:45 AM, Yisheng Xie wrote: > From: Yisheng Xie > > It should check ipdev->heaps[i] whether it is error or null instead of > ipdev->heaps, after ion_heap_create() for ipdev->heaps[i]. > > Signed-off-by: Yisheng Xie > --- > drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c > b/drivers/staging/android/ion/hisilicon/hi6220_ion.c > index 0de7897..7f8eda5 100644 > --- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c > +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c > @@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev) > > for (i = 0; i < ipdev->data->nr; i++) { > ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]); > - if (!ipdev->heaps) { > + if (IS_ERR_OR_NULL(ipdev->heaps[i])) { > ion_destroy_platform_data(ipdev->data); > return -ENOMEM; > } > This file was removed in a recent clean up series. Thanks, Laura ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: vc04_services: Fix bulk cache maintenance
> Phil Elwell hat am 4. Mai 2017 um 11:58 geschrieben: > > > vchiq_arm supports transfers less than one page and at arbitrary > alignment, using the dma-mapping API to perform its cache maintenance > (even though the VPU drives the DMA hardware). Read (DMA_FROM_DEVICE) > operations use cache invalidation for speed, falling back to > clean+invalidate on partial cache lines, with writes (DMA_TO_DEVICE) > using flushes. > > If a read transfer has ends which aren't page-aligned, performing cache > maintenance as if they were whole pages can lead to memory corruption > since the partial cache lines at the ends (and any cache lines before or > after the transfer area) will be invalidated. This bug was masked until > the disabling of the cache flush in flush_dcache_page(). > > Honouring the requested transfer start- and end-points prevents the > corruption. > > Fixes: cf9caf192988 ("staging: vc04_services: Replace dmac_map_area with > dmac_map_sg") > Signed-off-by: Phil Elwell Reported-by: Stefan Wahren Tested-by: Stefan Wahren In order to clarify the context of this issue: http://lists.infradead.org/pipermail/linux-rpi-kernel/2017-April/006149.html ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] staging: typec: fusb302: Fix module autoload
On Thu, May 04, 2017 at 08:33:45AM +0200, Javier Martinez Canillas wrote: > If the driver is built as a module, autoload won't work because the module > alias information is not filled. So user-space can't match the registered > device with the corresponding module. > > Export the OF and I2C device ID table entries as module aliases, using the > MODULE_DEVICE_TABLE() macro. > > Before this patch: > > $ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias > $ > > After this patch: > > $ modinfo drivers/staging/typec/fusb302/fusb302.ko | grep alias > alias: of:N*T*Cfcs,fusb302C* > alias: of:N*T*Cfcs,fusb302 > alias: i2c:typec_fusb302 > > Signed-off-by: Javier Martinez Canillas Thanks, queued. Guenter > --- > > drivers/staging/typec/fusb302/fusb302.c | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/drivers/staging/typec/fusb302/fusb302.c > b/drivers/staging/typec/fusb302/fusb302.c > index 2cee9a952c9b..aa460f93a293 100644 > --- a/drivers/staging/typec/fusb302/fusb302.c > +++ b/drivers/staging/typec/fusb302/fusb302.c > @@ -1787,11 +1787,13 @@ static const struct of_device_id fusb302_dt_match[] = > { > {.compatible = "fcs,fusb302"}, > {}, > }; > +MODULE_DEVICE_TABLE(of, fusb302_dt_match); > > static const struct i2c_device_id fusb302_i2c_device_id[] = { > {"typec_fusb302", 0}, > {}, > }; > +MODULE_DEVICE_TABLE(i2c, fusb302_i2c_device_id); > > static const struct dev_pm_ops fusb302_pm_ops = { > .suspend = fusb302_pm_suspend, > -- > 2.9.3 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c
ERROR: Macros with multiple statements should be enclosed in a do - while loop Detected by scripts/checkpatch.pl -f Signed-off-by: Jamie Huang --- drivers/staging/rtl8723bs/core/rtw_security.c | 34 +++ 1 file changed, 24 insertions(+), 10 deletions(-) diff --git a/drivers/staging/rtl8723bs/core/rtw_security.c b/drivers/staging/rtl8723bs/core/rtw_security.c index e832f16..c4558db 100644 --- a/drivers/staging/rtl8723bs/core/rtw_security.c +++ b/drivers/staging/rtl8723bs/core/rtw_security.c @@ -38,52 +38,64 @@ const char *security_type_str(u8 value) #ifdef DBG_SW_SEC_CNT #define WEP_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->wep_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->wep_sw_enc_cnt_mc++; \ else \ - sec->wep_sw_enc_cnt_uc++; + sec->wep_sw_enc_cnt_uc++; \ +} while (0) #define WEP_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->wep_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->wep_sw_dec_cnt_mc++; \ else \ - sec->wep_sw_dec_cnt_uc++; + sec->wep_sw_dec_cnt_uc++; \ +} while (0) #define TKIP_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->tkip_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->tkip_sw_enc_cnt_mc++; \ else \ - sec->tkip_sw_enc_cnt_uc++; + sec->tkip_sw_enc_cnt_uc++; \ +} while (0) #define TKIP_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->tkip_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->tkip_sw_dec_cnt_mc++; \ else \ - sec->tkip_sw_dec_cnt_uc++; + sec->tkip_sw_dec_cnt_uc++; \ +} while (0) #define AES_SW_ENC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->aes_sw_enc_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->aes_sw_enc_cnt_mc++; \ else \ - sec->aes_sw_enc_cnt_uc++; + sec->aes_sw_enc_cnt_uc++; \ +} while (0) #define AES_SW_DEC_CNT_INC(sec, ra) \ +do { \ if (is_broadcast_mac_addr(ra)) \ sec->aes_sw_dec_cnt_bc++; \ else if (is_multicast_mac_addr(ra)) \ sec->aes_sw_dec_cnt_mc++; \ else \ - sec->aes_sw_dec_cnt_uc++; + sec->aes_sw_dec_cnt_uc++; \ +} while (0) #else #define WEP_SW_ENC_CNT_INC(sec, ra) #define WEP_SW_DEC_CNT_INC(sec, ra) @@ -2236,10 +2248,12 @@ static void rijndaelEncrypt(u32 rk[/*44*/], u8 pt[16], u8 ct[16]) s3 = GETU32(pt + 12) ^ rk[3]; #define ROUND(i, d, s) \ -d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ -d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ -d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ -d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] +do { \ + d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * (i)]; \ + d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * (i) + 1]; \ + d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * (i) + 2]; \ + d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * (i) + 3]; \ +} while (0) /* Nr - 1 full rounds: */ r = Nr >> 1; -- 2.5.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v2 00/10] Hyper-V: praravirtualized remote TLB flushing and hypercall improvements
> -Original Message- > From: Vitaly Kuznetsov [mailto:vkuzn...@redhat.com] > Sent: Wednesday, April 12, 2017 3:43 AM > To: de...@linuxdriverproject.org; x...@kernel.org > Cc: linux-ker...@vger.kernel.org; KY Srinivasan ; > Haiyang Zhang ; Stephen Hemminger > ; Thomas Gleixner ; Ingo > Molnar ; H. Peter Anvin ; Steven > Rostedt ; Jork Loeser > ; Simon Xiao > Subject: [PATCH v2 00/10] Hyper-V: praravirtualized remote TLB flushing and > hypercall improvements > > Changes since v1: > - Add a patch to build code in arch/x86/hyperv/ only when CONFIG_HYPERV > is > set. > - Add a patch to get maximum virtual/logical processor on Hyper-V. > - Add additional clobbers to hypercalls [Jork Loeser] > - Add variable header size support to rep hypercalls. > - Rename vmbus_cpu_number_to_vp_number -> > hv_cpu_number_to_vp_number > [K. Y. Srinivasan] > - Remove spinlocks from hyperv_flush_tlb_others() [Jork Loeser] > - Account for mm==NULL in hyperv_flush_tlb_others() [Simon Xiao] > - Add support for HVCALL_FLUSH_VIRTUAL_ADDRESS_SPACE_EX/LIST_EX > hypercalls > to support >64 vCPUs [K. Y. Srinivasan, Jork Loeser] > - Move hyperv.h to arch-specific place [Steven Rostedt] > - Rebased to the latest char-misc-next tree. > > Original descriptions: > > Hyper-V supports hypercalls for doing local and remote TLB flushing and > gives its guests hints when using hypercall is preferred. While doing > hypercalls for local TLB flushes is probably not practical (and is not > being suggested by modern Hyper-V versions) remote TLB flush with a > hypercall brings significant improvement. > > To test the series I wrote a special 'TLB trasher': on a 16 vCPU guest I > was creating 32 threads which were doing 10 mmap/munmaps each on > some > big file. Here are the results: > > Before: > # time ./pthread_mmap ./randfile > real 3m44.994s > user 0m3.829s > sys 3m36.323s > > After: > # time ./pthread_mmap ./randfile > real 2m57.145s > user 0m3.797s > sys 2m34.812s > > This series brings a number of small improvements along the way: fast > hypercall implementation and using it for event signaling, rep hypercalls > implementation, hyperv tracing subsystem (which only traces the newly > added > remote TLB flush for now). > > Vitaly Kuznetsov (10): > x86/hyper-v: include hyperv/ only when CONFIG_HYPERV is set > x86/hyper-v: stash the max number of virtual/logical processor > x86/hyper-v: make hv_do_hypercall() inline > x86/hyper-v: fast hypercall implementation > hyper-v: use fast hypercall for HVCALL_SIGNAL_EVENT > x86/hyper-v: implement rep hypercalls > hyper-v: globalize vp_index > x86/hyper-v: use hypercall for remote TLB flush > x86/hyper-v: support extended CPU ranges for TLB flush hypercalls > tracing/hyper-v: trace hyperv_mmu_flush_tlb_others() Thanks Vitaly; we have tested these patches on various platforms of interest. Acked-by: K. Y. Srinivasan Tested-by: Simon Xiao Tested-by: Srikanth Myakam Regards, K. Y > > MAINTAINERS | 1 + > arch/x86/Kbuild | 4 +- > arch/x86/hyperv/Makefile| 2 +- > arch/x86/hyperv/hv_init.c | 90 ++-- > arch/x86/hyperv/mmu.c | 270 > > arch/x86/include/asm/mshyperv.h | 148 +++- > arch/x86/include/asm/trace/hyperv.h | 34 + > arch/x86/include/uapi/asm/hyperv.h | 36 + > arch/x86/kernel/cpu/mshyperv.c | 14 +- > drivers/hv/channel_mgmt.c | 22 ++- > drivers/hv/connection.c | 8 +- > drivers/hv/hv.c | 9 -- > drivers/hv/hyperv_vmbus.h | 11 -- > drivers/hv/vmbus_drv.c | 17 --- > drivers/pci/host/pci-hyperv.c | 4 +- > include/linux/hyperv.h | 21 ++- > 16 files changed, 567 insertions(+), 124 deletions(-) > create mode 100644 arch/x86/hyperv/mmu.c > create mode 100644 arch/x86/include/asm/trace/hyperv.h > > -- > 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8192u: ieee80211: ieee80211_module.c: fix style issue
Fixed a brace coding style issue, found via checkpatch. Signed-off-by: Riccardo Marotti --- drivers/staging/rtl8192u/ieee80211/ieee80211_module.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c index a791175b86f5..8f236b332a47 100644 --- a/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c +++ b/drivers/staging/rtl8192u/ieee80211/ieee80211_module.c @@ -157,8 +157,7 @@ struct net_device *alloc_ieee80211(int sizeof_priv) ieee80211_softmac_init(ieee); ieee->pHTInfo = kzalloc(sizeof(RT_HIGH_THROUGHPUT), GFP_KERNEL); - if (ieee->pHTInfo == NULL) - { + if (ieee->pHTInfo == NULL) { IEEE80211_DEBUG(IEEE80211_DL_ERR, "can't alloc memory for HTInfo\n"); goto failed; } -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] tsl2x7x_core: use octal permission representation
Fix the output from checkpatch.pl like: Symbolic permissions 'S_IRUSR' are not preferred. Consider using octal permissions '0400'. Also fix the alignment DEVICE_ATTR variables as should match open parenthesis. Signed-off-by: Enric Balletbo i Serra --- drivers/staging/iio/light/tsl2x7x_core.c | 42 +--- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index b35ff63f7f60..41b8f5332737 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -1494,35 +1494,37 @@ static int tsl2x7x_write_raw(struct iio_dev *indio_dev, return 0; } -static DEVICE_ATTR(power_state, S_IRUGO | S_IWUSR, - tsl2x7x_power_state_show, tsl2x7x_power_state_store); +static DEVICE_ATTR(power_state, 0644, tsl2x7x_power_state_show, + tsl2x7x_power_state_store); -static DEVICE_ATTR(in_proximity0_calibscale_available, S_IRUGO, - tsl2x7x_prox_gain_available_show, NULL); +static DEVICE_ATTR(in_proximity0_calibscale_available, 0444, + tsl2x7x_prox_gain_available_show, NULL); -static DEVICE_ATTR(in_illuminance0_calibscale_available, S_IRUGO, - tsl2x7x_gain_available_show, NULL); +static DEVICE_ATTR(in_illuminance0_calibscale_available, 0444, + tsl2x7x_gain_available_show, NULL); -static DEVICE_ATTR(in_illuminance0_integration_time, S_IRUGO | S_IWUSR, - tsl2x7x_als_time_show, tsl2x7x_als_time_store); +static DEVICE_ATTR(in_illuminance0_integration_time, 0644, + tsl2x7x_als_time_show, tsl2x7x_als_time_store); -static DEVICE_ATTR(in_illuminance0_target_input, S_IRUGO | S_IWUSR, - tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); +static DEVICE_ATTR(in_illuminance0_target_input, 0644, + tsl2x7x_als_cal_target_show, tsl2x7x_als_cal_target_store); -static DEVICE_ATTR(in_illuminance0_calibrate, S_IWUSR, NULL, - tsl2x7x_do_calibrate); +static DEVICE_ATTR(in_illuminance0_calibrate, 0200, NULL, + tsl2x7x_do_calibrate); -static DEVICE_ATTR(in_proximity0_calibrate, S_IWUSR, NULL, - tsl2x7x_do_prox_calibrate); +static DEVICE_ATTR(in_proximity0_calibrate, 0200, NULL, + tsl2x7x_do_prox_calibrate); -static DEVICE_ATTR(in_illuminance0_lux_table, S_IRUGO | S_IWUSR, - tsl2x7x_luxtable_show, tsl2x7x_luxtable_store); +static DEVICE_ATTR(in_illuminance0_lux_table, 0644, tsl2x7x_luxtable_show, + tsl2x7x_luxtable_store); -static DEVICE_ATTR(in_intensity0_thresh_period, S_IRUGO | S_IWUSR, - tsl2x7x_als_persistence_show, tsl2x7x_als_persistence_store); +static DEVICE_ATTR(in_intensity0_thresh_period, 0644, + tsl2x7x_als_persistence_show, + tsl2x7x_als_persistence_store); -static DEVICE_ATTR(in_proximity0_thresh_period, S_IRUGO | S_IWUSR, - tsl2x7x_prox_persistence_show, tsl2x7x_prox_persistence_store); +static DEVICE_ATTR(in_proximity0_thresh_period, 0644, + tsl2x7x_prox_persistence_show, + tsl2x7x_prox_persistence_store); /* Use the default register values to identify the Taos device */ static int tsl2x7x_device_id(unsigned char *id, int target) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] tsl2x7x_core: remove paragraph about writing to the FSF's mailing address
Do not include the paragraph about writing to the Free Software Foundation's mailing address from the sample GPL notice. The FSF has changed addresses in the past, and may do so again. Linux already includes a copy of the GPL. Signed-off-by: Enric Balletbo i Serra --- drivers/staging/iio/light/tsl2x7x_core.c | 4 1 file changed, 4 deletions(-) diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x_core.c index ea15bc1c300c..b35ff63f7f60 100644 --- a/drivers/staging/iio/light/tsl2x7x_core.c +++ b/drivers/staging/iio/light/tsl2x7x_core.c @@ -13,10 +13,6 @@ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA02110-1301, USA. */ #include -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: typec: fusb302: Fix chip->vbus_present init value
FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK = 0x40 & 0x80 is always zero. Fix the code to what it is intended to be: check the VBUSOK bit of the value read from address FUSB_REG_STATUS0. Reported-by: Dan Carpenter Cc: Guenter Roeck Signed-off-by: Yueyao Zhu --- drivers/staging/typec/fusb302/fusb302.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index aa460f93a293..d8b50b49bb2d 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -489,7 +489,7 @@ static int tcpm_init(struct tcpc_dev *dev) ret = fusb302_i2c_read(chip, FUSB_REG_STATUS0, &data); if (ret < 0) return ret; - chip->vbus_present = !!(FUSB_REG_STATUS0 & FUSB_REG_STATUS0_VBUSOK); + chip->vbus_present = !!(data & FUSB_REG_STATUS0_VBUSOK); ret = fusb302_i2c_read(chip, FUSB_REG_DEVICE_ID, &data); if (ret < 0) return ret; -- 2.13.0.rc1.294.g07d810a77f-goog ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: media: atomisp: Fix unnecessary initialization of static
Fix checkpatch warning: removed unnecessary initialization of static variable "skip_fwload" to 0 in source atomisp_v4l2.c Signed-off-by: Fabrizio Perria --- drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c index e3fdbdb..a047807 100644 --- a/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c +++ b/drivers/staging/media/atomisp/pci/atomisp2/atomisp_v4l2.c @@ -51,7 +51,7 @@ /* G-Min addition: pull this in from intel_mid_pm.h */ #define CSTATE_EXIT_LATENCY_C1 1 -static uint skip_fwload = 0; +static uint skip_fwload; module_param(skip_fwload, uint, 0644); MODULE_PARM_DESC(skip_fwload, "Skip atomisp firmware load"); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/2] staging: iio: tsl2x7x: rename driver for consistency with other IIO light drivers
This patch renames the tsl2x7x_core.c file to tsl2x7x.c so that the naming convention is consistent with other IIO light drivers outside of staging. Signed-off-by: Brian Masney --- drivers/staging/iio/light/Makefile | 2 +- drivers/staging/iio/light/{tsl2x7x_core.c => tsl2x7x.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename drivers/staging/iio/light/{tsl2x7x_core.c => tsl2x7x.c} (100%) diff --git a/drivers/staging/iio/light/Makefile b/drivers/staging/iio/light/Makefile index 10286c3..ab8dc3a 100644 --- a/drivers/staging/iio/light/Makefile +++ b/drivers/staging/iio/light/Makefile @@ -2,4 +2,4 @@ # Makefile for industrial I/O Light sensors # -obj-$(CONFIG_TSL2x7x) += tsl2x7x_core.o +obj-$(CONFIG_TSL2x7x) += tsl2x7x.o diff --git a/drivers/staging/iio/light/tsl2x7x_core.c b/drivers/staging/iio/light/tsl2x7x.c similarity index 100% rename from drivers/staging/iio/light/tsl2x7x_core.c rename to drivers/staging/iio/light/tsl2x7x.c -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/2] staging: iio: tsl2x7x: remove header file
There is a tsl2x7x.h header that is only used by tsl2x7x.c. This patch moves the contents of the header file into the C code with the driver. Signed-off-by: Brian Masney --- drivers/staging/iio/light/tsl2x7x.c | 76 ++- drivers/staging/iio/light/tsl2x7x.h | 100 2 files changed, 75 insertions(+), 101 deletions(-) delete mode 100644 drivers/staging/iio/light/tsl2x7x.h diff --git a/drivers/staging/iio/light/tsl2x7x.c b/drivers/staging/iio/light/tsl2x7x.c index 8121a51..cd66c9f 100644 --- a/drivers/staging/iio/light/tsl2x7x.c +++ b/drivers/staging/iio/light/tsl2x7x.c @@ -30,7 +30,7 @@ #include #include #include -#include "tsl2x7x.h" +#include /* Cal defs*/ #define PROX_STAT_CAL0 @@ -126,6 +126,80 @@ #define TSL2X7X_MIN_ITIME 3 +/* Max number of segments allowable in LUX table */ +#define TSL2X7X_MAX_LUX_TABLE_SIZE 9 +#define MAX_DEFAULT_TABLE_BYTES (sizeof(int) * TSL2X7X_MAX_LUX_TABLE_SIZE) + +struct iio_dev; + +struct tsl2x7x_lux { + unsigned int ratio; + unsigned int ch0; + unsigned int ch1; +}; + +/** + * struct tsl2x7x_default_settings - power on defaults unless + * overridden by platform data. + * @als_time: ALS Integration time - multiple of 50mS + * @als_gain: Index into the ALS gain table. + * @als_gain_trim: default gain trim to account for + * aperture effects. + * @wait_time: Time between PRX and ALS cycles + * in 2.7 periods + * @prx_time: 5.2ms prox integration time - + * decrease in 2.7ms periods + * @prx_gain: Proximity gain index + * @prox_config: Prox configuration filters. + * @als_cal_target:Known external ALS reading for + * calibration. + * @interrupts_en: Enable/Disable - 0x00 = none, 0x10 = als, + * 0x20 = prx, 0x30 = bth + * @persistence: H/W Filters, Number of 'out of limits' + * ADC readings PRX/ALS. + * @als_thresh_low:CH0 'low' count to trigger interrupt. + * @als_thresh_high: CH0 'high' count to trigger interrupt. + * @prox_thres_low:Low threshold proximity detection. + * @prox_thres_high: High threshold proximity detection + * @prox_pulse_count: Number if proximity emitter pulses + * @prox_max_samples_cal: Used for prox cal. + */ +struct tsl2x7x_settings { + int als_time; + int als_gain; + int als_gain_trim; + int wait_time; + int prx_time; + int prox_gain; + int prox_config; + int als_cal_target; + u8 interrupts_en; + u8 persistence; + int als_thresh_low; + int als_thresh_high; + int prox_thres_low; + int prox_thres_high; + int prox_pulse_count; + int prox_max_samples_cal; +}; + +/** + * struct tsl2X7X_platform_data - Platform callback, glass and defaults + * @platform_power:Suspend/resume platform callback + * @power_on: Power on callback + * @power_off: Power off callback + * @platform_lux_table:Device specific glass coefficents + * @platform_default_settings: Device specific power on defaults + * + */ +struct tsl2X7X_platform_data { + int (*platform_power)(struct device *dev, pm_message_t); + int (*power_on)(struct iio_dev *indio_dev); + int (*power_off)(struct i2c_client *dev); + struct tsl2x7x_lux platform_lux_table[TSL2X7X_MAX_LUX_TABLE_SIZE]; + struct tsl2x7x_settings *platform_default_settings; +}; + /* TAOS txx2x7x Device family members */ enum { tsl2571, diff --git a/drivers/staging/iio/light/tsl2x7x.h b/drivers/staging/iio/light/tsl2x7x.h deleted file mode 100644 index ecae922..000 --- a/drivers/staging/iio/light/tsl2x7x.h +++ /dev/null @@ -1,100 +0,0 @@ -/* - * Device driver for monitoring ambient light intensity (lux) - * and proximity (prox) within the TAOS TSL2X7X family of devices. - * - * Copyright (c) 2012, TAOS Corporation. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for - * more details. - * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#ifndef __TSL2X7X_H -#define __TSL2X7X_H -#
[PATCH 0/2] staging: iio: tsl2x7x: staging cleanups
The two patches in this series begin my work to move this driver out of staging. Before I start working on the meat of the changes that are necessary for a staging graduation, I want to get these two trivial patches out and merged first in case there are any concerns with these changes. Brian Masney (2): staging: iio: tsl2x7x: rename driver for consistency with other IIO light drivers staging: iio: tsl2x7x: remove header file drivers/staging/iio/light/Makefile | 2 +- .../iio/light/{tsl2x7x_core.c => tsl2x7x.c}| 76 +++- drivers/staging/iio/light/tsl2x7x.h| 100 - 3 files changed, 76 insertions(+), 102 deletions(-) rename drivers/staging/iio/light/{tsl2x7x_core.c => tsl2x7x.c} (95%) delete mode 100644 drivers/staging/iio/light/tsl2x7x.h -- 2.9.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] ion: hisilicon: check the right value after ion_heap_create
Hi Laura, On 2017/5/5 1:47, Laura Abbott wrote: > On 05/04/2017 07:45 AM, Yisheng Xie wrote: >> From: Yisheng Xie >> >> It should check ipdev->heaps[i] whether it is error or null instead of >> ipdev->heaps, after ion_heap_create() for ipdev->heaps[i]. >> >> Signed-off-by: Yisheng Xie >> --- >> drivers/staging/android/ion/hisilicon/hi6220_ion.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/staging/android/ion/hisilicon/hi6220_ion.c >> b/drivers/staging/android/ion/hisilicon/hi6220_ion.c >> index 0de7897..7f8eda5 100644 >> --- a/drivers/staging/android/ion/hisilicon/hi6220_ion.c >> +++ b/drivers/staging/android/ion/hisilicon/hi6220_ion.c >> @@ -66,7 +66,7 @@ static int hi6220_ion_probe(struct platform_device *pdev) >> >> for (i = 0; i < ipdev->data->nr; i++) { >> ipdev->heaps[i] = ion_heap_create(&ipdev->data->heaps[i]); >> -if (!ipdev->heaps) { >> +if (IS_ERR_OR_NULL(ipdev->heaps[i])) { >> ion_destroy_platform_data(ipdev->data); >> return -ENOMEM; >> } >> > > This file was removed in a recent clean up series. I see, but maybe you should clean up more totally, I mean you should also remove ./drivers/staging/android/ion/devicetree.txt for it is also useless. Thanks Yisheng Xie ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: staging: fix macros with multiple statements in rtl8723bs/core/rtw_security.c
Hi Jamie, [auto build test ERROR on staging/staging-testing] [also build test ERROR on next-20170504] [cannot apply to v4.11] [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/Jamie-Huang/staging-fix-macros-with-multiple-statements-in-rtl8723bs-core-rtw_security-c/20170505-052107 config: ia64-allmodconfig (attached as .config) compiler: ia64-linux-gcc (GCC) 6.2.0 reproduce: wget https://raw.githubusercontent.com/01org/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=ia64 All error/warnings (new ones prefixed by >>): drivers/staging/rtl8723bs/core/rtw_security.c: In function 'rijndaelEncrypt': >> drivers/staging/rtl8723bs/core/rtw_security.c:2256:1: error: expected ';' >> before '}' token } while (0) ^ >> drivers/staging/rtl8723bs/core/rtw_security.c:2261:3: note: in expansion of >> macro 'ROUND' ROUND(1, t, s); ^ >> drivers/staging/rtl8723bs/core/rtw_security.c:2256:1: error: expected ';' >> before '}' token } while (0) ^ drivers/staging/rtl8723bs/core/rtw_security.c:2265:3: note: in expansion of macro 'ROUND' ROUND(0, s, t); ^ vim +2256 drivers/staging/rtl8723bs/core/rtw_security.c 2250 #define ROUND(i, d, s) \ 2251 do {\ 2252 d##0 = TE0(s##0) ^ TE1(s##1) ^ TE2(s##2) ^ TE3(s##3) ^ rk[4 * i]; \ 2253 d##1 = TE0(s##1) ^ TE1(s##2) ^ TE2(s##3) ^ TE3(s##0) ^ rk[4 * i + 1]; \ 2254 d##2 = TE0(s##2) ^ TE1(s##3) ^ TE2(s##0) ^ TE3(s##1) ^ rk[4 * i + 2]; \ 2255 d##3 = TE0(s##3) ^ TE1(s##0) ^ TE2(s##1) ^ TE3(s##2) ^ rk[4 * i + 3] \ > 2256 } while (0) 2257 2258 /* Nr - 1 full rounds: */ 2259 r = Nr >> 1; 2260 for (;;) { > 2261 ROUND(1, t, s); 2262 rk += 8; 2263 if (--r == 0) 2264 break; --- 0-DAY kernel test infrastructureOpen Source Technology Center https://lists.01.org/pipermail/kbuild-all Intel Corporation .config.gz Description: application/gzip ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8712: ieee80211: fixed brace coding style issue
Fixed coding style issue Signed-off-by: Jaya Durga --- drivers/staging/rtl8712/ieee80211.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/staging/rtl8712/ieee80211.c b/drivers/staging/rtl8712/ieee80211.c index d84da2b..512bf16 100644 --- a/drivers/staging/rtl8712/ieee80211.c +++ b/drivers/staging/rtl8712/ieee80211.c @@ -197,9 +197,10 @@ int r8712_generate_ie(struct registry_priv *pregistrypriv) pdev_network->rates, &sz); ie = r8712_set_ie(ie, _EXT_SUPPORTEDRATES_IE_, (rateLen - 8), (pdev_network->rates + 8), &sz); - } else + } else { ie = r8712_set_ie(ie, _SUPPORTEDRATES_IE_, rateLen, pdev_network->rates, &sz); + } /*DS parameter set*/ ie = r8712_set_ie(ie, _DSSET_IE_, 1, (u8 *)&pdev_network->Configuration.DSConfig, &sz); -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2] staging: lustre: cleanup le32 assignment to ldp_flags
Introduces a local var to collect flags and convert them to le32. Fixes the following sparse warnings: drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23:left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2305:23:right side has type int drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39: warning: invalid assignment: |= drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39:left side has type restricted __le32 drivers/staging/lustre/lustre/lmv/lmv_obd.c:2383:39:right side has type int Signed-off-by: Valentin Vidic --- Changes in v2: use a local var to collect flags drivers/staging/lustre/lustre/lmv/lmv_obd.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/staging/lustre/lustre/lmv/lmv_obd.c b/drivers/staging/lustre/lustre/lmv/lmv_obd.c index 09b469243d73..bec8c1948fa0 100644 --- a/drivers/staging/lustre/lustre/lmv/lmv_obd.c +++ b/drivers/staging/lustre/lustre/lmv/lmv_obd.c @@ -2275,6 +2275,7 @@ static int lmv_read_striped_page(struct obd_export *exp, struct lu_fid master_fid = op_data->op_fid1; struct obd_device *obd = exp->exp_obd; __u64 hash_offset = offset; + __u32 ldp_flags; struct page *min_ent_page = NULL; struct page *ent_page = NULL; struct lu_dirent *min_ent = NULL; @@ -2302,7 +2303,7 @@ static int lmv_read_striped_page(struct obd_export *exp, dp = kmap(ent_page); memset(dp, 0, sizeof(*dp)); dp->ldp_hash_start = cpu_to_le64(offset); - dp->ldp_flags |= LDF_COLLIDE; + ldp_flags = LDF_COLLIDE; area = dp + 1; left_bytes = PAGE_SIZE - sizeof(*dp); @@ -2380,8 +2381,8 @@ static int lmv_read_striped_page(struct obd_export *exp, ent_page = NULL; } else { if (ent == area) - dp->ldp_flags |= LDF_EMPTY; - dp->ldp_flags = cpu_to_le32(dp->ldp_flags); + ldp_flags |= LDF_EMPTY; + dp->ldp_flags |= cpu_to_le32(ldp_flags); dp->ldp_hash_end = cpu_to_le64(hash_offset); } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: lustre: llite: Fix variable length array warning
Fix sparse warning "warning: Variable length array is used." by using kmalloc_array to allocate the required amount of memory instead and kfree to deallocate memory after use. Signed-off-by: Guru Das Srinagesh --- drivers/staging/lustre/lustre/llite/xattr.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/drivers/staging/lustre/lustre/llite/xattr.c b/drivers/staging/lustre/lustre/llite/xattr.c index 6187bff..832ec6e 100644 --- a/drivers/staging/lustre/lustre/llite/xattr.c +++ b/drivers/staging/lustre/lustre/llite/xattr.c @@ -86,7 +86,8 @@ ll_xattr_set_common(const struct xattr_handler *handler, const char *name, const void *value, size_t size, int flags) { - char fullname[strlen(handler->prefix) + strlen(name) + 1]; + int fullname_len = strlen(handler->prefix) + strlen(name) + 1; + char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_KERNEL); struct ll_sb_info *sbi = ll_i2sbi(inode); struct ptlrpc_request *req = NULL; const char *pv = value; @@ -153,6 +154,9 @@ ll_xattr_set_common(const struct xattr_handler *handler, } ptlrpc_req_finished(req); + + kfree(fullname); + return 0; } @@ -363,7 +367,8 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, struct dentry *dentry, struct inode *inode, const char *name, void *buffer, size_t size) { - char fullname[strlen(handler->prefix) + strlen(name) + 1]; + int fullname_len = strlen(handler->prefix) + strlen(name) + 1; + char *fullname = kmalloc_array(fullname_len, sizeof(char), GFP_KERNEL); struct ll_sb_info *sbi = ll_i2sbi(inode); #ifdef CONFIG_FS_POSIX_ACL struct ll_inode_info *lli = ll_i2info(inode); @@ -411,8 +416,12 @@ static int ll_xattr_get_common(const struct xattr_handler *handler, return -ENODATA; #endif sprintf(fullname, "%s%s\n", handler->prefix, name); - return ll_xattr_list(inode, fullname, handler->flags, buffer, size, -OBD_MD_FLXATTR); + + rc = ll_xattr_list(inode, fullname, handler->flags, buffer, size, + OBD_MD_FLXATTR); + kfree(fullname); + + return rc; } static ssize_t ll_getxattr_lov(struct inode *inode, void *buf, size_t buf_size) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel