[PATCH] staging: ccree: Fix indentation of driver_hash[] initializers
Closing braces should match the first characters of the openings. Signed-off-by: Geert Uytterhoeven --- v2: - Rebased against current linus/master. --- drivers/staging/ccree/ssi_hash.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/ccree/ssi_hash.c b/drivers/staging/ccree/ssi_hash.c index f99d4219b01eaf18..4401ce251a4a5623 100644 --- a/drivers/staging/ccree/ssi_hash.c +++ b/drivers/staging/ccree/ssi_hash.c @@ -2002,8 +2002,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA1_DIGEST_SIZE, .statesize = sizeof(struct sha1_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA1, .hw_mode = DRV_HASH_HW_SHA1, @@ -2031,8 +2031,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA256_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA256, .hw_mode = DRV_HASH_HW_SHA256, @@ -2060,8 +2060,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA224_DIGEST_SIZE, .statesize = sizeof(struct sha256_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA224, .hw_mode = DRV_HASH_HW_SHA256, @@ -2090,8 +2090,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA384_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA384, .hw_mode = DRV_HASH_HW_SHA512, @@ -2119,8 +2119,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = SHA512_DIGEST_SIZE, .statesize = sizeof(struct sha512_state), - }, }, + }, }, .hash_mode = DRV_HASH_SHA512, .hw_mode = DRV_HASH_HW_SHA512, @@ -2149,8 +2149,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = MD5_DIGEST_SIZE, .statesize = sizeof(struct md5_state), - }, }, + }, }, .hash_mode = DRV_HASH_MD5, .hw_mode = DRV_HASH_HW_MD5, @@ -2176,8 +2176,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize = sizeof(struct aeshash_state), - }, }, + }, }, .hash_mode = DRV_HASH_NULL, .hw_mode = DRV_CIPHER_XCBC_MAC, @@ -2204,8 +2204,8 @@ static struct ssi_hash_template driver_hash[] = { .halg = { .digestsize = AES_BLOCK_SIZE, .statesize = sizeof(struct aeshash_state), - }, }, + }, }, .hash_mode = DRV_HASH_NULL, .hw_mode = DRV_CIPHER_CMAC, -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [patch 1/1] staging: speakup: flush tty buffers and ensure hardware flow control
Hi Alan, On Wed, May 10, 2017 at 08:41:51PM +0100, Alan Cox wrote: > > + if (!(tmp_termios.c_cflag & CRTSCTS)) { > > + tmp_termios.c_cflag |= CRTSCTS; > > + ret = tty_set_termios(tty, &tmp_termios); > > + if (ret) > > + pr_warn("speakup: Failed to set hardware flow > > control\n"); > > You should check the tty c_cflag after the call rather than rely on an > error code. Strictly speaking tty_set_termios should error if no tty bits > are changed by the request but it never has on Linux. Instead check the > tty gave you the result you wanted. Thanks. I will replace the check for return value with check for c_cflag. May be we should fix this in tty_set_termios? ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] Staging: lustre: lnet: incorrect type in assignement fix
Fixed incorrect type in assignment warning found by sparse by changing the type of a local variable Signed-off-by: Sergiy Redko --- drivers/staging/lustre/lnet/lnet/lib-socket.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/lustre/lnet/lnet/lib-socket.c b/drivers/staging/lustre/lnet/lnet/lib-socket.c index 9fca8d225ee0..776f3c2fa486 100644 --- a/drivers/staging/lustre/lnet/lnet/lib-socket.c +++ b/drivers/staging/lustre/lnet/lnet/lib-socket.c @@ -89,7 +89,7 @@ lnet_ipif_query(char *name, int *up, __u32 *ip, __u32 *mask) struct ifreq ifr; int nob; int rc; - __u32 val; + __be32 val; nob = strnlen(name, IFNAMSIZ); if (nob == IFNAMSIZ) { -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: ccree: remove unused function argument
"gcc -Wunused" warns about one argument being assigned but not used: drivers/staging/ccree/ssi_cipher.c: In function 'ssi_blkcipher_complete': drivers/staging/ccree/ssi_cipher.c:747:41: error: parameter 'info' set but not used [-Werror=unused-but-set-parameter] We can simply drop that argument here and in its callers. Fixes: 302ef8ebb4b2 ("staging: ccree: add skcipher support") Signed-off-by: Arnd Bergmann --- drivers/staging/ccree/ssi_cipher.c | 6 ++ 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/staging/ccree/ssi_cipher.c b/drivers/staging/ccree/ssi_cipher.c index 664ed7e52cf2..d114cd07e729 100644 --- a/drivers/staging/ccree/ssi_cipher.c +++ b/drivers/staging/ccree/ssi_cipher.c @@ -744,7 +744,6 @@ static int ssi_blkcipher_complete(struct device *dev, struct ssi_ablkcipher_ctx *ctx_p, struct blkcipher_req_ctx *req_ctx, struct scatterlist *dst, struct scatterlist *src, - void *info, //req info unsigned int ivsize, void *areq, void __iomem *cc_base) @@ -755,7 +754,6 @@ static int ssi_blkcipher_complete(struct device *dev, START_CYCLE_COUNT(); ssi_buffer_mgr_unmap_blkcipher_request(dev, req_ctx, ivsize, src, dst); - info = req_ctx->backup_info; END_CYCLE_COUNT(STAT_OP_TYPE_GENERIC, STAT_PHASE_4); @@ -895,7 +893,7 @@ static int ssi_blkcipher_process( END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); } else { END_CYCLE_COUNT(ssi_req.op_type, STAT_PHASE_3); - rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, src, info, ivsize, NULL, ctx_p->drvdata->cc_base); + rc = ssi_blkcipher_complete(dev, ctx_p, req_ctx, dst, src, ivsize, NULL, ctx_p->drvdata->cc_base); } } @@ -916,7 +914,7 @@ static void ssi_ablkcipher_complete(struct device *dev, void *ssi_req, void __io CHECK_AND_RETURN_VOID_UPON_FIPS_ERROR(); - ssi_blkcipher_complete(dev, ctx_p, req_ctx, areq->dst, areq->src, areq->info, ivsize, areq, cc_base); + ssi_blkcipher_complete(dev, ctx_p, req_ctx, areq->dst, areq->src, ivsize, areq, cc_base); } -- 2.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [patch 1/1] staging: speakup: flush tty buffers and ensure hardware flow control
On Thu, 11 May 2017 09:29:14 +0100 Okash Khawaja wrote: > Hi Alan, > > On Wed, May 10, 2017 at 08:41:51PM +0100, Alan Cox wrote: > > > + if (!(tmp_termios.c_cflag & CRTSCTS)) { > > > + tmp_termios.c_cflag |= CRTSCTS; > > > + ret = tty_set_termios(tty, &tmp_termios); > > > + if (ret) > > > + pr_warn("speakup: Failed to set hardware flow > > > control\n"); > > > > You should check the tty c_cflag after the call rather than rely on an > > error code. Strictly speaking tty_set_termios should error if no tty bits > > are changed by the request but it never has on Linux. Instead check the > > tty gave you the result you wanted. > Thanks. I will replace the check for return value with check for c_cflag. > > May be we should fix this in tty_set_termios? Possibly. It however changes the external kernel ABI. It's also not a simple memcmp because any undefined bits must be ignored. Make a patch, try it and see what breaks ? If nothing breaks then yes it makes sense IMHO too. Alan ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: typec: fusb302: do not free gpio from managed resource
When allocating a gpio using the managed resource devm_, we can avoid freeing it manually. But even if we did it we should use devm_gpio_free. So, just remove the free of the gpio in the error path. Signed-off-by: Rui Miguel Silva --- drivers/staging/typec/fusb302/fusb302.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 2cee9a952c9b..65df6407db84 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -1663,14 +1663,12 @@ static int init_gpio(struct fusb302_chip *chip) if (ret < 0) { fusb302_log(chip, "cannot set GPIO Int_N to input, ret=%d", ret); - gpio_free(chip->gpio_int_n); return ret; } ret = gpio_to_irq(chip->gpio_int_n); if (ret < 0) { fusb302_log(chip, "cannot request IRQ for GPIO Int_N, ret=%d", ret); - gpio_free(chip->gpio_int_n); return ret; } chip->gpio_int_n_irq = ret; -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging: typec: fusb302: some fixes and cleanups
This series fixes some bugs in the error paths and do some refactoring in the logging and the resume retry mechanism. No new functionality is added and I do *not* have the hw to test it. So, if you have the hw give it a try. Cheers, Rui Rui Miguel Silva (4): staging: typec: fusb302: do not free gpio from managed resource staging: typec: fusb302: cleanup logging and error messages staging: typec: fusb302: refactor resume retry mechanism staging: typec: fusb302: reset i2c_busy state in error path drivers/staging/typec/fusb302/fusb302.c | 481 +++- 1 file changed, 161 insertions(+), 320 deletions(-) -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: typec: fusb302: cleanup logging and error messages
This driver was using debugfs as a logging mechanism instead of the normal dev_* helpers. This patch changes this and move all calls to fusb302_log function to the correspondent dev_{err,dbg,info}. Since the debugfs interface was only used for logging, with this patch it became unused, so just remove it. Signed-off-by: Rui Miguel Silva --- drivers/staging/typec/fusb302/fusb302.c | 425 ++-- 1 file changed, 132 insertions(+), 293 deletions(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 65df6407db84..40842b8075e5 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -14,7 +14,6 @@ * Fairchild FUSB302 Type-C Chip Driver */ -#include #include #include #include @@ -82,9 +81,6 @@ static const u8 rd_mda_value[] = { [SRC_CURRENT_HIGH] = 61,/* 2604mV */ }; -#define LOG_BUFFER_ENTRIES 1024 -#define LOG_BUFFER_ENTRY_SIZE 128 - struct fusb302_chip { struct device *dev; struct i2c_client *i2c_client; @@ -121,146 +117,8 @@ struct fusb302_chip { enum typec_cc_polarity cc_polarity; enum typec_cc_status cc1; enum typec_cc_status cc2; - -#ifdef CONFIG_DEBUG_FS - struct dentry *dentry; - /* lock for log buffer access */ - struct mutex logbuffer_lock; - int logbuffer_head; - int logbuffer_tail; - u8 *logbuffer[LOG_BUFFER_ENTRIES]; -#endif -}; - -/* - * Logging - */ - -#ifdef CONFIG_DEBUG_FS - -static bool fusb302_log_full(struct fusb302_chip *chip) -{ - return chip->logbuffer_tail == - (chip->logbuffer_head + 1) % LOG_BUFFER_ENTRIES; -} - -static void _fusb302_log(struct fusb302_chip *chip, const char *fmt, -va_list args) -{ - char tmpbuffer[LOG_BUFFER_ENTRY_SIZE]; - u64 ts_nsec = local_clock(); - unsigned long rem_nsec; - - if (!chip->logbuffer[chip->logbuffer_head]) { - chip->logbuffer[chip->logbuffer_head] = - kzalloc(LOG_BUFFER_ENTRY_SIZE, GFP_KERNEL); - if (!chip->logbuffer[chip->logbuffer_head]) - return; - } - - vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args); - - mutex_lock(&chip->logbuffer_lock); - - if (fusb302_log_full(chip)) { - chip->logbuffer_head = max(chip->logbuffer_head - 1, 0); - strlcpy(tmpbuffer, "overflow", sizeof(tmpbuffer)); - } - - if (chip->logbuffer_head < 0 || - chip->logbuffer_head >= LOG_BUFFER_ENTRIES) { - dev_warn(chip->dev, -"Bad log buffer index %d\n", chip->logbuffer_head); - goto abort; - } - - if (!chip->logbuffer[chip->logbuffer_head]) { - dev_warn(chip->dev, -"Log buffer index %d is NULL\n", chip->logbuffer_head); - goto abort; - } - - rem_nsec = do_div(ts_nsec, 10); - scnprintf(chip->logbuffer[chip->logbuffer_head], - LOG_BUFFER_ENTRY_SIZE, "[%5lu.%06lu] %s", - (unsigned long)ts_nsec, rem_nsec / 1000, - tmpbuffer); - chip->logbuffer_head = (chip->logbuffer_head + 1) % LOG_BUFFER_ENTRIES; - -abort: - mutex_unlock(&chip->logbuffer_lock); -} - -static void fusb302_log(struct fusb302_chip *chip, const char *fmt, ...) -{ - va_list args; - - va_start(args, fmt); - _fusb302_log(chip, fmt, args); - va_end(args); -} - -static int fusb302_seq_show(struct seq_file *s, void *v) -{ - struct fusb302_chip *chip = (struct fusb302_chip *)s->private; - int tail; - - mutex_lock(&chip->logbuffer_lock); - tail = chip->logbuffer_tail; - while (tail != chip->logbuffer_head) { - seq_printf(s, "%s\n", chip->logbuffer[tail]); - tail = (tail + 1) % LOG_BUFFER_ENTRIES; - } - if (!seq_has_overflowed(s)) - chip->logbuffer_tail = tail; - mutex_unlock(&chip->logbuffer_lock); - - return 0; -} - -static int fusb302_debug_open(struct inode *inode, struct file *file) -{ - return single_open(file, fusb302_seq_show, inode->i_private); -} - -static const struct file_operations fusb302_debug_operations = { - .open = fusb302_debug_open, - .llseek = seq_lseek, - .read = seq_read, - .release= single_release, }; -static struct dentry *rootdir; - -static int fusb302_debugfs_init(struct fusb302_chip *chip) -{ - mutex_init(&chip->logbuffer_lock); - if (!rootdir) { - rootdir = debugfs_create_dir("fusb302", NULL); - if (!rootdir) - return -ENOMEM; - } - - chip->dentry = debugfs_create_file(dev_name(chip->dev), - S_IFREG | 0444, rootdir, -
[PATCH 3/4] staging: typec: fusb302: refactor resume retry mechanism
The i2c functions need to test the pm_suspend state and do, if needed, some retry before i2c operations. This code was repeated 4x. The isolate this create a new function to check suspend state and call it in every need place. Signed-off-by: Rui Miguel Silva --- drivers/staging/typec/fusb302/fusb302.c | 66 + 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 40842b8075e5..26d7e2a387c3 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -122,22 +122,36 @@ struct fusb302_chip { #define FUSB302_RESUME_RETRY 10 #define FUSB302_RESUME_RETRY_SLEEP 50 -static int fusb302_i2c_write(struct fusb302_chip *chip, -u8 address, u8 data) + +static bool fusb302_is_suspended(struct fusb302_chip *chip) { int retry_cnt; - int ret = 0; - atomic_set(&chip->i2c_busy, 1); for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { if (atomic_read(&chip->pm_suspend)) { dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", retry_cnt + 1, FUSB302_RESUME_RETRY); msleep(FUSB302_RESUME_RETRY_SLEEP); } else { - break; + return false; } } + + return true; +} + +static int fusb302_i2c_write(struct fusb302_chip *chip, +u8 address, u8 data) +{ + int ret = 0; + + atomic_set(&chip->i2c_busy, 1); + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; + } + ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); if (ret < 0) dev_err(chip->dev, "cannot write 0x%02x to 0x%02x: %d\n", data, @@ -150,21 +164,17 @@ static int fusb302_i2c_write(struct fusb302_chip *chip, static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, u8 length, const u8 *data) { - int retry_cnt; int ret = 0; if (length <= 0) return ret; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -retry_cnt + 1, FUSB302_RESUME_RETRY); - msleep(FUSB302_RESUME_RETRY_SLEEP); - } else { - break; - } + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; } + ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, length, data); if (ret < 0) @@ -178,19 +188,15 @@ static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, static int fusb302_i2c_read(struct fusb302_chip *chip, u8 address, u8 *data) { - int retry_cnt; int ret = 0; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -retry_cnt + 1, FUSB302_RESUME_RETRY); - msleep(FUSB302_RESUME_RETRY_SLEEP); - } else { - break; - } + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; } + ret = i2c_smbus_read_byte_data(chip->i2c_client, address); *data = (u8)ret; if (ret < 0) @@ -203,21 +209,17 @@ static int fusb302_i2c_read(struct fusb302_chip *chip, static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, u8 length, u8 *data) { - int retry_cnt; int ret = 0; if (length <= 0) return ret; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -retry_cnt + 1, FUSB302_RESUME_RETRY); - msleep(FUSB302_RESUME_RETRY_SLEEP); - } else { - break; - } + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; } + ret = i2c_smbus_read_i2c_block_data(chip->i2c_client, address,
[PATCH 4/4] staging: typec: fusb302: reset i2c_busy state in error path
Fix reset of i2c_busy flag if an error occurs during the i2c block read. Signed-off-by: Rui Miguel Silva --- drivers/staging/typec/fusb302/fusb302.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 26d7e2a387c3..b9dfd60ebab8 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -225,13 +225,15 @@ static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, if (ret < 0) { dev_err(chip->dev, "cannot block read 0x%02x, len=%d: %d\n", address, length, ret); - return ret; + goto done; } if (ret != length) { dev_err(chip->dev, "only read %d/%d bytes from 0x%02x\n", ret, length, address); - return -EIO; + ret = -EIO; } + +done: atomic_set(&chip->i2c_busy, 0); return ret; -- 2.12.2 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: rtl8188eu: Put constant on right side of comparison
Constants should be on the right side of comparisons. Issue found by checkpatch.pl script. Signed-off-by: Aviv Palivoda --- drivers/staging/rtl8188eu/hal/phy.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/rtl8188eu/hal/phy.c b/drivers/staging/rtl8188eu/hal/phy.c index 054f599..3039bbe 100644 --- a/drivers/staging/rtl8188eu/hal/phy.c +++ b/drivers/staging/rtl8188eu/hal/phy.c @@ -1091,7 +1091,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], } } - if (0x00 == path_a_ok) { + if (path_a_ok == 0x00) { ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path A IQK failed!!\n")); } @@ -1122,7 +1122,7 @@ static void phy_iq_calibrate(struct adapter *adapt, s32 result[][8], } } - if (0x00 == path_b_ok) { + if (path_b_ok == 0x00) { ODM_RT_TRACE(dm_odm, ODM_COMP_CALIBRATION, ODM_DBG_LOUD, ("Path B IQK failed!!\n")); } -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] VMBus: Adjustments for some function implementations
From: Markus Elfring Date: Thu, 11 May 2017 18:00:18 +0200 A few update suggestions were taken into account from static source code analysis. Markus Elfring (4): Improve a size determination in vmbus_device_create() Delete an error message for a failed memory allocation in vmbus_device_create() Fix a typo in a comment line Adjust five checks for null pointers drivers/hv/vmbus_drv.c | 18 -- 1 file changed, 8 insertions(+), 10 deletions(-) -- 2.12.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create()
From: Markus Elfring Date: Thu, 11 May 2017 17:30:10 +0200 Replace the specification of a data structure by a pointer dereference as the parameter for the operator "sizeof" to make the corresponding size determination a bit safer according to the Linux coding style convention. Signed-off-by: Markus Elfring --- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 0087b49095eb..6802d74f162c 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1145,5 +1145,5 @@ struct hv_device *vmbus_device_create(const uuid_le *type, { struct hv_device *child_device_obj; - child_device_obj = kzalloc(sizeof(struct hv_device), GFP_KERNEL); + child_device_obj = kzalloc(sizeof(*child_device_obj), GFP_KERNEL); if (!child_device_obj) { -- 2.12.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] vmbus: Delete an error message for a failed memory allocation in vmbus_device_create()
From: Markus Elfring Date: Thu, 11 May 2017 17:33:14 +0200 Omit an extra message for a memory allocation failure in this function. This issue was detected by using the Coccinelle software. Link: http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf Signed-off-by: Markus Elfring --- drivers/hv/vmbus_drv.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 6802d74f162c..96328aebae5a 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -1149,7 +1149,5 @@ struct hv_device *vmbus_device_create(const uuid_le *type, - if (!child_device_obj) { - pr_err("Unable to allocate device object for child device\n"); + if (!child_device_obj) return NULL; - } child_device_obj->channel = channel; memcpy(&child_device_obj->dev_type, type, sizeof(uuid_le)); -- 2.12.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] vmbus: Fix a typo in a comment line
From: Markus Elfring Date: Thu, 11 May 2017 17:43:55 +0200 Add a missing character in this description. Signed-off-by: Markus Elfring --- drivers/hv/vmbus_drv.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index 96328aebae5a..ff94b111ed8d 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -991,7 +991,7 @@ static void vmbus_isr(void) /* * Our host is win8 or above. The signaling mechanism * has changed and we can directly look at the event page. -* If bit n is set then we have an interrup on the channel +* If bit n is set then we have an interrupt on the channel * whose id is n. */ handled = true; -- 2.12.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] vmbus: Adjust five checks for null pointers
From: Markus Elfring Date: Thu, 11 May 2017 17:52:38 +0200 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The script “checkpatch.pl” pointed information out like the following. Comparison to NULL could be written … Thus fix the affected source code places. Signed-off-by: Markus Elfring --- drivers/hv/vmbus_drv.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c index ff94b111ed8d..b55b979ecf8a 100644 --- a/drivers/hv/vmbus_drv.c +++ b/drivers/hv/vmbus_drv.c @@ -93,7 +93,7 @@ static DEFINE_SEMAPHORE(hyperv_mmio_lock); static int vmbus_exists(void) { - if (hv_acpi_dev == NULL) + if (!hv_acpi_dev) return -ENODEV; return 0; @@ -568,7 +568,7 @@ static const struct hv_vmbus_device_id *hv_vmbus_get_id(struct hv_driver *drv, return id; id = drv->id_table; - if (id == NULL) + if (!id) return NULL; /* empty device table */ for (; !is_null_guid(&id->guid); id++) @@ -871,7 +871,7 @@ void vmbus_on_msg_dpc(unsigned long data) entry = &channel_message_table[hdr->msgtype]; if (entry->handler_type == VMHT_BLOCKING) { ctx = kmalloc(sizeof(*ctx), GFP_ATOMIC); - if (ctx == NULL) + if (!ctx) return; INIT_WORK(&ctx->work, vmbus_onmessage_work); @@ -894,7 +894,7 @@ static void vmbus_channel_isr(struct vmbus_channel *channel) void (*callback_fn)(void *); callback_fn = READ_ONCE(channel->onchannel_callback); - if (likely(callback_fn != NULL)) + if (likely(callback_fn)) (*callback_fn)(channel->channel_callback_context); } @@ -970,7 +970,7 @@ static void vmbus_isr(void) union hv_synic_event_flags *event; bool handled = false; - if (unlikely(page_addr == NULL)) + if (unlikely(!page_addr)) return; event = (union hv_synic_event_flags *)page_addr + -- 2.12.3 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/4] vmbus: Delete an error message for a failed memory allocation in vmbus_device_create()
On Thu, 11 May 2017 18:17:01 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 11 May 2017 17:33:14 +0200 > > Omit an extra message for a memory allocation failure in this function. > > This issue was detected by using the Coccinelle software. > > Link: > http://events.linuxfoundation.org/sites/events/files/slides/LCJ16-Refactor_Strings-WSang_0.pdf > Signed-off-by: Markus Elfring > --- > drivers/hv/vmbus_drv.c | 4 +--- > 1 file changed, 1 insertion(+), 3 deletions(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index 6802d74f162c..96328aebae5a 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -1149,7 +1149,5 @@ struct hv_device *vmbus_device_create(const uuid_le > *type, > - if (!child_device_obj) { > - pr_err("Unable to allocate device object for child device\n"); > + if (!child_device_obj) > return NULL; > - } > > child_device_obj->channel = channel; > memcpy(&child_device_obj->dev_type, type, sizeof(uuid_le)); Taking out the message assumes that all callers of this function either log an error or pass appropriate error code back to userspace. Did you walk back through all the callers? Just because an automated tool says that this needs to change does not mean it has to. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create()
On Thu, 11 May 2017 18:15:46 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 11 May 2017 17:30:10 +0200 > > Replace the specification of a data structure by a pointer dereference > as the parameter for the operator "sizeof" to make the corresponding size > determination a bit safer according to the Linux coding style convention. > > Signed-off-by: Markus Elfring > --- > drivers/hv/vmbus_drv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index 0087b49095eb..6802d74f162c 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -1145,5 +1145,5 @@ struct hv_device *vmbus_device_create(const uuid_le > *type, > { > struct hv_device *child_device_obj; > > - child_device_obj = kzalloc(sizeof(struct hv_device), GFP_KERNEL); > + child_device_obj = kzalloc(sizeof(*child_device_obj), GFP_KERNEL); > if (!child_device_obj) { This looks fine. Acked-by: Stephen Hemminger ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] vmbus: Fix a typo in a comment line
On Thu, 11 May 2017 18:18:12 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 11 May 2017 17:43:55 +0200 > > Add a missing character in this description. > > Signed-off-by: Markus Elfring > --- > drivers/hv/vmbus_drv.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > index 96328aebae5a..ff94b111ed8d 100644 > --- a/drivers/hv/vmbus_drv.c > +++ b/drivers/hv/vmbus_drv.c > @@ -991,7 +991,7 @@ static void vmbus_isr(void) > /* >* Our host is win8 or above. The signaling mechanism >* has changed and we can directly look at the event page. > - * If bit n is set then we have an interrup on the channel > + * If bit n is set then we have an interrupt on the channel >* whose id is n. >*/ > handled = true; Acked-by: Stephen Hemminger ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] vmbus: Adjust five checks for null pointers
On Thu, 11 May 2017 18:19:21 +0200 SF Markus Elfring wrote: > From: Markus Elfring > Date: Thu, 11 May 2017 17:52:38 +0200 > MIME-Version: 1.0 > Content-Type: text/plain; charset=UTF-8 > Content-Transfer-Encoding: 8bit > > The script “checkpatch.pl” pointed information out like the following. > > Comparison to NULL could be written … > > Thus fix the affected source code places. > > Signed-off-by: Markus Elfring Please don't do these kind of checkpatch "fix ups" on existing code. The comparison with NULL is fine, doing this is just useless churn. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: vmbus: Delete an error message for a failed memory allocation in vmbus_device_create()
> Taking out the message assumes that all callers of this function either log an > error or pass appropriate error code back to userspace. Do you like the default error response by Linux memory allocation functions? Regards, Markus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: vmbus: Delete an error message for a failed memory allocation in vmbus_device_create()
On Thu, 11 May 2017 18:36:44 +0200 SF Markus Elfring wrote: > > Taking out the message assumes that all callers of this function either log > > an > > error or pass appropriate error code back to userspace. > > Do you like the default error response by Linux memory allocation functions? The default error message only helps a little. I doubt this will ever fail anyway since only allocated on boot. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/4] staging: typec: fusb302: cleanup logging and error messages
On Thu, May 11, 2017 at 03:20:21PM +0100, Rui Miguel Silva wrote: > This driver was using debugfs as a logging mechanism instead of the normal > dev_* > helpers. This patch changes this and move all calls to fusb302_log function to > the correspondent dev_{err,dbg,info}. > > Since the debugfs interface was only used for logging, with this patch it > became > unused, so just remove it. > > Signed-off-by: Rui Miguel Silva Nack, sorry. This doesn't work; we tried it. Console logging affects timing, making the driver unusable. Guenter > --- > drivers/staging/typec/fusb302/fusb302.c | 425 > ++-- > 1 file changed, 132 insertions(+), 293 deletions(-) > > diff --git a/drivers/staging/typec/fusb302/fusb302.c > b/drivers/staging/typec/fusb302/fusb302.c > index 65df6407db84..40842b8075e5 100644 > --- a/drivers/staging/typec/fusb302/fusb302.c > +++ b/drivers/staging/typec/fusb302/fusb302.c > @@ -14,7 +14,6 @@ > * Fairchild FUSB302 Type-C Chip Driver > */ > > -#include > #include > #include > #include > @@ -82,9 +81,6 @@ static const u8 rd_mda_value[] = { > [SRC_CURRENT_HIGH] = 61,/* 2604mV */ > }; > > -#define LOG_BUFFER_ENTRIES 1024 > -#define LOG_BUFFER_ENTRY_SIZE128 > - > struct fusb302_chip { > struct device *dev; > struct i2c_client *i2c_client; > @@ -121,146 +117,8 @@ struct fusb302_chip { > enum typec_cc_polarity cc_polarity; > enum typec_cc_status cc1; > enum typec_cc_status cc2; > - > -#ifdef CONFIG_DEBUG_FS > - struct dentry *dentry; > - /* lock for log buffer access */ > - struct mutex logbuffer_lock; > - int logbuffer_head; > - int logbuffer_tail; > - u8 *logbuffer[LOG_BUFFER_ENTRIES]; > -#endif > -}; > - > -/* > - * Logging > - */ > - > -#ifdef CONFIG_DEBUG_FS > - > -static bool fusb302_log_full(struct fusb302_chip *chip) > -{ > - return chip->logbuffer_tail == > - (chip->logbuffer_head + 1) % LOG_BUFFER_ENTRIES; > -} > - > -static void _fusb302_log(struct fusb302_chip *chip, const char *fmt, > - va_list args) > -{ > - char tmpbuffer[LOG_BUFFER_ENTRY_SIZE]; > - u64 ts_nsec = local_clock(); > - unsigned long rem_nsec; > - > - if (!chip->logbuffer[chip->logbuffer_head]) { > - chip->logbuffer[chip->logbuffer_head] = > - kzalloc(LOG_BUFFER_ENTRY_SIZE, GFP_KERNEL); > - if (!chip->logbuffer[chip->logbuffer_head]) > - return; > - } > - > - vsnprintf(tmpbuffer, sizeof(tmpbuffer), fmt, args); > - > - mutex_lock(&chip->logbuffer_lock); > - > - if (fusb302_log_full(chip)) { > - chip->logbuffer_head = max(chip->logbuffer_head - 1, 0); > - strlcpy(tmpbuffer, "overflow", sizeof(tmpbuffer)); > - } > - > - if (chip->logbuffer_head < 0 || > - chip->logbuffer_head >= LOG_BUFFER_ENTRIES) { > - dev_warn(chip->dev, > - "Bad log buffer index %d\n", chip->logbuffer_head); > - goto abort; > - } > - > - if (!chip->logbuffer[chip->logbuffer_head]) { > - dev_warn(chip->dev, > - "Log buffer index %d is NULL\n", chip->logbuffer_head); > - goto abort; > - } > - > - rem_nsec = do_div(ts_nsec, 10); > - scnprintf(chip->logbuffer[chip->logbuffer_head], > - LOG_BUFFER_ENTRY_SIZE, "[%5lu.%06lu] %s", > - (unsigned long)ts_nsec, rem_nsec / 1000, > - tmpbuffer); > - chip->logbuffer_head = (chip->logbuffer_head + 1) % LOG_BUFFER_ENTRIES; > - > -abort: > - mutex_unlock(&chip->logbuffer_lock); > -} > - > -static void fusb302_log(struct fusb302_chip *chip, const char *fmt, ...) > -{ > - va_list args; > - > - va_start(args, fmt); > - _fusb302_log(chip, fmt, args); > - va_end(args); > -} > - > -static int fusb302_seq_show(struct seq_file *s, void *v) > -{ > - struct fusb302_chip *chip = (struct fusb302_chip *)s->private; > - int tail; > - > - mutex_lock(&chip->logbuffer_lock); > - tail = chip->logbuffer_tail; > - while (tail != chip->logbuffer_head) { > - seq_printf(s, "%s\n", chip->logbuffer[tail]); > - tail = (tail + 1) % LOG_BUFFER_ENTRIES; > - } > - if (!seq_has_overflowed(s)) > - chip->logbuffer_tail = tail; > - mutex_unlock(&chip->logbuffer_lock); > - > - return 0; > -} > - > -static int fusb302_debug_open(struct inode *inode, struct file *file) > -{ > - return single_open(file, fusb302_seq_show, inode->i_private); > -} > - > -static const struct file_operations fusb302_debug_operations = { > - .open = fusb302_debug_open, > - .llseek = seq_lseek, > - .read = seq_read, > - .release= single_release, > }; > > -static struct dentry *rootdir; > - > -static int fusb302_debugfs_init(struct fusb302_chip *chip) > -{ > - mutex_i
Re: [PATCH] staging: typec: Fix sparse warnings about incorrect types
On Wed, May 10, 2017 at 10:51:35PM -0700, Guru Das Srinagesh wrote: > Fix the following sparse warnings about incorrect type usage: > > fusb302.c:1028:32: warning: incorrect type in argument 1 (different base > types) > fusb302.c:1028:32:expected unsigned short [unsigned] [usertype] header > fusb302.c:1028:32:got restricted __le16 const [usertype] header > fusb302.c:1484:32: warning: incorrect type in argument 1 (different base > types) > fusb302.c:1484:32:expected unsigned short [unsigned] [usertype] header > fusb302.c:1484:32:got restricted __le16 [usertype] header > > Signed-off-by: Guru Das Srinagesh Reviewed-by: Guenter Roeck > --- > drivers/staging/typec/fusb302/fusb302.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/typec/fusb302/fusb302.c > b/drivers/staging/typec/fusb302/fusb302.c > index 2cee9a9..3bec9d5 100644 > --- a/drivers/staging/typec/fusb302/fusb302.c > +++ b/drivers/staging/typec/fusb302/fusb302.c > @@ -1025,7 +1025,7 @@ static int fusb302_pd_send_message(struct fusb302_chip > *chip, > buf[pos++] = FUSB302_TKN_SYNC1; > buf[pos++] = FUSB302_TKN_SYNC2; > > - len = pd_header_cnt(msg->header) * 4; > + len = pd_header_cnt_le(msg->header) * 4; > /* plug 2 for header */ > len += 2; > if (len > 0x1F) { > @@ -1481,7 +1481,7 @@ static int fusb302_pd_read_message(struct fusb302_chip > *chip, >(u8 *)&msg->header); > if (ret < 0) > return ret; > - len = pd_header_cnt(msg->header) * 4; > + len = pd_header_cnt_le(msg->header) * 4; > /* add 4 to length to include the CRC */ > if (len > PD_MAX_PAYLOAD * 4) { > fusb302_log(chip, "PD message too long %d", len); > -- > 2.7.4 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 1/4] staging: typec: fusb302: do not free gpio from managed resource
On Thu, May 11, 2017 at 03:20:20PM +0100, Rui Miguel Silva wrote: > When allocating a gpio using the managed resource devm_, we can avoid freeing > it > manually. But even if we did it we should use devm_gpio_free. > > So, just remove the free of the gpio in the error path. > > Signed-off-by: Rui Miguel Silva Nice catch. Reviewed-by: Guenter Roeck > --- > drivers/staging/typec/fusb302/fusb302.c | 2 -- > 1 file changed, 2 deletions(-) > > diff --git a/drivers/staging/typec/fusb302/fusb302.c > b/drivers/staging/typec/fusb302/fusb302.c > index 2cee9a952c9b..65df6407db84 100644 > --- a/drivers/staging/typec/fusb302/fusb302.c > +++ b/drivers/staging/typec/fusb302/fusb302.c > @@ -1663,14 +1663,12 @@ static int init_gpio(struct fusb302_chip *chip) > if (ret < 0) { > fusb302_log(chip, > "cannot set GPIO Int_N to input, ret=%d", ret); > - gpio_free(chip->gpio_int_n); > return ret; > } > ret = gpio_to_irq(chip->gpio_int_n); > if (ret < 0) { > fusb302_log(chip, > "cannot request IRQ for GPIO Int_N, ret=%d", ret); > - gpio_free(chip->gpio_int_n); > return ret; > } > chip->gpio_int_n_irq = ret; > -- > 2.12.2 > ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] staging: typec: fusb302: refactor resume retry mechanism
On Thu, May 11, 2017 at 03:20:22PM +0100, Rui Miguel Silva wrote: > The i2c functions need to test the pm_suspend state and do, if needed, some > retry before i2c operations. This code was repeated 4x. > > The isolate this create a new function to check suspend state and call it in > every need place. > > Signed-off-by: Rui Miguel Silva This and the next patch don't apply without patch 2. Please refactor. Also, please change the order of patch 3 and 4 since the latter is a bug fix and this one is a cleanup (and thus probably not applicable for v4.12). Thanks, Guenter > --- > drivers/staging/typec/fusb302/fusb302.c | 66 > + > 1 file changed, 34 insertions(+), 32 deletions(-) > > diff --git a/drivers/staging/typec/fusb302/fusb302.c > b/drivers/staging/typec/fusb302/fusb302.c > index 40842b8075e5..26d7e2a387c3 100644 > --- a/drivers/staging/typec/fusb302/fusb302.c > +++ b/drivers/staging/typec/fusb302/fusb302.c > @@ -122,22 +122,36 @@ struct fusb302_chip { > > #define FUSB302_RESUME_RETRY 10 > #define FUSB302_RESUME_RETRY_SLEEP 50 > -static int fusb302_i2c_write(struct fusb302_chip *chip, > - u8 address, u8 data) > + > +static bool fusb302_is_suspended(struct fusb302_chip *chip) > { > int retry_cnt; > - int ret = 0; > > - atomic_set(&chip->i2c_busy, 1); > for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { > if (atomic_read(&chip->pm_suspend)) { > dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", >retry_cnt + 1, FUSB302_RESUME_RETRY); > msleep(FUSB302_RESUME_RETRY_SLEEP); > } else { > - break; > + return false; > } > } > + > + return true; > +} > + > +static int fusb302_i2c_write(struct fusb302_chip *chip, > + u8 address, u8 data) > +{ > + int ret = 0; > + > + atomic_set(&chip->i2c_busy, 1); > + > + if (fusb302_is_suspended(chip)) { > + atomic_set(&chip->i2c_busy, 0); > + return -ETIMEDOUT; > + } > + > ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); > if (ret < 0) > dev_err(chip->dev, "cannot write 0x%02x to 0x%02x: %d\n", data, > @@ -150,21 +164,17 @@ static int fusb302_i2c_write(struct fusb302_chip *chip, > static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, > u8 length, const u8 *data) > { > - int retry_cnt; > int ret = 0; > > if (length <= 0) > return ret; > atomic_set(&chip->i2c_busy, 1); > - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { > - if (atomic_read(&chip->pm_suspend)) { > - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", > - retry_cnt + 1, FUSB302_RESUME_RETRY); > - msleep(FUSB302_RESUME_RETRY_SLEEP); > - } else { > - break; > - } > + > + if (fusb302_is_suspended(chip)) { > + atomic_set(&chip->i2c_busy, 0); > + return -ETIMEDOUT; > } > + > ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, >length, data); > if (ret < 0) > @@ -178,19 +188,15 @@ static int fusb302_i2c_block_write(struct fusb302_chip > *chip, u8 address, > static int fusb302_i2c_read(struct fusb302_chip *chip, > u8 address, u8 *data) > { > - int retry_cnt; > int ret = 0; > > atomic_set(&chip->i2c_busy, 1); > - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { > - if (atomic_read(&chip->pm_suspend)) { > - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", > - retry_cnt + 1, FUSB302_RESUME_RETRY); > - msleep(FUSB302_RESUME_RETRY_SLEEP); > - } else { > - break; > - } > + > + if (fusb302_is_suspended(chip)) { > + atomic_set(&chip->i2c_busy, 0); > + return -ETIMEDOUT; > } > + > ret = i2c_smbus_read_byte_data(chip->i2c_client, address); > *data = (u8)ret; > if (ret < 0) > @@ -203,21 +209,17 @@ static int fusb302_i2c_read(struct fusb302_chip *chip, > static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, > u8 length, u8 *data) > { > - int retry_cnt; > int ret = 0; > > if (length <= 0) > return ret; > atomic_set(&chip->i2c_busy, 1); > - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { > - if (atomic_read(&chip->pm_suspend)) { > - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", > - r
Re: [PATCH 1/4] vmbus: Improve a size determination in vmbus_device_create()
On Thu, May 11, 2017 at 09:30:56AM -0700, Stephen Hemminger wrote: > On Thu, 11 May 2017 18:15:46 +0200 > SF Markus Elfring wrote: > > > From: Markus Elfring > > Date: Thu, 11 May 2017 17:30:10 +0200 > > > > Replace the specification of a data structure by a pointer dereference > > as the parameter for the operator "sizeof" to make the corresponding size > > determination a bit safer according to the Linux coding style convention. > > > > Signed-off-by: Markus Elfring > > --- > > drivers/hv/vmbus_drv.c | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/hv/vmbus_drv.c b/drivers/hv/vmbus_drv.c > > index 0087b49095eb..6802d74f162c 100644 > > --- a/drivers/hv/vmbus_drv.c > > +++ b/drivers/hv/vmbus_drv.c > > @@ -1145,5 +1145,5 @@ struct hv_device *vmbus_device_create(const uuid_le > > *type, > > { > > struct hv_device *child_device_obj; > > > > - child_device_obj = kzalloc(sizeof(struct hv_device), GFP_KERNEL); > > + child_device_obj = kzalloc(sizeof(*child_device_obj), GFP_KERNEL); > > if (!child_device_obj) { > > This looks fine. > > Acked-by: Stephen Hemminger Note, I have a blacklist filter for this person for a reason, I, and many other maintainers, just ignore them for good reason... greg k-h ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 2/4] staging: rtl8192e: fix 2 byte alignment of register BSSIDR.
BSSIDR has two byte alignment on PCI ioremap correct the write by swapping to 16 bits first. This fixes a problem that the device associates fail because the filter is not set correctly. Signed-off-by: Malcolm Priestley Cc: --- v2 - Fix name of register in commit message. drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 9 + 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index a23628f390c9..e03d0a3a6dcc 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -97,8 +97,9 @@ void rtl92e_set_reg(struct net_device *dev, u8 variable, u8 *val) switch (variable) { case HW_VAR_BSSID: - rtl92e_writel(dev, BSSIDR, ((u32 *)(val))[0]); - rtl92e_writew(dev, BSSIDR+2, ((u16 *)(val+2))[0]); + /* BSSIDR 2 byte alignment */ + rtl92e_writew(dev, BSSIDR, *(u16 *)val); + rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(val + 2)); break; case HW_VAR_MEDIA_STATUS: @@ -961,8 +962,8 @@ static void _rtl92e_net_update(struct net_device *dev) rtl92e_config_rate(dev, &rate_config); priv->dot11CurrentPreambleMode = PREAMBLE_AUTO; priv->basic_rate = rate_config &= 0x15f; - rtl92e_writel(dev, BSSIDR, ((u32 *)net->bssid)[0]); - rtl92e_writew(dev, BSSIDR+4, ((u16 *)net->bssid)[2]); + rtl92e_writew(dev, BSSIDR, *(u16 *)net->bssid); + rtl92e_writel(dev, BSSIDR + 2, *(u32 *)(net->bssid + 2)); if (priv->rtllib->iw_mode == IW_MODE_ADHOC) { rtl92e_writew(dev, ATIMWND, 2); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 3/4] staging: rtl8192e: rtl92e_get_eeprom_size Fix read size of EPROM_CMD.
EPROM_CMD is 2 byte aligned on PCI map so calling with rtl92e_readl will return invalid data so use rtl92e_readw. The device is unable to select the right eeprom type. Signed-off-by: Malcolm Priestley Cc: --- v2 - Fix typo in subject line drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index e03d0a3a6dcc..1c6ed5b2a6f9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -625,7 +625,7 @@ void rtl92e_get_eeprom_size(struct net_device *dev) struct r8192_priv *priv = rtllib_priv(dev); RT_TRACE(COMP_INIT, "===>%s()\n", __func__); - curCR = rtl92e_readl(dev, EPROM_CMD); + curCR = rtl92e_readw(dev, EPROM_CMD); RT_TRACE(COMP_INIT, "read from Reg Cmd9346CR(%x):%x\n", EPROM_CMD, curCR); priv->epromtype = (curCR & EPROM_CMD_9356SEL) ? EEPROM_93C56 : -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/4] staging: rtl8192e: rtl92e_fill_tx_desc fix write to mapped out memory.
The driver attempts to alter memory that is mapped to PCI device. This is because tx_fwinfo_8190pci points to skb->data Move the pci_map_single to when completed buffer is ready to be mapped with psdec is empty to drop on mapping error. Signed-off-by: Malcolm Priestley Cc: --- v2 - Fix typo in subject header. drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c | 13 + 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c index 4723a0bd5067..a23628f390c9 100644 --- a/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c +++ b/drivers/staging/rtl8192e/rtl8192e/r8192E_dev.c @@ -1182,8 +1182,7 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, struct cb_desc *cb_desc, struct sk_buff *skb) { struct r8192_priv *priv = rtllib_priv(dev); - dma_addr_t mapping = pci_map_single(priv->pdev, skb->data, skb->len, -PCI_DMA_TODEVICE); + dma_addr_t mapping; struct tx_fwinfo_8190pci *pTxFwInfo; pTxFwInfo = (struct tx_fwinfo_8190pci *)skb->data; @@ -1194,8 +1193,6 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, pTxFwInfo->Short = _rtl92e_query_is_short(pTxFwInfo->TxHT, pTxFwInfo->TxRate, cb_desc); - if (pci_dma_mapping_error(priv->pdev, mapping)) - netdev_err(dev, "%s(): DMA Mapping error\n", __func__); if (cb_desc->bAMPDUEnable) { pTxFwInfo->AllowAggregation = 1; pTxFwInfo->RxMF = cb_desc->ampdu_factor; @@ -1230,6 +1227,14 @@ void rtl92e_fill_tx_desc(struct net_device *dev, struct tx_desc *pdesc, } memset((u8 *)pdesc, 0, 12); + + mapping = pci_map_single(priv->pdev, skb->data, skb->len, +PCI_DMA_TODEVICE); + if (pci_dma_mapping_error(priv->pdev, mapping)) { + netdev_err(dev, "%s(): DMA Mapping error\n", __func__); + return; + } + pdesc->LINIP = 0; pdesc->CmdInit = 1; pdesc->Offset = sizeof(struct tx_fwinfo_8190pci) + 8; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: rtl8192e: GetTs Fix invalid TID 7 warning.
TID 7 is a valid value for QoS IEEE 802.11e. The switch statement that follows states 7 is valid. Remove function IsACValid and use the default case to filter invalid TIDs. Signed-off-by: Malcolm Priestley Cc: --- drivers/staging/rtl8192e/rtl819x_TSProc.c | 15 --- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/drivers/staging/rtl8192e/rtl819x_TSProc.c b/drivers/staging/rtl8192e/rtl819x_TSProc.c index 48bbd9e8a52f..dcc4eb691889 100644 --- a/drivers/staging/rtl8192e/rtl819x_TSProc.c +++ b/drivers/staging/rtl8192e/rtl819x_TSProc.c @@ -306,11 +306,6 @@ static void MakeTSEntry(struct ts_common_info *pTsCommonInfo, u8 *Addr, pTsCommonInfo->TClasNum = TCLAS_Num; } -static bool IsACValid(unsigned int tid) -{ - return tid < 7; -} - bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, u8 *Addr, u8 TID, enum tr_select TxRxSelect, bool bAddNewTs) { @@ -328,12 +323,6 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, if (ieee->current_network.qos_data.supported == 0) { UP = 0; } else { - if (!IsACValid(TID)) { - netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", - __func__, TID); - return false; - } - switch (TID) { case 0: case 3: @@ -351,6 +340,10 @@ bool GetTs(struct rtllib_device *ieee, struct ts_common_info **ppTS, case 7: UP = 7; break; + default: + netdev_warn(ieee->dev, "%s(): TID(%d) is not valid\n", + __func__, TID); + return false; } } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: wlan-ng: convert endianness in situ
Fix several sparse warnings about casts to restricted little-endian by using in situ conversions. Signed-off-by: Thibaut SAUTEREAU --- drivers/staging/wlan-ng/prism2sta.c | 100 ++-- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/drivers/staging/wlan-ng/prism2sta.c b/drivers/staging/wlan-ng/prism2sta.c index 9c2b4ef2de58..e16da34389cd 100644 --- a/drivers/staging/wlan-ng/prism2sta.c +++ b/drivers/staging/wlan-ng/prism2sta.c @@ -603,10 +603,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the nic id fields in host byte order */ - hw->ident_nic.id = le16_to_cpu(hw->ident_nic.id); - hw->ident_nic.variant = le16_to_cpu(hw->ident_nic.variant); - hw->ident_nic.major = le16_to_cpu(hw->ident_nic.major); - hw->ident_nic.minor = le16_to_cpu(hw->ident_nic.minor); + le16_to_cpus(&hw->ident_nic.id); + le16_to_cpus(&hw->ident_nic.variant); + le16_to_cpus(&hw->ident_nic.major); + le16_to_cpus(&hw->ident_nic.minor); netdev_info(wlandev->netdev, "ident: nic h/w: id=0x%02x %d.%d.%d\n", hw->ident_nic.id, hw->ident_nic.major, @@ -622,10 +622,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the private fw id fields in host byte order */ - hw->ident_pri_fw.id = le16_to_cpu(hw->ident_pri_fw.id); - hw->ident_pri_fw.variant = le16_to_cpu(hw->ident_pri_fw.variant); - hw->ident_pri_fw.major = le16_to_cpu(hw->ident_pri_fw.major); - hw->ident_pri_fw.minor = le16_to_cpu(hw->ident_pri_fw.minor); + le16_to_cpus(&hw->ident_pri_fw.id); + le16_to_cpus(&hw->ident_pri_fw.variant); + le16_to_cpus(&hw->ident_pri_fw.major); + le16_to_cpus(&hw->ident_pri_fw.minor); netdev_info(wlandev->netdev, "ident: pri f/w: id=0x%02x %d.%d.%d\n", hw->ident_pri_fw.id, hw->ident_pri_fw.major, @@ -648,10 +648,10 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) } /* get all the station fw id fields in host byte order */ - hw->ident_sta_fw.id = le16_to_cpu(hw->ident_sta_fw.id); - hw->ident_sta_fw.variant = le16_to_cpu(hw->ident_sta_fw.variant); - hw->ident_sta_fw.major = le16_to_cpu(hw->ident_sta_fw.major); - hw->ident_sta_fw.minor = le16_to_cpu(hw->ident_sta_fw.minor); + le16_to_cpus(&hw->ident_sta_fw.id); + le16_to_cpus(&hw->ident_sta_fw.variant); + le16_to_cpus(&hw->ident_sta_fw.major); + le16_to_cpus(&hw->ident_sta_fw.minor); /* strip out the 'special' variant bits */ hw->mm_mods = hw->ident_sta_fw.variant & GENMASK(15, 14); @@ -683,11 +683,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, modem interface supplier * fields in byte order */ - hw->cap_sup_mfi.role = le16_to_cpu(hw->cap_sup_mfi.role); - hw->cap_sup_mfi.id = le16_to_cpu(hw->cap_sup_mfi.id); - hw->cap_sup_mfi.variant = le16_to_cpu(hw->cap_sup_mfi.variant); - hw->cap_sup_mfi.bottom = le16_to_cpu(hw->cap_sup_mfi.bottom); - hw->cap_sup_mfi.top = le16_to_cpu(hw->cap_sup_mfi.top); + le16_to_cpus(&hw->cap_sup_mfi.role); + le16_to_cpus(&hw->cap_sup_mfi.id); + le16_to_cpus(&hw->cap_sup_mfi.variant); + le16_to_cpus(&hw->cap_sup_mfi.bottom); + le16_to_cpus(&hw->cap_sup_mfi.top); netdev_info(wlandev->netdev, "MFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -707,11 +707,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, controller interface supplier * fields in byte order */ - hw->cap_sup_cfi.role = le16_to_cpu(hw->cap_sup_cfi.role); - hw->cap_sup_cfi.id = le16_to_cpu(hw->cap_sup_cfi.id); - hw->cap_sup_cfi.variant = le16_to_cpu(hw->cap_sup_cfi.variant); - hw->cap_sup_cfi.bottom = le16_to_cpu(hw->cap_sup_cfi.bottom); - hw->cap_sup_cfi.top = le16_to_cpu(hw->cap_sup_cfi.top); + le16_to_cpus(&hw->cap_sup_cfi.role); + le16_to_cpus(&hw->cap_sup_cfi.id); + le16_to_cpus(&hw->cap_sup_cfi.variant); + le16_to_cpus(&hw->cap_sup_cfi.bottom); + le16_to_cpus(&hw->cap_sup_cfi.top); netdev_info(wlandev->netdev, "CFI:SUP:role=0x%02x:id=0x%02x:var=0x%02x:b/t=%d/%d\n", @@ -731,11 +731,11 @@ static int prism2sta_getcardinfo(struct wlandevice *wlandev) /* get all the Compatibility range, primary firmware supplier * fields in byte order */ - hw->cap_sup_pri.role = le16_to_cpu(hw->cap_sup_pri.role); - hw->cap_sup_pri.id = le16_to_cpu(hw->cap_sup_pri.id); - hw->cap_sup_pri.variant = le16_to_cpu(hw->cap_sup_pri.variant); - hw->cap_sup_pri.bottom = le16_to_cpu(hw->cap_sup_pri.bottom); - hw->cap_sup_pri.top = le16_to_cpu(hw->cap_sup_pri.to
[PATCH] staging: greybus: power_supply: replace kzalloc by kcalloc
According to checkpatch.pl, kcalloc should be preferred to kzalloc with multiply. Signed-off-by: JB Van Puyvelde --- drivers/staging/greybus/power_supply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index e85c988b7034..20cac20518d7 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -944,7 +944,7 @@ static int gb_power_supplies_setup(struct gb_power_supplies *supplies) if (ret < 0) goto out; - supplies->supply = kzalloc(supplies->supplies_count * + supplies->supply = kcalloc(supplies->supplies_count, sizeof(struct gb_power_supply), GFP_KERNEL); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/4] staging: typec: fusb302: cleanup logging and error messages
Hi Guenter, On Thu, May 11, 2017 at 10:14:15AM -0700, Guenter Roeck wrote: On Thu, May 11, 2017 at 03:20:21PM +0100, Rui Miguel Silva wrote: This driver was using debugfs as a logging mechanism instead of the normal dev_* helpers. This patch changes this and move all calls to fusb302_log function to the correspondent dev_{err,dbg,info}. Since the debugfs interface was only used for logging, with this patch it became unused, so just remove it. Signed-off-by: Rui Miguel Silva Nack, sorry. This doesn't work; we tried it. Console logging affects timing, making the driver unusable. Yeh, this driver is super verbose, maybe this could be a first step to strip some of messages, even though only with dev_dbg enable the verbose should affect timing. And the errors go to an expected location instead a debugfs interface. And/Or using the debugfs to dump register values would help in real debug situations. Anyhow it is your call on this one. Dropping this patch from the series. Cheers, Rui ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/4] staging: typec: fusb302: refactor resume retry mechanism
Hi, On Thu, May 11, 2017 at 10:32:35AM -0700, Guenter Roeck wrote: On Thu, May 11, 2017 at 03:20:22PM +0100, Rui Miguel Silva wrote: The i2c functions need to test the pm_suspend state and do, if needed, some retry before i2c operations. This code was repeated 4x. The isolate this create a new function to check suspend state and call it in every need place. Signed-off-by: Rui Miguel Silva This and the next patch don't apply without patch 2. Please refactor. Also, please change the order of patch 3 and 4 since the latter is a bug fix and this one is a cleanup (and thus probably not applicable for v4.12). I will refactor and reorder in v2. Cheers, Rui Thanks, Guenter --- drivers/staging/typec/fusb302/fusb302.c | 66 + 1 file changed, 34 insertions(+), 32 deletions(-) diff --git a/drivers/staging/typec/fusb302/fusb302.c b/drivers/staging/typec/fusb302/fusb302.c index 40842b8075e5..26d7e2a387c3 100644 --- a/drivers/staging/typec/fusb302/fusb302.c +++ b/drivers/staging/typec/fusb302/fusb302.c @@ -122,22 +122,36 @@ struct fusb302_chip { #define FUSB302_RESUME_RETRY 10 #define FUSB302_RESUME_RETRY_SLEEP 50 -static int fusb302_i2c_write(struct fusb302_chip *chip, -u8 address, u8 data) + +static bool fusb302_is_suspended(struct fusb302_chip *chip) { int retry_cnt; - int ret = 0; - atomic_set(&chip->i2c_busy, 1); for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { if (atomic_read(&chip->pm_suspend)) { dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", retry_cnt + 1, FUSB302_RESUME_RETRY); msleep(FUSB302_RESUME_RETRY_SLEEP); } else { - break; + return false; } } + + return true; +} + +static int fusb302_i2c_write(struct fusb302_chip *chip, +u8 address, u8 data) +{ + int ret = 0; + + atomic_set(&chip->i2c_busy, 1); + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; + } + ret = i2c_smbus_write_byte_data(chip->i2c_client, address, data); if (ret < 0) dev_err(chip->dev, "cannot write 0x%02x to 0x%02x: %d\n", data, @@ -150,21 +164,17 @@ static int fusb302_i2c_write(struct fusb302_chip *chip, static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, u8 length, const u8 *data) { - int retry_cnt; int ret = 0; if (length <= 0) return ret; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -retry_cnt + 1, FUSB302_RESUME_RETRY); - msleep(FUSB302_RESUME_RETRY_SLEEP); - } else { - break; - } + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; } + ret = i2c_smbus_write_i2c_block_data(chip->i2c_client, address, length, data); if (ret < 0) @@ -178,19 +188,15 @@ static int fusb302_i2c_block_write(struct fusb302_chip *chip, u8 address, static int fusb302_i2c_read(struct fusb302_chip *chip, u8 address, u8 *data) { - int retry_cnt; int ret = 0; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -retry_cnt + 1, FUSB302_RESUME_RETRY); - msleep(FUSB302_RESUME_RETRY_SLEEP); - } else { - break; - } + + if (fusb302_is_suspended(chip)) { + atomic_set(&chip->i2c_busy, 0); + return -ETIMEDOUT; } + ret = i2c_smbus_read_byte_data(chip->i2c_client, address); *data = (u8)ret; if (ret < 0) @@ -203,21 +209,17 @@ static int fusb302_i2c_read(struct fusb302_chip *chip, static int fusb302_i2c_block_read(struct fusb302_chip *chip, u8 address, u8 length, u8 *data) { - int retry_cnt; int ret = 0; if (length <= 0) return ret; atomic_set(&chip->i2c_busy, 1); - for (retry_cnt = 0; retry_cnt < FUSB302_RESUME_RETRY; retry_cnt++) { - if (atomic_read(&chip->pm_suspend)) { - dev_info(chip->dev, "i2c: pm suspend, retry %d/%d\n", -
Re: [PATCH] staging: greybus: power_supply: replace kzalloc by kcalloc
Hi JB, Great! thanks for the patch, On Thu, May 11, 2017 at 10:58:56PM +0200, JB Van Puyvelde wrote: According to checkpatch.pl, kcalloc should be preferred to kzalloc with multiply. Signed-off-by: JB Van Puyvelde Reviewed-by: Rui Miguel Silva Cheers, Rui --- drivers/staging/greybus/power_supply.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index e85c988b7034..20cac20518d7 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -944,7 +944,7 @@ static int gb_power_supplies_setup(struct gb_power_supplies *supplies) if (ret < 0) goto out; - supplies->supply = kzalloc(supplies->supplies_count * + supplies->supply = kcalloc(supplies->supplies_count, sizeof(struct gb_power_supply), GFP_KERNEL); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 2/4] staging: typec: fusb302: cleanup logging and error messages
On Thu, May 11, 2017 at 10:19:30PM +0100, Rui Miguel Silva wrote: > Hi Guenter, > On Thu, May 11, 2017 at 10:14:15AM -0700, Guenter Roeck wrote: > >On Thu, May 11, 2017 at 03:20:21PM +0100, Rui Miguel Silva wrote: > >>This driver was using debugfs as a logging mechanism instead of the normal > >>dev_* > >>helpers. This patch changes this and move all calls to fusb302_log function > >>to > >>the correspondent dev_{err,dbg,info}. > >> > >>Since the debugfs interface was only used for logging, with this patch it > >>became > >>unused, so just remove it. > >> > >>Signed-off-by: Rui Miguel Silva > > > >Nack, sorry. > > > >This doesn't work; we tried it. Console logging affects timing, making > >the driver unusable. > > Yeh, this driver is super verbose, maybe this could be a first > step to strip some of messages, even though only with dev_dbg > enable the verbose should affect timing. And the errors go to an > expected location instead a debugfs interface. > Using debugfs and the verbosity was on purpose; after all, the messages are only seen if someone actually looks at the debugfs output. tcpm uses the same approach, and it is still extremely useful to determine (after the fact) if some protocol exchange went wrong and how. dev_dbg() or similar debug output that slows down the protocol doesn't help - it would only create heisenbugs. Maybe we can drop all this at some point, eg when we move the driver(s) out of staging. Someone suggested to use ptrace instead; maybe that would work as well, and we should explore it. Thanks, Guenter > And/Or using the debugfs to dump register values would help in > real debug situations. > > Anyhow it is your call on this one. > Dropping this patch from the series. > > Cheers, > Rui ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: rtl8723bs: checkpatch - remove multiple blank lines
Resolving checkpatch issue: CHECK: Please don't use multiple blank lines All instances resolved. --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 5 - 1 file changed, 5 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 8d78f4e..960d8e4 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -17,7 +17,6 @@ #include - #define HAL_NAV_UPPER_UNIT_8723B 128 /* micro-second */ /* */ @@ -124,7 +123,6 @@ /* */ /* */ - /* */ /* SDIO Bus Specification */ /* */ @@ -142,7 +140,6 @@ /* */ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ - /* */ /* 8723 Regsiter Bit and Content definition */ /* */ @@ -161,7 +158,6 @@ /* */ /* */ - /* */ /* */ /* 0x0200h ~ 0x027Fh TXDMA Configuration */ @@ -207,7 +203,6 @@ #define EEPROM_RF_GAIN_OFFSET 0xC1 #define EEPROM_RF_GAIN_VAL 0x1F6 - /* */ /*8195 IMR/ISR bits(offset 0xB0, 8bits) */ /* */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging: rtl8723bs: resolve checkpatch issues
This set of patches resolves a large number of non-functional issues reported by checkpatch for the following header: drivers/staging/rtl8723bs/include/rtl8723b_spec.h *Typos in comments *Indentation consistency (original code not formatted for 8-wide hard-tabs) and 80+ column width lines. *Multiple blank lines *Mixed space/hard-tab indentation All outstanding checkpatch errors/warnings/checks are resolved by this series of patches. ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: rtl8723bs: checkpatch - remove mixed spaces/hard-tabs
Resolving checkpatch issue: WARNING: please, no space before tabs All instances resolved. --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 30 +++ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 960d8e4..1f275a7 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -21,7 +21,7 @@ /* */ /* */ -/* 0xh ~ 0x00FFh System Configuration */ +/* 0xh ~ 0x00FFh System Configuration */ /* */ /* */ #define REG_RSV_CTRL_8723B 0x001C /* 3 Byte */ @@ -41,7 +41,7 @@ /* */ /* */ -/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ +/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ /* */ /* */ #define REG_C2HEVT_CMD_ID_8723B0x01A0 @@ -57,13 +57,13 @@ /* */ /* */ -/* 0x0200h ~ 0x027Fh TXDMA Configuration */ +/* 0x0200h ~ 0x027Fh TXDMA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0280h ~ 0x02FFh RXDMA Configuration */ +/* 0x0280h ~ 0x02FFh RXDMA Configuration */ /* */ /* */ #define REG_RXDMA_CONTROL_8723B0x0286 /* Control the RX DMA. */ @@ -71,7 +71,7 @@ /* */ /* */ -/* 0x0300h ~ 0x03FFh PCIe */ +/* 0x0300h ~ 0x03FFh PCIe */ /* */ /* */ #defineREG_PCIE_CTRL_REG_8723B 0x0300 @@ -98,7 +98,7 @@ /* */ /* */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ +/* 0x0400h ~ 0x047Fh Protocol Configuration */ /* */ /* */ #define REG_TXPKTBUF_BCNQ_BDNY_8723B 0x0424 @@ -112,14 +112,14 @@ /* */ /* */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ +/* 0x0500h ~ 0x05FFh EDCA Configuration */ /* */ /* */ #define REG_SECONDARY_CCA_CTRL_8723B 0x0577 /* */ /* */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ +/* 0x0600h ~ 0x07FFh WMAC Configuration */ /* */ /* */ @@ -141,7 +141,7 @@ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ /* */ -/* 8723 Regsiter Bit and Content definition */ +/* 8723 Regsiter Bit and Content definition */ /* */ /* 2 HSISR */ @@ -154,19 +154,19 @@ /* */ /* */ -/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ +/* 0x0100h ~ 0x01FFh MACTOP General Configuration */ /* */ /* */ /* */ /* */ -/* 0x0200h ~ 0x027Fh TXDMA Configuration */ +/* 0x0200h ~ 0x027Fh TXDMA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0280h ~ 0x02FFh RXDMA Configuration */ +/* 0x0280h ~ 0x02FFh RXDMA Configuration */ /* */ /* */ #define BIT_USB_RXDMA_AGG_EN BIT(31) @@ -180,7 +180,7 @@ /* */ /* */ -/* 0x0400h ~ 0x047Fh Protocol Configuration */ +/* 0x0400h ~ 0x047Fh Protocol Configuration */ /* */ /* */ @@ -191,13 +191,13 @@ /* */ /* */ -/* 0x0500h ~ 0x05FFh EDCA Configuration */ +/* 0x0500h ~ 0x05FFh EDCA Configuration */ /* */ /* */ /* */ /* */ -/* 0x0600h ~ 0x07FFh WMAC Configuration */ +/* 0x0600h ~ 0x07FFh WMAC Configuration */ /* */ /* */ #define EEPROM_RF_GAIN_OFFSET 0xC1 -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: rtl8723bs: checkpatch - resolve indentation and line width
Resolving checkpatch issue: WARNING: line over 80 characters Consolidated indentation so local blocks of macros are column-aligned. Slight slight change to make indentation more readable, assuming a 8-space hard-tab indentation style. --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 262 +- 1 file changed, 159 insertions(+), 103 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 1906ff20..b8298e9 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -11,32 +11,32 @@ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for * more details. * - ***/ + **/ #ifndef __RTL8723B_SPEC_H__ #define __RTL8723B_SPEC_H__ #include -#define HAL_NAV_UPPER_UNIT_8723B 128 /* micro-second */ +#define HAL_NAV_UPPER_UNIT_8723B 128 /* micro-second */ /* */ /* */ /* 0xh ~ 0x00FFh System Configuration */ /* */ /* */ -#define REG_RSV_CTRL_8723B 0x001C /* 3 Byte */ +#define REG_RSV_CTRL_8723B 0x001C /* 3 Byte */ #define REG_BT_WIFI_ANTENNA_SWITCH_8723B 0x0038 -#define REG_HSISR_8723B0x005c -#define REG_PAD_CTRL1_8723B0x0064 -#define REG_AFE_CTRL_4_8723B 0x0078 -#define REG_HMEBOX_DBG_0_8723B 0x0088 -#define REG_HMEBOX_DBG_1_8723B 0x008A -#define REG_HMEBOX_DBG_2_8723B 0x008C -#define REG_HMEBOX_DBG_3_8723B 0x008E -#define REG_HIMR0_8723B0x00B0 -#define REG_HISR0_8723B0x00B4 -#define REG_HIMR1_8723B0x00B8 -#define REG_HISR1_8723B0x00BC +#define REG_HSISR_8723B0x005c +#define REG_PAD_CTRL1_8723B0x0064 +#define REG_AFE_CTRL_4_8723B 0x0078 +#define REG_HMEBOX_DBG_0_8723B 0x0088 +#define REG_HMEBOX_DBG_1_8723B 0x008A +#define REG_HMEBOX_DBG_2_8723B 0x008C +#define REG_HMEBOX_DBG_3_8723B 0x008E +#define REG_HIMR0_8723B0x00B0 +#define REG_HISR0_8723B0x00B4 +#define REG_HIMR1_8723B0x00B8 +#define REG_HISR1_8723B0x00BC #define REG_PMC_DBG_CTRL2_8723B0x00CC /* */ @@ -44,16 +44,16 @@ /* 0x0100h ~ 0x01FFh MACTOP General Configuration */ /* */ /* */ -#define REG_C2HEVT_CMD_ID_8723B0x01A0 +#define REG_C2HEVT_CMD_ID_8723B0x01A0 #define REG_C2HEVT_CMD_LEN_8723B 0x01AE -#define REG_WOWLAN_WAKE_REASON 0x01C7 -#define REG_WOWLAN_GTK_DBG10x630 -#define REG_WOWLAN_GTK_DBG20x634 +#define REG_WOWLAN_WAKE_REASON 0x01C7 +#define REG_WOWLAN_GTK_DBG10x630 +#define REG_WOWLAN_GTK_DBG20x634 -#define REG_HMEBOX_EXT0_8723B 0x01F0 -#define REG_HMEBOX_EXT1_8723B 0x01F4 -#define REG_HMEBOX_EXT2_8723B 0x01F8 -#define REG_HMEBOX_EXT3_8723B 0x01FC +#define REG_HMEBOX_EXT0_8723B 0x01F0 +#define REG_HMEBOX_EXT1_8723B 0x01F4 +#define REG_HMEBOX_EXT2_8723B 0x01F8 +#define REG_HMEBOX_EXT3_8723B 0x01FC /* */ /* */ @@ -66,8 +66,8 @@ /* 0x0280h ~ 0x02FFh RXDMA Configuration */ /* */ /* */ -#define REG_RXDMA_CONTROL_8723B0x0286 /* Control the RX DMA. */ -#define REG_RXDMA_MODE_CTRL_8723B 0x0290 +#define REG_RXDMA_CONTROL_8723B0x0286 /* Control the RX DMA. */ +#define REG_RXDMA_MODE_CTRL_8723B 0x0290 /* */ /* */ @@ -75,25 +75,40 @@ /* */ /* */ #defineREG_PCIE_CTRL_REG_8723B 0x0300 -#defineREG_INT_MIG_8723B 0x0304 /* Interrupt Migration */ -#defineREG_BCNQ_DESA_8723B 0x0308 /* TX Beacon Descriptor Address */ -#defineREG_HQ_DESA_8723B 0x0310 /* TX High Queue Descriptor Address */ -#defineREG_MGQ_DESA_8723B 0x0318 /* TX Manage Queue Descriptor Address */ -#defineREG_VOQ_DESA_8723B 0x0320 /* TX VO Queue Descriptor Address */ -#defineREG_VIQ_DESA_8723B 0x0328 /* TX VI Queue Descriptor Address */ -#defineREG_BEQ_DESA_8723B 0x0330 /* TX BE Queue Descriptor Address */ -#defineREG_BKQ_DESA_8723B 0x0338 /* TX BK Queue Descriptor Addr
[PATCH 3/4] staging: rtl8723bs: checkpatch - fix typos in comments
Resolving checkpatch issue: CHECK: 'Regsiter' may be misspelled - perhaps 'Register'? CHECK: 'Interrup' may be misspelled - perhaps 'Interrupt'? All instances resolved. --- drivers/staging/rtl8723bs/include/rtl8723b_spec.h | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h index 1f275a7..1906ff20 100644 --- a/drivers/staging/rtl8723bs/include/rtl8723b_spec.h +++ b/drivers/staging/rtl8723bs/include/rtl8723b_spec.h @@ -141,7 +141,7 @@ #define SDIO_REG_HCPWM1_8723B 0x025 /* HCI Current Power Mode 1 */ /* */ -/* 8723 Regsiter Bit and Content definition */ +/* 8723 Register Bit and Content definition */ /* */ /* 2 HSISR */ @@ -241,13 +241,13 @@ #defineIMR_BCNDMAINT3_8723BBIT23 /* Beacon DMA Interrupt 3 */ #defineIMR_BCNDMAINT2_8723BBIT22 /* Beacon DMA Interrupt 2 */ #defineIMR_BCNDMAINT1_8723BBIT21 /* Beacon DMA Interrupt 1 */ -#defineIMR_BCNDOK7_8723B BIT20 /* Beacon Queue DMA OK Interrup 7 */ -#defineIMR_BCNDOK6_8723B BIT19 /* Beacon Queue DMA OK Interrup 6 */ -#defineIMR_BCNDOK5_8723B BIT18 /* Beacon Queue DMA OK Interrup 5 */ -#defineIMR_BCNDOK4_8723B BIT17 /* Beacon Queue DMA OK Interrup 4 */ -#defineIMR_BCNDOK3_8723B BIT16 /* Beacon Queue DMA OK Interrup 3 */ -#defineIMR_BCNDOK2_8723B BIT15 /* Beacon Queue DMA OK Interrup 2 */ -#defineIMR_BCNDOK1_8723B BIT14 /* Beacon Queue DMA OK Interrup 1 */ +#defineIMR_BCNDOK7_8723B BIT20 /* Beacon Queue DMA OK Interrupt 7 */ +#defineIMR_BCNDOK6_8723B BIT19 /* Beacon Queue DMA OK Interrupt 6 */ +#defineIMR_BCNDOK5_8723B BIT18 /* Beacon Queue DMA OK Interrupt 5 */ +#defineIMR_BCNDOK4_8723B BIT17 /* Beacon Queue DMA OK Interrupt 4 */ +#defineIMR_BCNDOK3_8723B BIT16 /* Beacon Queue DMA OK Interrupt 3 */ +#defineIMR_BCNDOK2_8723B BIT15 /* Beacon Queue DMA OK Interrupt 2 */ +#defineIMR_BCNDOK1_8723B BIT14 /* Beacon Queue DMA OK Interrupt 1 */ #defineIMR_ATIMEND_E_8723B BIT13 /* ATIM Window End Extension for Win7 */ #defineIMR_TXERR_8723B BIT11 /* Tx Error Flag Interrupt Status, write 1 clear. */ #defineIMR_RXERR_8723B BIT10 /* Rx Error Flag INT Status, Write 1 clear */ -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 4/4] staging: rtl8723bs: checkpatch - resolve indentation and line width
Hi Matthew, [auto build test WARNING on staging/staging-testing] [also build test WARNING on next-20170511] [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/Matthew-Giassa/staging-rtl8723bs-checkpatch-remove-multiple-blank-lines/20170512-101234 config: i386-allmodconfig (attached as .config) compiler: gcc-6 (Debian 6.2.0-3) 6.2.0 20160901 reproduce: # save the attached .config to linux build tree make ARCH=i386 All warnings (new ones prefixed by >>): In file included from drivers/staging/rtl8723bs/hal/odm_precomp.h:56:0, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: >> drivers/staging/rtl8723bs/hal/Hal8723BReg.h:384:0: warning: >> "IMR_TIMER2_8723B" redefined #define IMR_TIMER2_8723B BIT31 /* Timeout interrupt 2 */ In file included from drivers/staging/rtl8723bs/include/rtl8723b_hal.h:20:0, from drivers/staging/rtl8723bs/hal/odm_precomp.h:50, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: drivers/staging/rtl8723bs/include/rtl8723b_spec.h:226:0: note: this is the location of the previous definition #define IMR_TIMER2_8723B BIT3 /* Timeout interrupt 2 */ In file included from drivers/staging/rtl8723bs/hal/odm_precomp.h:56:0, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: >> drivers/staging/rtl8723bs/hal/Hal8723BReg.h:385:0: warning: >> "IMR_TIMER1_8723B" redefined #define IMR_TIMER1_8723B BIT30 /* Timeout interrupt 1 */ In file included from drivers/staging/rtl8723bs/include/rtl8723b_hal.h:20:0, from drivers/staging/rtl8723bs/hal/odm_precomp.h:50, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: drivers/staging/rtl8723bs/include/rtl8723b_spec.h:227:0: note: this is the location of the previous definition #define IMR_TIMER1_8723B BIT3 /* Timeout interrupt 1 */ In file included from drivers/staging/rtl8723bs/hal/odm_precomp.h:56:0, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: >> drivers/staging/rtl8723bs/hal/Hal8723BReg.h:386:0: warning: >> "IMR_PSTIMEOUT_8723B" redefined #define IMR_PSTIMEOUT_8723B BIT29 /* Power Save Time Out Interrupt */ In file included from drivers/staging/rtl8723bs/include/rtl8723b_hal.h:20:0, from drivers/staging/rtl8723bs/hal/odm_precomp.h:50, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: drivers/staging/rtl8723bs/include/rtl8723b_spec.h:228:0: note: this is the location of the previous definition #define IMR_PSTIMEOUT_8723B BIT2 /* Power Save Time Out In file included from drivers/staging/rtl8723bs/hal/odm_precomp.h:56:0, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: >> drivers/staging/rtl8723bs/hal/Hal8723BReg.h:387:0: warning: >> "IMR_GTINT4_8723B" redefined #define IMR_GTINT4_8723B BIT28 /* When GTIMER4 expires, this bit is set to 1 */ In file included from drivers/staging/rtl8723bs/include/rtl8723b_hal.h:20:0, from drivers/staging/rtl8723bs/hal/odm_precomp.h:50, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: drivers/staging/rtl8723bs/include/rtl8723b_spec.h:231:0: note: this is the location of the previous definition #define IMR_GTINT4_8723B BIT2 /* When GTIMER4 expires, this In file included from drivers/staging/rtl8723bs/hal/odm_precomp.h:56:0, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: >> drivers/staging/rtl8723bs/hal/Hal8723BReg.h:388:0: warning: >> "IMR_GTINT3_8723B" redefined #define IMR_GTINT3_8723B BIT27 /* When GTIMER3 expires, this bit is set to 1 */ In file included from drivers/staging/rtl8723bs/include/rtl8723b_hal.h:20:0, from drivers/staging/rtl8723bs/hal/odm_precomp.h:50, from drivers/staging/rtl8723bs/include/hal_data.h:18, from drivers/staging/rtl8723bs/core/rtw_efuse.c:19: drivers/staging/rtl8723bs/include/rtl8723b_spec.h:234:0: not
Re: [greybus-dev] [PATCH] staging: greybus: power_supply: replace kzalloc by kcalloc
On 11-05-17, 22:58, JB Van Puyvelde wrote: > According to checkpatch.pl, kcalloc should be preferred to kzalloc with > multiply. > > Signed-off-by: JB Van Puyvelde > --- > drivers/staging/greybus/power_supply.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) You should have kept my Ack in this patch, as I have already given it earlier. Anyway, here it is again. Acked-by: Viresh Kumar > > diff --git a/drivers/staging/greybus/power_supply.c > b/drivers/staging/greybus/power_supply.c > index e85c988b7034..20cac20518d7 100644 > --- a/drivers/staging/greybus/power_supply.c > +++ b/drivers/staging/greybus/power_supply.c > @@ -944,7 +944,7 @@ static int gb_power_supplies_setup(struct > gb_power_supplies *supplies) > if (ret < 0) > goto out; > > - supplies->supply = kzalloc(supplies->supplies_count * > + supplies->supply = kcalloc(supplies->supplies_count, >sizeof(struct gb_power_supply), >GFP_KERNEL); > > -- > 2.11.0 > > ___ > greybus-dev mailing list > greybus-...@lists.linaro.org > https://lists.linaro.org/mailman/listinfo/greybus-dev -- viresh ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: fbtft: fix unbalanced parenthesis
Add missing parenthesis around if/else statement to comply with checkpatch.pl following check : Unbalanced braces around else statement #288: FILE: drivers/staging/fbtft/fb_agm1264k-fl.c:288: + else { Signed-off-by: Alexis Lothoré --- drivers/staging/fbtft/fb_agm1264k-fl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/fbtft/fb_agm1264k-fl.c b/drivers/staging/fbtft/fb_agm1264k-fl.c index 489151a..456a8dd 100644 --- a/drivers/staging/fbtft/fb_agm1264k-fl.c +++ b/drivers/staging/fbtft/fb_agm1264k-fl.c @@ -282,10 +282,10 @@ static void iterate_diffusion_matrix(u32 xres, u32 yres, int x, continue; write_pos = &convert_buf[(y + j) * xres + x + i]; coeff = diffusing_matrix[i][j]; - if (-1 == coeff) + if (-1 == coeff) { /* pixel itself */ *write_pos = pixel; - else { + } else { signed short p = *write_pos + error * coeff; if (p > WHITE) -- 2.1.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel