[PATCH 3/4] staging: skein: cleanup: removed unnecessary cast spaces
Spaces after casts are removed --- drivers/staging/skein/skein_api.c | 2 +- drivers/staging/skein/skein_base.c | 12 ++-- drivers/staging/skein/skein_base.h | 12 ++-- drivers/staging/skein/skein_block.c | 12 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/skein/skein_api.c b/drivers/staging/skein/skein_api.c index e23cb16..cab26e7 100644 --- a/drivers/staging/skein/skein_api.c +++ b/drivers/staging/skein/skein_api.c @@ -209,7 +209,7 @@ int skein_update_bits(struct skein_ctx *ctx, const u8 *msg, /* internal sanity check: there IS a partial byte in the buffer! */ skein_assert(length != 0); /* partial byte bit mask */ - mask = (u8) (1u << (7 - (msg_bit_cnt & 7))); + mask = (u8)(1u << (7 - (msg_bit_cnt & 7))); /* apply bit padding on final byte (in the buffer) */ up[length - 1] = (u8)((up[length - 1] & (0 - mask)) | mask); diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c index 9734de4..498a644 100644 --- a/drivers/staging/skein/skein_base.c +++ b/drivers/staging/skein/skein_base.c @@ -221,7 +221,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_256_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -448,7 +448,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_512_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_512_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -670,7 +670,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_1024_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_1024_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -777,7 +777,7 @@ int skein_256_output(struct skein_256_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_256_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -814,7 +814,7 @@ int skein_512_output(struct skein_512_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_512_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_512_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -851,7 +851,7 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_1024_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_1024_process_block(ctx, ctx->b, 1, sizeof(u64)); diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h index 0817897..cba4a36 100644 --- a/drivers/staging/skein/skein_base.h +++ b/drivers/staging/skein/skein_base.h @@ -162,13 +162,13 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val); #define SKEIN_T1_POS_FINAL SKEIN_T1_BIT(127) /* 127 final blk flag */ /* tweak word tweak[1]: flag bit definition(s) */ -#define SKEIN_T1_FLAG_FIRST (((u64) 1) << SKEIN_T1_POS_FIRST) -#define SKEIN_T1_FLAG_FINAL (((u64) 1) << SKEIN_T1_POS_FINAL) -#define SKEIN_T1_FLAG_BIT_PAD (((u64) 1) << SKEIN_T1_POS_BIT_PAD) +#define SKEIN_T1_FLAG_FIRST (((u64)1) << SKEIN_T1_POS_FIRST) +#define SKEIN_T1_FLAG_FINAL (((u64)1) << SKEIN_
[PATCH 4/4] staging: skein: cleanup: align code to parentheses
Align wrapped lines to parentheses (if applicable). --- drivers/staging/skein/skein_base.c| 24 drivers/staging/skein/skein_generic.c | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c index 498a644..c24a573 100644 --- a/drivers/staging/skein/skein_base.c +++ b/drivers/staging/skein/skein_base.c @@ -205,7 +205,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_256_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_256_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -231,7 +231,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) n = SKEIN_256_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_256_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -432,7 +432,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_512_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_512_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -458,7 +458,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) n = SKEIN_512_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_512_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -654,7 +654,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_1024_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_1024_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -680,7 +680,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) n = SKEIN_1024_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_1024_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -702,7 +702,7 @@ int skein_256_final_pad(struct skein_256_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_256_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_256_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -724,7 +724,7 @@ int skein_512_final_pad(struct skein_512_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_512_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_512_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -746,7 +746,7 @@ int skein_1024_final_pad(struct skein_1024_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_1024_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_1024_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -787,7 +787,7 @@ int skein_256_output(struct skein_256_ctx *ctx, u8 *hash_val) n = SKEIN_256_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_256_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */
Re: [PATCH V5 3/9] staging: rtl8192u: check return value eprom_read
On Sat, Apr 30, 2016 at 01:53:03AM +0100, Salah Triki wrote: > The call of eprom_read may fail, therefore its return value must be > checked > > Signed-off-by: Salah Triki > --- > drivers/staging/rtl8192u/r8192U_core.c | 145 > +++-- > 1 file changed, 103 insertions(+), 42 deletions(-) > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c > b/drivers/staging/rtl8192u/r8192U_core.c > index 849a95e..6bcbdae 100644 > --- a/drivers/staging/rtl8192u/r8192U_core.c > +++ b/drivers/staging/rtl8192u/r8192U_core.c > @@ -2440,9 +2440,13 @@ static void rtl8192_read_eeprom_info(struct net_device > *dev) > struct r8192_priv *priv = ieee80211_priv(dev); > u16 tmpValue = 0; > int i; > + int ret; > > RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); > - wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ > + ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ > + if (ret < 0) > + return; > + wEPROM_ID = (u16)ret; Think about this code. It's completely broken now. I'm still not going to review this patchset. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging: skein: cleanup: fixed new lines
On Fri, Apr 29, 2016 at 11:59:01PM -0700, Manu Kumar wrote: > Added lines between functions in skein_block.c and removed unneeded > lines in skein_block.c No Signed-off-by. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: rtl8188eu: fixed coding style issues
Fixed parentheses, braces, comments, constants on the left side comparisons, extra newlines and indentations, NULL comparisons, and a typo. Signed-off-by: Jacky Boen --- drivers/staging/rtl8188eu/hal/usb_halinit.c | 73 ++--- 1 file changed, 34 insertions(+), 39 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/usb_halinit.c b/drivers/staging/rtl8188eu/hal/usb_halinit.c index 07a61b8..13c1277 100644 --- a/drivers/staging/rtl8188eu/hal/usb_halinit.c +++ b/drivers/staging/rtl8188eu/hal/usb_halinit.c @@ -62,8 +62,8 @@ static bool HalUsbSetQueuePipeMapping8188EUsb(struct adapter *adapt, u8 NumInPip _ConfigNormalChipOutEP_8188E(adapt, NumOutPipe); /* Normal chip with one IN and one OUT doesn't have interrupt IN EP. */ - if (1 == haldata->OutEpNumber) { - if (1 != NumInPipe) + if (haldata->OutEpNumber == 1) { + if (NumInPipe != 1) return result; } @@ -179,7 +179,7 @@ static void _InitQueueReservedPage(struct adapter *Adapter) if (haldata->OutEpQueueSel & TX_SELE_LQ) numLQ = 0x1C; - /* NOTE: This step shall be proceed before writting REG_RQPN. */ + /* NOTE: This step shall be proceed before writing REG_RQPN. */ if (haldata->OutEpQueueSel & TX_SELE_NQ) numNQ = 0x1C; value8 = (u8)_NPQ(numNQ); @@ -457,7 +457,8 @@ static void _InitRetryFunction(struct adapter *Adapter) * WhenWho Remark * 12/10/2010 MHC Separate to smaller function. * - *---*/ + *--- + */ static void usb_AggSettingTxUpdate(struct adapter *Adapter) { struct hal_data_8188e *haldata = GET_HAL_DATA(Adapter); @@ -489,7 +490,8 @@ static void usb_AggSettingTxUpdate(struct adapter *Adapter) * WhenWho Remark * 12/10/2010 MHC Separate to smaller function. * - *---*/ + *--- + */ static void usb_AggSettingRxUpdate( struct adapter *Adapter @@ -655,7 +657,8 @@ static void _InitAntenna_Selection(struct adapter *Adapter) * Revised History: * WhenWho Remark * 08/23/2010 MHC HW suspend mode switch test.. - *---*/ + *--- + */ enum rt_rf_power_state RfOnOffDetect(struct adapter *adapt) { u8 val8; @@ -687,11 +690,9 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) #define HAL_INIT_PROFILE_TAG(stage) do {} while (0) - HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_BEGIN); if (Adapter->pwrctrlpriv.bkeepfwalive) { - if (haldata->odmpriv.RFCalibrateInfo.bIQKInitialized) { rtl88eu_phy_iq_calibrate(Adapter, true); } else { @@ -715,9 +716,8 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) /* Save target channel */ haldata->CurrentChannel = 6;/* default set to 6 */ - if (pwrctrlpriv->reg_rfoff) { + if (pwrctrlpriv->reg_rfoff) pwrctrlpriv->rf_pwrstate = rf_off; - } /* 2010/08/09 MH We need to check if we need to turnon or off RF after detecting */ /* HW GPIO pin. Before PHY_RFConfig8192C. */ @@ -749,10 +749,9 @@ static u32 rtl8188eu_hal_init(struct adapter *Adapter) DBG_88E("%s: Download Firmware failed!!\n", __func__); Adapter->bFWReady = false; return status; - } else { - RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializeadapt8192CSdio(): Download Firmware Success!!\n")); - Adapter->bFWReady = true; } + RT_TRACE(_module_hci_hal_init_c_, _drv_info_, ("Initializeadapt8192CSdio(): Download Firmware Success!!\n")); + Adapter->bFWReady = true; } rtl8188e_InitializeFirmwareVars(Adapter); @@ -878,7 +877,7 @@ HAL_INIT_PROFILE_TAG(HAL_INIT_STAGES_IQK); /* 2010/08/26 MH Merge from 8192CE. */ if (pwrctrlpriv->rf_pwrstate == rf_on) { if (haldata->odmpriv.RFCalibrateInfo.bIQKInitialized) { - rtl88eu_phy_iq_calibrate(Adapter, true); + rtl88eu_phy_iq_calibrate(Adapter, true); } else { rtl88eu_phy_iq_calibrate(Adapter, false); haldata->odmpriv.RFCalibrateInfo.bIQKInitialized = true; @@ -905,7 +904,6 @
Re: [PATCH v2] vme: change LM callback argument to void pointer
On Fri, Apr 29, 2016 at 04:41:02PM -0500, Aaron Sierra wrote: > There appear to be no in-kernel callers of vme_lm_attach (or > vme_lme_request for that matter), so this change only affects the VME > subsystem and bridge drivers. Are we planning to add in-kernel users soon? regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH V5 3/9] staging: rtl8192u: check return value eprom_read
On Sat, Apr 30, 2016 at 10:23:37AM +0300, Dan Carpenter wrote: > On Sat, Apr 30, 2016 at 01:53:03AM +0100, Salah Triki wrote: > > The call of eprom_read may fail, therefore its return value must be > > checked > > > > Signed-off-by: Salah Triki > > --- > > drivers/staging/rtl8192u/r8192U_core.c | 145 > > +++-- > > 1 file changed, 103 insertions(+), 42 deletions(-) > > > > diff --git a/drivers/staging/rtl8192u/r8192U_core.c > > b/drivers/staging/rtl8192u/r8192U_core.c > > index 849a95e..6bcbdae 100644 > > --- a/drivers/staging/rtl8192u/r8192U_core.c > > +++ b/drivers/staging/rtl8192u/r8192U_core.c > > @@ -2440,9 +2440,13 @@ static void rtl8192_read_eeprom_info(struct > > net_device *dev) > > struct r8192_priv *priv = ieee80211_priv(dev); > > u16 tmpValue = 0; > > int i; > > + int ret; > > > > RT_TRACE(COMP_EPROM, "===>%s()\n", __func__); > > - wEPROM_ID = eprom_read(dev, 0); /* first read EEPROM ID out; */ > > + ret = eprom_read(dev, 0); /* first read EEPROM ID out; */ > > + if (ret < 0) > > + return; > > + wEPROM_ID = (u16)ret; > > > Think about this code. It's completely broken now. > > I'm still not going to review this patchset. Oops.. Actually you changed this from the previous version so it should work now. My bad. regards, dan carpenter ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging: skein: cleanup: fixed new lines
On Fri, Apr 29, 2016 at 11:59:01PM -0700, Manu Kumar wrote: > Added lines between functions in skein_block.c and removed unneeded > lines in skein_block.c > --- > drivers/staging/skein/skein_api.c | 1 - > drivers/staging/skein/skein_block.c | 4 +++- > 2 files changed, 3 insertions(+), 2 deletions(-) As Dan pointed out, always use scripts/checkpatch.pl on your patches to ensure you got them correct before sending them out with obvious errors like this. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH] Staging: rtl8188eu: fixed coding style issues
On Sat, Apr 30, 2016 at 04:30:12PM +0800, Jacky Boen wrote: > Fixed parentheses, braces, comments, constants on the left side > comparisons, extra newlines and indentations, NULL comparisons, > and a typo. That's a lot of different things all in one patch. Please break it up into "one patch per logical change" and send a patch series. thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging: skein: cleanup: fixed new lines
On Sat, Apr 30, 2016 at 09:15:03AM -0700, Greg KH wrote: As Dan pointed out, always use scripts/checkpatch.pl on your patches to ensure you got them correct before sending them out with obvious errors like this. Sorry about that, re-sending with Signed-off-by. -- Manu ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/4] staging: skein: cleanup: fixed new lines
Added lines between functions in skein_block.c and removed unneeded lines in skein_block.c Signed-off-by: Manu Kumar --- drivers/staging/skein/skein_api.c | 1 - drivers/staging/skein/skein_block.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/staging/skein/skein_api.c b/drivers/staging/skein/skein_api.c index 36f849f..e23cb16 100644 --- a/drivers/staging/skein/skein_api.c +++ b/drivers/staging/skein/skein_api.c @@ -165,7 +165,6 @@ int skein_update(struct skein_ctx *ctx, const u8 *msg, break; } return ret; - } int skein_update_bits(struct skein_ctx *ctx, const u8 *msg, diff --git a/drivers/staging/skein/skein_block.c b/drivers/staging/skein/skein_block.c index 45b4732..d31c7d2 100644 --- a/drivers/staging/skein/skein_block.c +++ b/drivers/staging/skein/skein_block.c @@ -463,6 +463,7 @@ size_t skein_256_process_block_code_size(void) return ((u8 *) skein_256_process_block_code_size) - ((u8 *) skein_256_process_block); } + unsigned int skein_256_unroll_cnt(void) { return SKEIN_UNROLL_256; @@ -543,7 +544,6 @@ void skein_512_process_block(struct skein_512_ctx *ctx, const u8 *blk_ptr, for (r = 1; r < (SKEIN_UNROLL_512 ? 2 * RCNT : 2); r += (SKEIN_UNROLL_512 ? 2 * SKEIN_UNROLL_512 : 1)) { - R512_8_ROUNDS(0); #if R512_UNROLL_R(1) @@ -612,6 +612,7 @@ size_t skein_512_process_block_code_size(void) return ((u8 *) skein_512_process_block_code_size) - ((u8 *) skein_512_process_block); } + unsigned int skein_512_unroll_cnt(void) { return SKEIN_UNROLL_512; @@ -774,6 +775,7 @@ size_t skein_1024_process_block_code_size(void) return ((u8 *) skein_1024_process_block_code_size) - ((u8 *) skein_1024_process_block); } + unsigned int skein_1024_unroll_cnt(void) { return SKEIN_UNROLL_1024; -- 2.8.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/4] staging: skein: cleanup: Fixed operator whitespace
added operator white space and parentheses for readability Signed-off-by: Manu Kumar --- drivers/staging/skein/skein_base.c| 66 +-- drivers/staging/skein/skein_base.h| 28 +++ drivers/staging/skein/skein_block.c | 44 --- drivers/staging/skein/threefish_api.h | 2 +- 4 files changed, 71 insertions(+), 69 deletions(-) diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c index 25a01ca..9734de4 100644 --- a/drivers/staging/skein/skein_base.c +++ b/drivers/staging/skein/skein_base.c @@ -58,7 +58,7 @@ int skein_256_init(struct skein_256_ctx *ctx, size_t hash_bit_len) cfg.w[1] = skein_swap64(hash_bit_len); cfg.w[2] = skein_swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); /* zero pad config block */ - memset(&cfg.w[3], 0, sizeof(cfg) - 3*sizeof(cfg.w[0])); + memset(&cfg.w[3], 0, sizeof(cfg) - 3 * sizeof(cfg.w[0])); /* compute the initial chaining values from config block */ /* zero the chaining variables */ @@ -98,7 +98,7 @@ int skein_256_init_ext(struct skein_256_ctx *ctx, size_t hash_bit_len, skein_assert(sizeof(cfg.b) >= sizeof(ctx->x)); /* do a mini-Init right here */ /* set output hash bit count = state size */ - ctx->h.hash_bit_len = 8*sizeof(ctx->x); + ctx->h.hash_bit_len = 8 * sizeof(ctx->x); /* set tweaks: T0 = 0; T1 = KEY type */ skein_start_new_type(ctx, KEY); /* zero the initial chaining variables */ @@ -171,7 +171,7 @@ int skein_256_update(struct skein_256_ctx *ctx, const u8 *msg, */ if (msg_byte_cnt > SKEIN_256_BLOCK_BYTES) { /* number of full blocks to process */ - n = (msg_byte_cnt-1) / SKEIN_256_BLOCK_BYTES; + n = (msg_byte_cnt - 1) / SKEIN_256_BLOCK_BYTES; skein_256_process_block(ctx, msg, n, SKEIN_256_BLOCK_BYTES); msg_byte_cnt -= n * SKEIN_256_BLOCK_BYTES; @@ -219,19 +219,19 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) memset(ctx->b, 0, sizeof(ctx->b)); /* keep a local copy of counter mode "key" */ memcpy(x, ctx->x, sizeof(x)); - for (i = 0; i*SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { + for (i = 0; i * SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ ((u64 *)ctx->b)[0] = skein_swap64((u64) i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_256_process_block(ctx, ctx->b, 1, sizeof(u64)); /* number of output bytes left to go */ - n = byte_cnt - i*SKEIN_256_BLOCK_BYTES; + n = byte_cnt - i * SKEIN_256_BLOCK_BYTES; if (n >= SKEIN_256_BLOCK_BYTES) n = SKEIN_256_BLOCK_BYTES; /* "output" the ctr mode bytes */ - skein_put64_lsb_first(hash_val+i*SKEIN_256_BLOCK_BYTES, ctx->x, - n); + skein_put64_lsb_first(hash_val + (i * SKEIN_256_BLOCK_BYTES), + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -282,7 +282,7 @@ int skein_512_init(struct skein_512_ctx *ctx, size_t hash_bit_len) cfg.w[1] = skein_swap64(hash_bit_len); cfg.w[2] = skein_swap64(SKEIN_CFG_TREE_INFO_SEQUENTIAL); /* zero pad config block */ - memset(&cfg.w[3], 0, sizeof(cfg) - 3*sizeof(cfg.w[0])); + memset(&cfg.w[3], 0, sizeof(cfg) - 3 * sizeof(cfg.w[0])); /* compute the initial chaining values from config block */ /* zero the chaining variables */ @@ -326,7 +326,7 @@ int skein_512_init_ext(struct skein_512_ctx *ctx, size_t hash_bit_len, skein_assert(sizeof(cfg.b) >= sizeof(ctx->x)); /* do a mini-Init right here */ /* set output hash bit count = state size */ - ctx->h.hash_bit_len = 8*sizeof(ctx->x); + ctx->h.hash_bit_len = 8 * sizeof(ctx->x); /* set tweaks: T0 = 0; T1 = KEY type */ skein_start_new_type(ctx, KEY); /* zero the initial chaining variables */ @@ -398,7 +398,7 @@ int skein_512_update(struct skein_512_ctx *ctx, const u8 *msg, */ if (msg_byte_cnt > SKEIN_512_BLOCK_BYTES) { /* number of full blocks to process */ - n = (msg_byte_cnt-1) / SKEIN_512_BLOCK_BYTES; + n = (msg_byte_cnt - 1) / SKEIN_512_BLOCK_BYTES;
[PATCH v2 4/4] staging: skein: cleanup: align code to parentheses
Align wrapped lines to parentheses (if applicable). Signed-off-by: Manu Kumar --- drivers/staging/skein/skein_base.c| 24 drivers/staging/skein/skein_generic.c | 6 +++--- 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c index 498a644..c24a573 100644 --- a/drivers/staging/skein/skein_base.c +++ b/drivers/staging/skein/skein_base.c @@ -205,7 +205,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_256_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_256_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -231,7 +231,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) n = SKEIN_256_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_256_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -432,7 +432,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_512_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_512_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -458,7 +458,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) n = SKEIN_512_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_512_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -654,7 +654,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_1024_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_1024_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -680,7 +680,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) n = SKEIN_1024_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_1024_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode key for next time */ memcpy(ctx->x, x, sizeof(x)); } @@ -702,7 +702,7 @@ int skein_256_final_pad(struct skein_256_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_256_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_256_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_256_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -724,7 +724,7 @@ int skein_512_final_pad(struct skein_512_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_512_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_512_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_512_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -746,7 +746,7 @@ int skein_1024_final_pad(struct skein_1024_ctx *ctx, u8 *hash_val) /* zero pad b[] if necessary */ if (ctx->h.b_cnt < SKEIN_1024_BLOCK_BYTES) memset(&ctx->b[ctx->h.b_cnt], 0, - SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); + SKEIN_1024_BLOCK_BYTES - ctx->h.b_cnt); /* process the final block */ skein_1024_process_block(ctx, ctx->b, 1, ctx->h.b_cnt); @@ -787,7 +787,7 @@ int skein_256_output(struct skein_256_ctx *ctx, u8 *hash_val) n = SKEIN_256_BLOCK_BYTES; /* "output" the ctr mode bytes */ skein_put64_lsb_first(hash_val + (i * SKEIN_256_BLOCK_BYTES), - ctx->x, n); + ctx->x, n); /* restore the counter mode
[PATCH v2 3/4] staging: skein: cleanup: removed unnecessary cast spaces
Spaces after casts are removed Signed-off-by: Manu Kumar --- drivers/staging/skein/skein_api.c | 2 +- drivers/staging/skein/skein_base.c | 12 ++-- drivers/staging/skein/skein_base.h | 12 ++-- drivers/staging/skein/skein_block.c | 12 ++-- 4 files changed, 19 insertions(+), 19 deletions(-) diff --git a/drivers/staging/skein/skein_api.c b/drivers/staging/skein/skein_api.c index e23cb16..cab26e7 100644 --- a/drivers/staging/skein/skein_api.c +++ b/drivers/staging/skein/skein_api.c @@ -209,7 +209,7 @@ int skein_update_bits(struct skein_ctx *ctx, const u8 *msg, /* internal sanity check: there IS a partial byte in the buffer! */ skein_assert(length != 0); /* partial byte bit mask */ - mask = (u8) (1u << (7 - (msg_bit_cnt & 7))); + mask = (u8)(1u << (7 - (msg_bit_cnt & 7))); /* apply bit padding on final byte (in the buffer) */ up[length - 1] = (u8)((up[length - 1] & (0 - mask)) | mask); diff --git a/drivers/staging/skein/skein_base.c b/drivers/staging/skein/skein_base.c index 9734de4..498a644 100644 --- a/drivers/staging/skein/skein_base.c +++ b/drivers/staging/skein/skein_base.c @@ -221,7 +221,7 @@ int skein_256_final(struct skein_256_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_256_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -448,7 +448,7 @@ int skein_512_final(struct skein_512_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_512_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_512_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -670,7 +670,7 @@ int skein_1024_final(struct skein_1024_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_1024_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_1024_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -777,7 +777,7 @@ int skein_256_output(struct skein_256_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_256_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_256_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -814,7 +814,7 @@ int skein_512_output(struct skein_512_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_512_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_512_process_block(ctx, ctx->b, 1, sizeof(u64)); @@ -851,7 +851,7 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val) memcpy(x, ctx->x, sizeof(x)); for (i = 0; i * SKEIN_1024_BLOCK_BYTES < byte_cnt; i++) { /* build the counter block */ - ((u64 *)ctx->b)[0] = skein_swap64((u64) i); + ((u64 *)ctx->b)[0] = skein_swap64((u64)i); skein_start_new_type(ctx, OUT_FINAL); /* run "counter mode" */ skein_1024_process_block(ctx, ctx->b, 1, sizeof(u64)); diff --git a/drivers/staging/skein/skein_base.h b/drivers/staging/skein/skein_base.h index 0817897..cba4a36 100644 --- a/drivers/staging/skein/skein_base.h +++ b/drivers/staging/skein/skein_base.h @@ -162,13 +162,13 @@ int skein_1024_output(struct skein_1024_ctx *ctx, u8 *hash_val); #define SKEIN_T1_POS_FINAL SKEIN_T1_BIT(127) /* 127 final blk flag */ /* tweak word tweak[1]: flag bit definition(s) */ -#define SKEIN_T1_FLAG_FIRST (((u64) 1) << SKEIN_T1_POS_FIRST) -#define SKEIN_T1_FLAG_FINAL (((u64) 1) << SKEIN_T1_POS_FINAL) -#define SKEIN_T1_FLAG_BIT_PAD (((u64) 1) << SKEIN_T1_POS_BIT_PAD) +#define SKEIN_T1_FLAG_FIRST (((u64)1) << SKEIN_T1_POS_FIRST) +#define SKEIN_T1_FLAG_FIN
Re: [PATCH 1/3] Drivers: hv: balloon: don't crash when memory is added in non-sorted order
On Fri, Apr 29, 2016 at 11:45:17AM -0700, K. Y. Srinivasan wrote: > From: Vitaly Kuznetsov > > When we iterate through all HA regions in handle_pg_range() we have an > assumption that all these regions are sorted in the list and the > 'start_pfn >= has->end_pfn' check is enough to find the proper region. > Unfortunately it's not the case with WS2016 where host can hot-add regions > in a different order. We end up modifying the wrong HA region and crashing > later on pages online. Modify the check to make sure we found the region > we were searching for while iterating. Fix the same check in pfn_covered() > as well. > > Signed-off-by: Vitaly Kuznetsov > Signed-off-by: K. Y. Srinivasan > --- > drivers/hv/hv_balloon.c |4 ++-- > 1 files changed, 2 insertions(+), 2 deletions(-) I only received patch 1/3 here, what happened to the other 2? Can you resend the whole series? thanks, greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover
On Tue, Apr 05, 2016 at 04:57:40PM -0700, K. Y. Srinivasan wrote: > From: Vitaly Kuznetsov > > Hyper-V VMs can be replicated to another hosts and there is a feature to > set different IP for replicas, it is called 'Failover TCP/IP'. When > such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as soon > as we finish negotiation procedure. The problem is that it can happen (and > it actually happens) before userspace daemon connects and we reply with > HV_E_FAIL to the message. As there are no repetitions we fail to set the > requested IP. > > Solve the issue by postponing our reply to the negotiation message till > userspace daemon is connected. We can't wait too long as there is a > host-side timeout (cca. 75 seconds) and if we fail to reply in this time > frame the whole KVP service will become inactive. The solution is not > ideal - if it takes userspace daemon more than 60 seconds to connect > IP Failover will still fail but I don't see a solution with our current > separation between kernel and userspace parts. > > Other two modules (VSS and FCOPY) don't require such delay, leave them > untouched. > > Signed-off-by: Vitaly Kuznetsov > Signed-off-by: K. Y. Srinivasan > --- > drivers/hv/hv_kvp.c | 31 +++ > drivers/hv/hyperv_vmbus.h |5 + > 2 files changed, 36 insertions(+), 0 deletions(-) This series doesn't apply to my tree :( ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: i4l: act2000: do not assign in if
It is not the kernel coding style to assign values to some variable in if statement. Split them up into different statements. Signed-off-by: Sudip Mukherjee --- drivers/staging/i4l/act2000/act2000_isa.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/drivers/staging/i4l/act2000/act2000_isa.c b/drivers/staging/i4l/act2000/act2000_isa.c index 34c0a9a..048507e 100644 --- a/drivers/staging/i4l/act2000/act2000_isa.c +++ b/drivers/staging/i4l/act2000/act2000_isa.c @@ -31,7 +31,8 @@ act2000_isa_reset(unsigned short portbase) int serial = 0; found = 0; - if ((reg = inb(portbase + ISA_COR)) != 0xff) { + reg = inb(portbase + ISA_COR); + if (reg != 0xff) { outb(reg | ISA_COR_RESET, portbase + ISA_COR); mdelay(10); outb(reg, portbase + ISA_COR); @@ -303,7 +304,8 @@ act2000_isa_send(act2000_card *card) while (1) { spin_lock_irqsave(&card->lock, flags); if (!(card->sbuf)) { - if ((card->sbuf = skb_dequeue(&card->sndq))) { + card->sbuf = skb_dequeue(&card->sndq); + if (card->sbuf) { card->ack_msg = card->sbuf->data; msg = (actcapi_msg *)card->sbuf->data; if ((msg->hdr.cmd.cmd == 0x86) && @@ -378,7 +380,8 @@ act2000_isa_getid(act2000_card *card) printk(KERN_WARNING "act2000: Wrong Firmware-ID!\n"); return -EPROTO; } - if ((p = strchr(fid.revision, '\n'))) + p = strchr(fid.revision, '\n'); + if (p) *p = '\0'; printk(KERN_INFO "act2000: Firmware-ID: %s\n", fid.revision); if (card->flags & ACT2000_FLAGS_IVALID) { -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: i4l: act2000: remove extra space
It is not kernel coding style to give an extra space after a cast. We get warned about it by checkpatch. Signed-off-by: Sudip Mukherjee --- drivers/staging/i4l/act2000/act2000_isa.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/staging/i4l/act2000/act2000_isa.c b/drivers/staging/i4l/act2000/act2000_isa.c index 27c0046..f0eb844 100644 --- a/drivers/staging/i4l/act2000/act2000_isa.c +++ b/drivers/staging/i4l/act2000/act2000_isa.c @@ -233,7 +233,7 @@ act2000_isa_receive(act2000_card *card) { u_char c; - if (test_and_set_bit(ACT2000_LOCK_RX, (void *) &card->ilock) != 0) + if (test_and_set_bit(ACT2000_LOCK_RX, (void *)&card->ilock) != 0) return; while (!act2000_isa_readb(card, &c)) { if (card->idat.isa.rcvidx < 8) { @@ -248,7 +248,7 @@ act2000_isa_receive(act2000_card *card) card->idat.isa.rcvignore = 1; printk(KERN_WARNING "act2000_isa_receive: no memory\n"); - test_and_clear_bit(ACT2000_LOCK_RX, (void *) &card->ilock); + test_and_clear_bit(ACT2000_LOCK_RX, (void *)&card->ilock); return; } memcpy(skb_put(card->idat.isa.rcvskb, 8), card->idat.isa.rcvhdr, 8); @@ -288,7 +288,7 @@ act2000_isa_receive(act2000_card *card) (card->idat.isa.rcvidx < card->idat.isa.rcvlen))) act2000_schedule_poll(card); } - test_and_clear_bit(ACT2000_LOCK_RX, (void *) &card->ilock); + test_and_clear_bit(ACT2000_LOCK_RX, (void *)&card->ilock); } void @@ -299,7 +299,7 @@ act2000_isa_send(act2000_card *card) actcapi_msg *msg; int l; - if (test_and_set_bit(ACT2000_LOCK_TX, (void *) &card->ilock) != 0) + if (test_and_set_bit(ACT2000_LOCK_TX, (void *)&card->ilock) != 0) return; while (1) { spin_lock_irqsave(&card->lock, flags); @@ -319,7 +319,7 @@ act2000_isa_send(act2000_card *card) spin_unlock_irqrestore(&card->lock, flags); if (!(card->sbuf)) { /* No more data to send */ - test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock); + test_and_clear_bit(ACT2000_LOCK_TX, (void *)&card->ilock); return; } skb = card->sbuf; @@ -327,7 +327,7 @@ act2000_isa_send(act2000_card *card) while (skb->len) { if (act2000_isa_writeb(card, *(skb->data))) { /* Fifo is full, but more data to send */ - test_and_clear_bit(ACT2000_LOCK_TX, (void *) &card->ilock); + test_and_clear_bit(ACT2000_LOCK_TX, (void *)&card->ilock); /* Schedule myself */ act2000_schedule_tx(card); return; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: i4l: act2000: remove blank line after brace
checkpatch complains about an extra blank line after an opening brace. Signed-off-by: Sudip Mukherjee --- drivers/staging/i4l/act2000/act2000_isa.c | 1 - 1 file changed, 1 deletion(-) diff --git a/drivers/staging/i4l/act2000/act2000_isa.c b/drivers/staging/i4l/act2000/act2000_isa.c index 048507e..27c0046 100644 --- a/drivers/staging/i4l/act2000/act2000_isa.c +++ b/drivers/staging/i4l/act2000/act2000_isa.c @@ -358,7 +358,6 @@ act2000_isa_send(act2000_card *card) static int act2000_isa_getid(act2000_card *card) { - act2000_fwid fid; u_char *p = (u_char *)&fid; int count = 0; -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: i4l: act2000: fix use of return
checkpatch warns that return is not a function and as such the brace after it is not required. Signed-off-by: Sudip Mukherjee --- drivers/staging/i4l/act2000/act2000_isa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/i4l/act2000/act2000_isa.c b/drivers/staging/i4l/act2000/act2000_isa.c index b5fad29..34c0a9a 100644 --- a/drivers/staging/i4l/act2000/act2000_isa.c +++ b/drivers/staging/i4l/act2000/act2000_isa.c @@ -439,5 +439,5 @@ act2000_isa_download(act2000_card *card, act2000_ddef __user *cb) } kfree(buf); msleep_interruptible(500); - return (act2000_isa_getid(card)); + return act2000_isa_getid(card); } -- 1.9.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/3] Drivers: hv: balloon: don't crash when memory is added in non-sorted order
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Saturday, April 30, 2016 2:03 PM > To: KY Srinivasan > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > jasow...@redhat.com > Subject: Re: [PATCH 1/3] Drivers: hv: balloon: don't crash when memory is > added in non-sorted order > > On Fri, Apr 29, 2016 at 11:45:17AM -0700, K. Y. Srinivasan wrote: > > From: Vitaly Kuznetsov > > > > When we iterate through all HA regions in handle_pg_range() we have an > > assumption that all these regions are sorted in the list and the > > 'start_pfn >= has->end_pfn' check is enough to find the proper region. > > Unfortunately it's not the case with WS2016 where host can hot-add > regions > > in a different order. We end up modifying the wrong HA region and > crashing > > later on pages online. Modify the check to make sure we found the region > > we were searching for while iterating. Fix the same check in pfn_covered() > > as well. > > > > Signed-off-by: Vitaly Kuznetsov > > Signed-off-by: K. Y. Srinivasan > > --- > > drivers/hv/hv_balloon.c |4 ++-- > > 1 files changed, 2 insertions(+), 2 deletions(-) > > I only received patch 1/3 here, what happened to the other 2? > > Can you resend the whole series? Will do. Thanks, K. Y > > thanks, > > greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Saturday, April 30, 2016 2:05 PM > To: KY Srinivasan > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > jasow...@redhat.com > Subject: Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover > > On Tue, Apr 05, 2016 at 04:57:40PM -0700, K. Y. Srinivasan wrote: > > From: Vitaly Kuznetsov > > > > Hyper-V VMs can be replicated to another hosts and there is a feature to > > set different IP for replicas, it is called 'Failover TCP/IP'. When > > such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as > soon > > as we finish negotiation procedure. The problem is that it can happen (and > > it actually happens) before userspace daemon connects and we reply with > > HV_E_FAIL to the message. As there are no repetitions we fail to set the > > requested IP. > > > > Solve the issue by postponing our reply to the negotiation message till > > userspace daemon is connected. We can't wait too long as there is a > > host-side timeout (cca. 75 seconds) and if we fail to reply in this time > > frame the whole KVP service will become inactive. The solution is not > > ideal - if it takes userspace daemon more than 60 seconds to connect > > IP Failover will still fail but I don't see a solution with our current > > separation between kernel and userspace parts. > > > > Other two modules (VSS and FCOPY) don't require such delay, leave them > > untouched. > > > > Signed-off-by: Vitaly Kuznetsov > > Signed-off-by: K. Y. Srinivasan > > --- > > drivers/hv/hv_kvp.c | 31 +++ > > drivers/hv/hyperv_vmbus.h |5 + > > 2 files changed, 36 insertions(+), 0 deletions(-) > > This series doesn't apply to my tree :( Looks like you have already applied most of the patches in this series. I will resend what is not applied. Thanks, K. Y ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover
On Sat, Apr 30, 2016 at 09:43:09PM +, KY Srinivasan wrote: > > > > -Original Message- > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > Sent: Saturday, April 30, 2016 2:05 PM > > To: KY Srinivasan > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > jasow...@redhat.com > > Subject: Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover > > > > On Tue, Apr 05, 2016 at 04:57:40PM -0700, K. Y. Srinivasan wrote: > > > From: Vitaly Kuznetsov > > > > > > Hyper-V VMs can be replicated to another hosts and there is a feature to > > > set different IP for replicas, it is called 'Failover TCP/IP'. When > > > such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as > > soon > > > as we finish negotiation procedure. The problem is that it can happen (and > > > it actually happens) before userspace daemon connects and we reply with > > > HV_E_FAIL to the message. As there are no repetitions we fail to set the > > > requested IP. > > > > > > Solve the issue by postponing our reply to the negotiation message till > > > userspace daemon is connected. We can't wait too long as there is a > > > host-side timeout (cca. 75 seconds) and if we fail to reply in this time > > > frame the whole KVP service will become inactive. The solution is not > > > ideal - if it takes userspace daemon more than 60 seconds to connect > > > IP Failover will still fail but I don't see a solution with our current > > > separation between kernel and userspace parts. > > > > > > Other two modules (VSS and FCOPY) don't require such delay, leave them > > > untouched. > > > > > > Signed-off-by: Vitaly Kuznetsov > > > Signed-off-by: K. Y. Srinivasan > > > --- > > > drivers/hv/hv_kvp.c | 31 +++ > > > drivers/hv/hyperv_vmbus.h |5 + > > > 2 files changed, 36 insertions(+), 0 deletions(-) > > > > This series doesn't apply to my tree :( > > Looks like you have already applied most of the patches in this series. I > will resend what is not applied. If this was a "resend", why didn't it show that in the patch description? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover
> -Original Message- > From: Greg KH [mailto:gre...@linuxfoundation.org] > Sent: Saturday, April 30, 2016 2:54 PM > To: KY Srinivasan > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > jasow...@redhat.com > Subject: Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover > > On Sat, Apr 30, 2016 at 09:43:09PM +, KY Srinivasan wrote: > > > > > > > -Original Message- > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > Sent: Saturday, April 30, 2016 2:05 PM > > > To: KY Srinivasan > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > jasow...@redhat.com > > > Subject: Re: [PATCH 1/8] Drivers: hv: kvp: fix IP Failover > > > > > > On Tue, Apr 05, 2016 at 04:57:40PM -0700, K. Y. Srinivasan wrote: > > > > From: Vitaly Kuznetsov > > > > > > > > Hyper-V VMs can be replicated to another hosts and there is a feature > to > > > > set different IP for replicas, it is called 'Failover TCP/IP'. When > > > > such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message > as > > > soon > > > > as we finish negotiation procedure. The problem is that it can happen > (and > > > > it actually happens) before userspace daemon connects and we reply > with > > > > HV_E_FAIL to the message. As there are no repetitions we fail to set > the > > > > requested IP. > > > > > > > > Solve the issue by postponing our reply to the negotiation message till > > > > userspace daemon is connected. We can't wait too long as there is a > > > > host-side timeout (cca. 75 seconds) and if we fail to reply in this time > > > > frame the whole KVP service will become inactive. The solution is not > > > > ideal - if it takes userspace daemon more than 60 seconds to connect > > > > IP Failover will still fail but I don't see a solution with our current > > > > separation between kernel and userspace parts. > > > > > > > > Other two modules (VSS and FCOPY) don't require such delay, leave > them > > > > untouched. > > > > > > > > Signed-off-by: Vitaly Kuznetsov > > > > Signed-off-by: K. Y. Srinivasan > > > > --- > > > > drivers/hv/hv_kvp.c | 31 +++ > > > > drivers/hv/hyperv_vmbus.h |5 + > > > > 2 files changed, 36 insertions(+), 0 deletions(-) > > > > > > This series doesn't apply to my tree :( > > > > Looks like you have already applied most of the patches in this series. I > > will > resend what is not applied. > > If this was a "resend", why didn't it show that in the patch > description? My fault; sorry for the confusion. Greg, I am going to resend all the patches yet to be committed with the right "resend" tag. Regards, K. Y ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND 0/5] Drivers: hv: Some miscellaneous fixes
Some miscellaneous fixes. All these patches are being resent. Vitaly Kuznetsov (5): Drivers: hv: kvp: fix IP Failover Drivers: hv: vmbus: handle various crash scenarios Drivers: hv: balloon: don't crash when memory is added in non-sorted order Drivers: hv: balloon: reset host_specified_ha_region tools: hv: lsvmbus: add pci pass-through UUID drivers/hv/channel_mgmt.c | 58 +--- drivers/hv/hv_balloon.c |5 ++- drivers/hv/hv_kvp.c | 31 drivers/hv/hyperv_vmbus.h | 21 ++- drivers/hv/vmbus_drv.c|7 +++-- tools/hv/lsvmbus |1 + 6 files changed, 101 insertions(+), 22 deletions(-) -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND 4/5] Drivers: hv: balloon: reset host_specified_ha_region
From: Vitaly Kuznetsov We set host_specified_ha_region = true on certain request but this is a global state which stays 'true' forever. We need to reset it when we receive a request where ha_region is not specified. I did not see any real issues, the bug was found by code inspection. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_balloon.c |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index 43af913..df35fb7 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -1400,6 +1400,7 @@ static void balloon_onchannelcallback(void *context) * This is a normal hot-add request specifying * hot-add memory. */ + dm->host_specified_ha_region = false; ha_pg_range = &ha_msg->range; dm->ha_wrk.ha_page_range = *ha_pg_range; dm->ha_wrk.ha_region_range.page_range = 0; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND 5/5] tools: hv: lsvmbus: add pci pass-through UUID
From: Vitaly Kuznetsov lsvmbus keeps its own copy of all VMBus UUIDs, add PCIe pass-through device there to not report 'Unknown' for such devices. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- tools/hv/lsvmbus |1 + 1 files changed, 1 insertions(+), 0 deletions(-) diff --git a/tools/hv/lsvmbus b/tools/hv/lsvmbus index 162a378..e8fecd6 100644 --- a/tools/hv/lsvmbus +++ b/tools/hv/lsvmbus @@ -35,6 +35,7 @@ vmbus_dev_dict = { '{ba6163d9-04a1-4d29-b605-72e2ffb1dc7f}' : 'Synthetic SCSI Controller', '{2f9bcc4a-0069-4af3-b76b-6fd0be528cda}' : 'Synthetic fiber channel adapter', '{8c2eaf3d-32a7-4b09-ab99-bd1f1c86b501}' : 'Synthetic RDMA adapter', + '{44c4f61d--4400-9d52-802e27ede19f}' : 'PCI Express pass-through', '{276aacf4-ac15-426c-98dd-7521ad3f01fe}' : '[Reserved system device]', '{f8e65716-3cb3-4a06-9a60-1889c5cccab5}' : '[Reserved system device]', '{3375baf4-9e15-4b30-b765-67acb10d607b}' : '[Reserved system device]', -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND 2/5] Drivers: hv: vmbus: handle various crash scenarios
From: Vitaly Kuznetsov Kdump keeps biting. Turns out CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was used for initial contact or to CPU0 depending on host version. vmbus_wait_for_unload() doesn't account for the fact that in case we're crashing on some other CPU we won't get the CHANNELMSG_UNLOAD_RESPONSE message and our wait on the current CPU will never end. Do the following: 1) Check for completion_done() in the loop. In case interrupt handler is still alive we'll get the confirmation we need. 2) Read message pages for all CPUs message page as we're unsure where CHANNELMSG_UNLOAD_RESPONSE is going to be delivered to. We can race with still-alive interrupt handler doing the same, add cmpxchg() to vmbus_signal_eom() to not lose CHANNELMSG_UNLOAD_RESPONSE message. 3) Cleanup message pages on all CPUs. This is required (at least for the current CPU as we're clearing CPU0 messages now but we may want to bring up additional CPUs on crash) as new messages won't be delivered till we consume what's pending. On boot we'll place message pages somewhere else and we won't be able to read stale messages. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/channel_mgmt.c | 58 +--- drivers/hv/hyperv_vmbus.h | 16 +++- drivers/hv/vmbus_drv.c|7 +++-- 3 files changed, 61 insertions(+), 20 deletions(-) diff --git a/drivers/hv/channel_mgmt.c b/drivers/hv/channel_mgmt.c index 38b682ba..b6c1211 100644 --- a/drivers/hv/channel_mgmt.c +++ b/drivers/hv/channel_mgmt.c @@ -597,27 +597,55 @@ static void init_vp_index(struct vmbus_channel *channel, u16 dev_type) static void vmbus_wait_for_unload(void) { - int cpu = smp_processor_id(); - void *page_addr = hv_context.synic_message_page[cpu]; - struct hv_message *msg = (struct hv_message *)page_addr + - VMBUS_MESSAGE_SINT; + int cpu; + void *page_addr; + struct hv_message *msg; struct vmbus_channel_message_header *hdr; - bool unloaded = false; + u32 message_type; + /* +* CHANNELMSG_UNLOAD_RESPONSE is always delivered to the CPU which was +* used for initial contact or to CPU0 depending on host version. When +* we're crashing on a different CPU let's hope that IRQ handler on +* the cpu which receives CHANNELMSG_UNLOAD_RESPONSE is still +* functional and vmbus_unload_response() will complete +* vmbus_connection.unload_event. If not, the last thing we can do is +* read message pages for all CPUs directly. +*/ while (1) { - if (READ_ONCE(msg->header.message_type) == HVMSG_NONE) { - mdelay(10); - continue; - } + if (completion_done(&vmbus_connection.unload_event)) + break; - hdr = (struct vmbus_channel_message_header *)msg->u.payload; - if (hdr->msgtype == CHANNELMSG_UNLOAD_RESPONSE) - unloaded = true; + for_each_online_cpu(cpu) { + page_addr = hv_context.synic_message_page[cpu]; + msg = (struct hv_message *)page_addr + + VMBUS_MESSAGE_SINT; - vmbus_signal_eom(msg); + message_type = READ_ONCE(msg->header.message_type); + if (message_type == HVMSG_NONE) + continue; - if (unloaded) - break; + hdr = (struct vmbus_channel_message_header *) + msg->u.payload; + + if (hdr->msgtype == CHANNELMSG_UNLOAD_RESPONSE) + complete(&vmbus_connection.unload_event); + + vmbus_signal_eom(msg, message_type); + } + + mdelay(10); + } + + /* +* We're crashing and already got the UNLOAD_RESPONSE, cleanup all +* maybe-pending messages on all CPUs to be able to receive new +* messages after we reconnect. +*/ + for_each_online_cpu(cpu) { + page_addr = hv_context.synic_message_page[cpu]; + msg = (struct hv_message *)page_addr + VMBUS_MESSAGE_SINT; + msg->header.message_type = HVMSG_NONE; } } diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index e5203e4..718b5c7 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -625,9 +625,21 @@ extern struct vmbus_channel_message_table_entry channel_message_table[CHANNELMSG_COUNT]; /* Free the message slot and signal end-of-message if required */ -static inline void vmbus_signal_eom(struct hv_message *msg) +static inline void vmbus_signal_eom(struct hv_message *msg, u32 old_msg_type) { - msg->he
[PATCH RESEND 3/5] Drivers: hv: balloon: don't crash when memory is added in non-sorted order
From: Vitaly Kuznetsov When we iterate through all HA regions in handle_pg_range() we have an assumption that all these regions are sorted in the list and the 'start_pfn >= has->end_pfn' check is enough to find the proper region. Unfortunately it's not the case with WS2016 where host can hot-add regions in a different order. We end up modifying the wrong HA region and crashing later on pages online. Modify the check to make sure we found the region we were searching for while iterating. Fix the same check in pfn_covered() as well. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_balloon.c |4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hv/hv_balloon.c b/drivers/hv/hv_balloon.c index b853b4b..43af913 100644 --- a/drivers/hv/hv_balloon.c +++ b/drivers/hv/hv_balloon.c @@ -714,7 +714,7 @@ static bool pfn_covered(unsigned long start_pfn, unsigned long pfn_cnt) * If the pfn range we are dealing with is not in the current * "hot add block", move on. */ - if ((start_pfn >= has->end_pfn)) + if (start_pfn < has->start_pfn || start_pfn >= has->end_pfn) continue; /* * If the current hot add-request extends beyond @@ -768,7 +768,7 @@ static unsigned long handle_pg_range(unsigned long pg_start, * If the pfn range we are dealing with is not in the current * "hot add block", move on. */ - if ((start_pfn >= has->end_pfn)) + if (start_pfn < has->start_pfn || start_pfn >= has->end_pfn) continue; old_covered_state = has->covered_end_pfn; -- 1.7.4.1 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH RESEND 1/5] Drivers: hv: kvp: fix IP Failover
From: Vitaly Kuznetsov Hyper-V VMs can be replicated to another hosts and there is a feature to set different IP for replicas, it is called 'Failover TCP/IP'. When such guest starts Hyper-V host sends it KVP_OP_SET_IP_INFO message as soon as we finish negotiation procedure. The problem is that it can happen (and it actually happens) before userspace daemon connects and we reply with HV_E_FAIL to the message. As there are no repetitions we fail to set the requested IP. Solve the issue by postponing our reply to the negotiation message till userspace daemon is connected. We can't wait too long as there is a host-side timeout (cca. 75 seconds) and if we fail to reply in this time frame the whole KVP service will become inactive. The solution is not ideal - if it takes userspace daemon more than 60 seconds to connect IP Failover will still fail but I don't see a solution with our current separation between kernel and userspace parts. Other two modules (VSS and FCOPY) don't require such delay, leave them untouched. Signed-off-by: Vitaly Kuznetsov Signed-off-by: K. Y. Srinivasan --- drivers/hv/hv_kvp.c | 31 +++ drivers/hv/hyperv_vmbus.h |5 + 2 files changed, 36 insertions(+), 0 deletions(-) diff --git a/drivers/hv/hv_kvp.c b/drivers/hv/hv_kvp.c index 9b9b370..cb1a916 100644 --- a/drivers/hv/hv_kvp.c +++ b/drivers/hv/hv_kvp.c @@ -78,9 +78,11 @@ static void kvp_send_key(struct work_struct *dummy); static void kvp_respond_to_host(struct hv_kvp_msg *msg, int error); static void kvp_timeout_func(struct work_struct *dummy); +static void kvp_host_handshake_func(struct work_struct *dummy); static void kvp_register(int); static DECLARE_DELAYED_WORK(kvp_timeout_work, kvp_timeout_func); +static DECLARE_DELAYED_WORK(kvp_host_handshake_work, kvp_host_handshake_func); static DECLARE_WORK(kvp_sendkey_work, kvp_send_key); static const char kvp_devname[] = "vmbus/hv_kvp"; @@ -130,6 +132,11 @@ static void kvp_timeout_func(struct work_struct *dummy) hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper); } +static void kvp_host_handshake_func(struct work_struct *dummy) +{ + hv_poll_channel(kvp_transaction.recv_channel, hv_kvp_onchannelcallback); +} + static int kvp_handle_handshake(struct hv_kvp_msg *msg) { switch (msg->kvp_hdr.operation) { @@ -154,6 +161,12 @@ static int kvp_handle_handshake(struct hv_kvp_msg *msg) pr_debug("KVP: userspace daemon ver. %d registered\n", KVP_OP_REGISTER); kvp_register(dm_reg_value); + + /* +* If we're still negotiating with the host cancel the timeout +* work to not poll the channel twice. +*/ + cancel_delayed_work_sync(&kvp_host_handshake_work); hv_poll_channel(kvp_transaction.recv_channel, kvp_poll_wrapper); return 0; @@ -594,7 +607,22 @@ void hv_kvp_onchannelcallback(void *context) struct icmsg_negotiate *negop = NULL; int util_fw_version; int kvp_srv_version; + static enum {NEGO_NOT_STARTED, +NEGO_IN_PROGRESS, +NEGO_FINISHED} host_negotiatied = NEGO_NOT_STARTED; + if (host_negotiatied == NEGO_NOT_STARTED && + kvp_transaction.state < HVUTIL_READY) { + /* +* If userspace daemon is not connected and host is asking +* us to negotiate we need to delay to not lose messages. +* This is important for Failover IP setting. +*/ + host_negotiatied = NEGO_IN_PROGRESS; + schedule_delayed_work(&kvp_host_handshake_work, + HV_UTIL_NEGO_TIMEOUT * HZ); + return; + } if (kvp_transaction.state > HVUTIL_READY) return; @@ -672,6 +700,8 @@ void hv_kvp_onchannelcallback(void *context) vmbus_sendpacket(channel, recv_buffer, recvlen, requestid, VM_PKT_DATA_INBAND, 0); + + host_negotiatied = NEGO_FINISHED; } } @@ -708,6 +738,7 @@ hv_kvp_init(struct hv_util_service *srv) void hv_kvp_deinit(void) { kvp_transaction.state = HVUTIL_DEVICE_DYING; + cancel_delayed_work_sync(&kvp_host_handshake_work); cancel_delayed_work_sync(&kvp_timeout_work); cancel_work_sync(&kvp_sendkey_work); hvutil_transport_destroy(hvt); diff --git a/drivers/hv/hyperv_vmbus.h b/drivers/hv/hyperv_vmbus.h index e5c586f..e5203e4 100644 --- a/drivers/hv/hyperv_vmbus.h +++ b/drivers/hv/hyperv_vmbus.h @@ -36,6 +36,11 @@ #define HV_UTIL_TIMEOUT 30 /* + * Timeout for guest-host handshake for services. + */ +#define HV_UTIL_NEGO_TIMEOUT 60 + +/* * The below CPUID leaves are present if VersionAndFeatures.HypervisorPresent * is set by CPUID(HVCPUID_VERSION_FEATURES). */ -- 1.7.4.1 ___ devel mailing