Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Dan Carpenter writes: > I don't have a problem with the ath debug printks. Larry asked me for > examples of better debug functions and the ath code is an example. > Literally, any existing debug functions are better than the > BTC_TRACE_STRING() stuff. Sure, I agree with that. My point was just that sometimes it's ok to have own logging wrappers and there's no hard rule for this. -- Kalle Valo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
Dan Carpenter writes: > On Thu, Dec 08, 2016 at 02:50:49PM +0300, Dan Carpenter wrote: >> On Thu, Dec 08, 2016 at 01:43:42PM +0200, Kalle Valo wrote: >> > But it would make me very happy if someone would add a similar grouping >> > functionality to dyndbg to make it easy to enable a set of debug >> > messages in a driver. >> >> Thats seems like a reasonable thing as well. > > I actually like the ath code... We could easily change it to be more > generic and make it a top level function for everyone to use. That would be great. And maybe add a sysfs file with a description different levels, like module parameters have. Too bad that I can't work on that, too much stuff on my plate right now. -- Kalle Valo ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] uio-hv-generic: store physical addresses instead of virtual
gcc warns about the newly added driver when phys_addr_t is wider than a pointer: drivers/uio/uio_hv_generic.c: In function 'hv_uio_mmap': drivers/uio/uio_hv_generic.c:71:17: error: cast to pointer from integer of different size [-Werror=int-to-pointer-cast] virt_to_phys((void *)info->mem[mi].addr) >> PAGE_SHIFT, drivers/uio/uio_hv_generic.c: In function 'hv_uio_probe': drivers/uio/uio_hv_generic.c:140:5: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] = (phys_addr_t)dev->channel->ringbuffer_pages; drivers/uio/uio_hv_generic.c:147:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] (phys_addr_t)vmbus_connection.int_page; drivers/uio/uio_hv_generic.c:153:3: error: cast from pointer to integer of different size [-Werror=pointer-to-int-cast] (phys_addr_t)vmbus_connection.monitor_pages[1]; I can't see why we store a virtual address in a phys_addr_t here, as the only user of that variable converts it into a physical address anyway, so this moves the conversion to where it logically fits according to the types. Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") Signed-off-by: Arnd Bergmann --- drivers/uio/uio_hv_generic.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/drivers/uio/uio_hv_generic.c b/drivers/uio/uio_hv_generic.c index ad3ab5805ad8..50958f167305 100644 --- a/drivers/uio/uio_hv_generic.c +++ b/drivers/uio/uio_hv_generic.c @@ -68,7 +68,7 @@ hv_uio_mmap(struct uio_info *info, struct vm_area_struct *vma) mi = (int)vma->vm_pgoff; return remap_pfn_range(vma, vma->vm_start, - virt_to_phys((void *)info->mem[mi].addr) >> PAGE_SHIFT, + info->mem[mi].addr >> PAGE_SHIFT, vma->vm_end - vma->vm_start, vma->vm_page_prot); } @@ -137,20 +137,20 @@ hv_uio_probe(struct hv_device *dev, /* mem resources */ pdata->info.mem[TXRX_RING_MAP].name = "txrx_rings"; pdata->info.mem[TXRX_RING_MAP].addr - = (phys_addr_t)dev->channel->ringbuffer_pages; + = virt_to_phys(dev->channel->ringbuffer_pages); pdata->info.mem[TXRX_RING_MAP].size = dev->channel->ringbuffer_pagecount * PAGE_SIZE; pdata->info.mem[TXRX_RING_MAP].memtype = UIO_MEM_LOGICAL; pdata->info.mem[INT_PAGE_MAP].name = "int_page"; pdata->info.mem[INT_PAGE_MAP].addr = - (phys_addr_t)vmbus_connection.int_page; + virt_to_phys(vmbus_connection.int_page); pdata->info.mem[INT_PAGE_MAP].size = PAGE_SIZE; pdata->info.mem[INT_PAGE_MAP].memtype = UIO_MEM_LOGICAL; pdata->info.mem[MON_PAGE_MAP].name = "monitor_pages"; pdata->info.mem[MON_PAGE_MAP].addr = - (phys_addr_t)vmbus_connection.monitor_pages[1]; + virt_to_phys(vmbus_connection.monitor_pages[1]); pdata->info.mem[MON_PAGE_MAP].size = PAGE_SIZE; pdata->info.mem[MON_PAGE_MAP].memtype = UIO_MEM_LOGICAL; -- 2.9.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 0/2] staging: iio: ad7606: move driver out of staging
Address the last remaining TODO [1] for this driver and move it from staging into mainline. [1] https://marc.info/?l=linux-iio&m=147689684332118&w=2 Change in v2: * Address the incorrect way of implementing the scale. (Pointed out by Lars) Eva Rachel Retuya (2): staging: iio: ad7606: replace range/range_available with corresponding scale staging: iio: ad7606: move out of staging drivers/iio/adc/Kconfig| 34 ++ drivers/iio/adc/Makefile | 3 + drivers/{staging => }/iio/adc/ad7606.c | 99 ++ drivers/{staging => }/iio/adc/ad7606.h | 1 + drivers/{staging => }/iio/adc/ad7606_par.c | 0 drivers/{staging => }/iio/adc/ad7606_spi.c | 0 drivers/staging/iio/adc/Kconfig| 34 -- drivers/staging/iio/adc/Makefile | 4 -- 8 files changed, 98 insertions(+), 77 deletions(-) rename drivers/{staging => }/iio/adc/ad7606.c (86%) rename drivers/{staging => }/iio/adc/ad7606.h (98%) rename drivers/{staging => }/iio/adc/ad7606_par.c (100%) rename drivers/{staging => }/iio/adc/ad7606_spi.c (100%) -- 2.7.4 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH v2 1/2] staging: iio: ad7606: replace range/range_available with corresponding scale
Eliminate the non-standard attributes in_voltage_range and in_voltage_range_available. Implement in_voltage_scale_available in place of these attributes and update the SCALE accordingly. The array scale_avail is introduced to hold the available scale values. Signed-off-by: Eva Rachel Retuya --- Changes in v2: * Update commit message to reflect changes. * Introduce scale_avail[] array to hold the available scales. * Rewrite read_raw's SCALE to make use of the scale_avail[]. * Provide write_raw and write_raw_get_fmt for implementing SCALE. * Populate the scale_avail[] with values in probe(). drivers/staging/iio/adc/ad7606.c | 99 drivers/staging/iio/adc/ad7606.h | 1 + 2 files changed, 61 insertions(+), 39 deletions(-) diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/staging/iio/adc/ad7606.c index 4531908..7a9471d 100644 --- a/drivers/staging/iio/adc/ad7606.c +++ b/drivers/staging/iio/adc/ad7606.c @@ -151,9 +151,9 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, *val = (short)ret; return IIO_VAL_INT; case IIO_CHAN_INFO_SCALE: - *val = st->range * 2; - *val2 = st->chip_info->channels[0].scan_type.realbits; - return IIO_VAL_FRACTIONAL_LOG2; + *val = st->scale_avail[st->range][0]; + *val2 = st->scale_avail[st->range][1]; + return IIO_VAL_INT_PLUS_NANO; case IIO_CHAN_INFO_OVERSAMPLING_RATIO: *val = st->oversampling; return IIO_VAL_INT; @@ -161,42 +161,24 @@ static int ad7606_read_raw(struct iio_dev *indio_dev, return -EINVAL; } -static ssize_t ad7606_show_range(struct device *dev, -struct device_attribute *attr, char *buf) +static ssize_t in_voltage_scale_available_show(struct device *dev, + struct device_attribute *attr, + char *buf) { struct iio_dev *indio_dev = dev_to_iio_dev(dev); struct ad7606_state *st = iio_priv(indio_dev); + int i, len = 0; - return sprintf(buf, "%u\n", st->range); -} - -static ssize_t ad7606_store_range(struct device *dev, - struct device_attribute *attr, - const char *buf, size_t count) -{ - struct iio_dev *indio_dev = dev_to_iio_dev(dev); - struct ad7606_state *st = iio_priv(indio_dev); - unsigned long lval; - int ret; - - ret = kstrtoul(buf, 10, &lval); - if (ret) - return ret; - - if (!(lval == 5000 || lval == 1)) - return -EINVAL; + for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) + len += scnprintf(buf + len, PAGE_SIZE - len, "%d.%09u ", +st->scale_avail[i][0], st->scale_avail[i][1]); - mutex_lock(&indio_dev->mlock); - gpiod_set_value(st->gpio_range, lval == 1); - st->range = lval; - mutex_unlock(&indio_dev->mlock); + buf[len - 1] = '\n'; - return count; + return len; } -static IIO_DEVICE_ATTR(in_voltage_range, S_IRUGO | S_IWUSR, - ad7606_show_range, ad7606_store_range, 0); -static IIO_CONST_ATTR(in_voltage_range_available, "5000 1"); +static IIO_DEVICE_ATTR_RO(in_voltage_scale_available, 0); static int ad7606_oversampling_get_index(unsigned int val) { @@ -218,9 +200,23 @@ static int ad7606_write_raw(struct iio_dev *indio_dev, { struct ad7606_state *st = iio_priv(indio_dev); int values[3]; - int ret; + int ret, i; switch (mask) { + case IIO_CHAN_INFO_SCALE: + ret = -EINVAL; + mutex_lock(&indio_dev->mlock); + for (i = 0; i < ARRAY_SIZE(st->scale_avail); i++) + if (val2 == st->scale_avail[i][1]) { + gpiod_set_value(st->gpio_range, i); + st->range = i; + + ret = 0; + break; + } + mutex_unlock(&indio_dev->mlock); + + return ret; case IIO_CHAN_INFO_OVERSAMPLING_RATIO: if (val2) return -EINVAL; @@ -244,11 +240,22 @@ static int ad7606_write_raw(struct iio_dev *indio_dev, } } +static int ad7606_write_raw_get_fmt(struct iio_dev *indio_dev, + struct iio_chan_spec const *chan, + long mask) +{ + switch (mask) { + case IIO_CHAN_INFO_SCALE: + return IIO_VAL_INT_PLUS_NANO; + default: + return -EINVAL; + } +} + static IIO_CONST_ATTR(oversampling_ratio_available, "1 2 4 8 16 32 64"); static struct attribute *ad7606_attributes_os_and_range[] = { - &iio_dev_attr_in_voltage_range.dev_attr.at
[PATCH v2 2/2] staging: iio: ad7606: move out of staging
Move the ad7606 driver from staging/iio/adc to iio/adc. Also, update the corresponding Makefile and Kconfig associated with the change. Signed-off-by: Eva Rachel Retuya --- drivers/iio/adc/Kconfig| 34 ++ drivers/iio/adc/Makefile | 3 +++ drivers/{staging => }/iio/adc/ad7606.c | 0 drivers/{staging => }/iio/adc/ad7606.h | 0 drivers/{staging => }/iio/adc/ad7606_par.c | 0 drivers/{staging => }/iio/adc/ad7606_spi.c | 0 drivers/staging/iio/adc/Kconfig| 34 -- drivers/staging/iio/adc/Makefile | 4 8 files changed, 37 insertions(+), 38 deletions(-) rename drivers/{staging => }/iio/adc/ad7606.c (100%) rename drivers/{staging => }/iio/adc/ad7606.h (100%) rename drivers/{staging => }/iio/adc/ad7606_par.c (100%) rename drivers/{staging => }/iio/adc/ad7606_spi.c (100%) diff --git a/drivers/iio/adc/Kconfig b/drivers/iio/adc/Kconfig index be81ba3..3fa2c60 100644 --- a/drivers/iio/adc/Kconfig +++ b/drivers/iio/adc/Kconfig @@ -58,6 +58,40 @@ config AD7476 To compile this driver as a module, choose M here: the module will be called ad7476. +config AD7606 + tristate "Analog Devices AD7606 ADC driver" + depends on GPIOLIB || COMPILE_TEST + depends on HAS_IOMEM + select IIO_BUFFER + select IIO_TRIGGERED_BUFFER + help + Say yes here to build support for Analog Devices: + ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). + + To compile this driver as a module, choose M here: the + module will be called ad7606. + +config AD7606_IFACE_PARALLEL + tristate "parallel interface support" + depends on AD7606 + help + Say yes here to include parallel interface support on the AD7606 + ADC driver. + + To compile this driver as a module, choose M here: the + module will be called ad7606_parallel. + +config AD7606_IFACE_SPI + tristate "spi interface support" + depends on AD7606 + depends on SPI + help + Say yes here to include parallel interface support on the AD7606 + ADC driver. + + To compile this driver as a module, choose M here: the + module will be called ad7606_spi. + config AD7766 tristate "Analog Devices AD7766/AD7767 ADC driver" depends on SPI_MASTER diff --git a/drivers/iio/adc/Makefile b/drivers/iio/adc/Makefile index f8e1218..dfe7dea 100644 --- a/drivers/iio/adc/Makefile +++ b/drivers/iio/adc/Makefile @@ -9,6 +9,9 @@ obj-$(CONFIG_AD7291) += ad7291.o obj-$(CONFIG_AD7298) += ad7298.o obj-$(CONFIG_AD7923) += ad7923.o obj-$(CONFIG_AD7476) += ad7476.o +obj-$(CONFIG_AD7606_IFACE_PARALLEL) += ad7606_par.o +obj-$(CONFIG_AD7606_IFACE_SPI) += ad7606_spi.o +obj-$(CONFIG_AD7606) += ad7606.o obj-$(CONFIG_AD7766) += ad7766.o obj-$(CONFIG_AD7791) += ad7791.o obj-$(CONFIG_AD7793) += ad7793.o diff --git a/drivers/staging/iio/adc/ad7606.c b/drivers/iio/adc/ad7606.c similarity index 100% rename from drivers/staging/iio/adc/ad7606.c rename to drivers/iio/adc/ad7606.c diff --git a/drivers/staging/iio/adc/ad7606.h b/drivers/iio/adc/ad7606.h similarity index 100% rename from drivers/staging/iio/adc/ad7606.h rename to drivers/iio/adc/ad7606.h diff --git a/drivers/staging/iio/adc/ad7606_par.c b/drivers/iio/adc/ad7606_par.c similarity index 100% rename from drivers/staging/iio/adc/ad7606_par.c rename to drivers/iio/adc/ad7606_par.c diff --git a/drivers/staging/iio/adc/ad7606_spi.c b/drivers/iio/adc/ad7606_spi.c similarity index 100% rename from drivers/staging/iio/adc/ad7606_spi.c rename to drivers/iio/adc/ad7606_spi.c diff --git a/drivers/staging/iio/adc/Kconfig b/drivers/staging/iio/adc/Kconfig index deff899..995867b 100644 --- a/drivers/staging/iio/adc/Kconfig +++ b/drivers/staging/iio/adc/Kconfig @@ -3,40 +3,6 @@ # menu "Analog to digital converters" -config AD7606 - tristate "Analog Devices AD7606 ADC driver" - depends on GPIOLIB || COMPILE_TEST - depends on HAS_IOMEM - select IIO_BUFFER - select IIO_TRIGGERED_BUFFER - help - Say yes here to build support for Analog Devices: - ad7606, ad7606-6, ad7606-4 analog to digital converters (ADC). - - To compile this driver as a module, choose M here: the - module will be called ad7606. - -config AD7606_IFACE_PARALLEL - tristate "parallel interface support" - depends on AD7606 - help - Say yes here to include parallel interface support on the AD7606 - ADC driver. - - To compile this driver as a module, choose M here: the - module will be called ad7606_parallel. - -config AD7606_IFACE_SPI - tristate "spi interface support" - depends on AD7606 - depends on SPI - help - Say yes here to include parallel interface support on the AD7606 - ADC driver. - - To compile this dri
[PATCH] Staging: ks7010: ks7010_sdio.h: Fixed coding style error
Error - Complex macro not in parentheses and trailing whitespace Signed-off-by: Manoj Sawai --- drivers/staging/ks7010/ks7010_sdio.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/staging/ks7010/ks7010_sdio.h b/drivers/staging/ks7010/ks7010_sdio.h index 0f5fd848e23d..0165994605ac 100644 --- a/drivers/staging/ks7010/ks7010_sdio.h +++ b/drivers/staging/ks7010/ks7010_sdio.h @@ -81,11 +81,11 @@ /* AHB Data Window 0x01-0x01 */ #define DATA_WINDOW0x01 -#define WINDOW_SIZE64*1024 +#define WINDOW_SIZE(64 * 1024) #define KS7010_IRAM_ADDRESS0x0600 -/* +/* * struct define */ struct hw_info_t { -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 0/4] staging-greybus: Fine-tuning for four functions
From: Markus Elfring Date: Fri, 9 Dec 2016 15:25:35 +0100 A few update suggestions were taken into account from static source code analysis. Markus Elfring (4): One function call less in gb_camera_configure_streams() after error detection light: Use kcalloc() in two functions Check return value of a kstrndup() call in gb_lights_light_config() Use kcalloc() in gb_power_supplies_setup() drivers/staging/greybus/camera.c | 16 +--- drivers/staging/greybus/light.c| 12 drivers/staging/greybus/power_supply.c | 7 +++ 3 files changed, 20 insertions(+), 15 deletions(-) -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 1/4] staging: greybus: camera: One function call less in gb_camera_configure_streams() after error detection
From: Markus Elfring Date: Thu, 8 Dec 2016 18:25:13 +0100 The kfree() function was called in one case by the gb_camera_configure_streams() function during error handling even if the passed variable contained a null pointer. This issue was detected by using the Coccinelle software. Adjust a jump target according to the Linux coding style convention. Fixes: 3265edaf0d70433699eece915fcca6509332c0e8 ("greybus: Add driver for the camera class protocol") Signed-off-by: Markus Elfring --- drivers/staging/greybus/camera.c | 16 +--- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/drivers/staging/greybus/camera.c b/drivers/staging/greybus/camera.c index 1c5b41ae6774..4479caed81bd 100644 --- a/drivers/staging/greybus/camera.c +++ b/drivers/staging/greybus/camera.c @@ -537,14 +537,15 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, return -EINVAL; req_size = sizeof(*req) + nstreams * sizeof(req->config[0]); - resp_size = sizeof(*resp) + nstreams * sizeof(resp->config[0]); - req = kmalloc(req_size, GFP_KERNEL); - resp = kmalloc(resp_size, GFP_KERNEL); - if (!req || !resp) { - kfree(req); - kfree(resp); + if (!req) return -ENOMEM; + + resp_size = sizeof(*resp) + nstreams * sizeof(resp->config[0]); + resp = kmalloc(resp_size, GFP_KERNEL); + if (!resp) { + ret = -ENOMEM; + goto free_request; } req->num_streams = nstreams; @@ -647,8 +648,9 @@ static int gb_camera_configure_streams(struct gb_camera *gcam, done_skip_pm_put: mutex_unlock(&gcam->mutex); - kfree(req); kfree(resp); +free_request: + kfree(req); return ret; } -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 2/4] staging: greybus: light: Use kcalloc() in two functions
From: Markus Elfring Date: Fri, 9 Dec 2016 13:46:25 +0100 * Multiplications for the size determination of memory allocations indicated that array data structures should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of data structures by pointer dereferences to make the corresponding size determination a bit safer according to the Linux coding style convention. Fixes: 2870b52bae4c81823ffcb3ed2b0626fb39d64f48 ("greybus: lights: add lights implementation") Signed-off-by: Markus Elfring --- drivers/staging/greybus/light.c | 11 ++- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 8dffd8a7e762..27bfc20eb9a5 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -1030,9 +1030,9 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) light->channels_count = conf.channel_count; light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); - - light->channels = kzalloc(light->channels_count * - sizeof(struct gb_channel), GFP_KERNEL); + light->channels = kcalloc(light->channels_count, + sizeof(*light->channels), + GFP_KERNEL); if (!light->channels) return -ENOMEM; @@ -1168,8 +1168,9 @@ static int gb_lights_create_all(struct gb_lights *glights) if (ret < 0) goto out; - glights->lights = kzalloc(glights->lights_count * - sizeof(struct gb_light), GFP_KERNEL); + glights->lights = kcalloc(glights->lights_count, + sizeof(*glights->lights), + GFP_KERNEL); if (!glights->lights) { ret = -ENOMEM; goto out; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 3/4] staging: greybus: light: Check return value of a kstrndup() call in gb_lights_light_config()
From: Markus Elfring Date: Fri, 9 Dec 2016 14:36:16 +0100 A return value was not checked after a call of the function "kstrndup". This issue was detected by using the Coccinelle software. Add a bit of exception handling. Fixes: 2870b52bae4c81823ffcb3ed2b0626fb39d64f48 ("greybus: lights: add lights implementation") Signed-off-by: Markus Elfring --- drivers/staging/greybus/light.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/greybus/light.c b/drivers/staging/greybus/light.c index 27bfc20eb9a5..c9c377f40f56 100644 --- a/drivers/staging/greybus/light.c +++ b/drivers/staging/greybus/light.c @@ -1030,6 +1030,9 @@ static int gb_lights_light_config(struct gb_lights *glights, u8 id) light->channels_count = conf.channel_count; light->name = kstrndup(conf.name, NAMES_MAX, GFP_KERNEL); + if (!light->name) + return -ENOMEM; + light->channels = kcalloc(light->channels_count, sizeof(*light->channels), GFP_KERNEL); -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH 4/4] staging: greybus: power_supply: Use kcalloc() in gb_power_supplies_setup()
From: Markus Elfring Date: Fri, 9 Dec 2016 15:04:24 +0100 * A multiplication for the size determination of a memory allocation indicated that an array data structure should be processed. Thus use the corresponding function "kcalloc". This issue was detected by using the Coccinelle software. * Replace the specification of a data structure by a pointer dereference to make the corresponding size determination a bit safer according to the Linux coding style convention. Fixes: ffe2e2487a388cf01ec44439346363aa8d654cd4 ("greybus: power_supply: rework and operation changes") Signed-off-by: Markus Elfring --- drivers/staging/greybus/power_supply.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/drivers/staging/greybus/power_supply.c b/drivers/staging/greybus/power_supply.c index e85c988b7034..19080c7f1491 100644 --- a/drivers/staging/greybus/power_supply.c +++ b/drivers/staging/greybus/power_supply.c @@ -944,10 +944,9 @@ static int gb_power_supplies_setup(struct gb_power_supplies *supplies) if (ret < 0) goto out; - supplies->supply = kzalloc(supplies->supplies_count * -sizeof(struct gb_power_supply), -GFP_KERNEL); - + supplies->supply = kcalloc(supplies->supplies_count, + sizeof(*supplies->supply), + GFP_KERNEL); if (!supplies->supply) { ret = -ENOMEM; goto out; -- 2.11.0 ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 0/4] staging-greybus: Fine-tuning for four functions
On Fri, Dec 09, 2016 at 03:32:38PM +0100, SF Markus Elfring wrote: > From: Markus Elfring > Date: Fri, 9 Dec 2016 15:25:35 +0100 > > A few update suggestions were taken into account > from static source code analysis. Again, nope, sorry, not going to even look at these... ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH v3 1/9] staging: fsl-mc: move bus driver out of staging
> > > Where is the device freed? I see you trying to do some "odd" stuff in > > > fsl_mc_device_remove() by deleting and then putting a device structure. > > > I can't find a "release()" callback anywhere for your bus, where is it? > > > > > > What happens when the reference count falls to 0 for your struct device? > > > > Hrm...something seems wrong in free path, and I think this needs to > > be refactored. > > > > IIRC, when German (former maintainer) wrote that code he loosely based > > it on the register/unregister platform bus code: > > > > int platform_device_register(struct platform_device *pdev) > > { > > device_initialize(&pdev->dev); > > arch_setup_pdev_archdata(pdev); > > return platform_device_add(pdev); > > } > > void platform_device_unregister(struct platform_device *pdev) > > { > > platform_device_del(pdev); > > platform_device_put(pdev); > > } > > > > ...I'm puzzling over how that code handles a refcount of zero > > as I see no 'release' callback anywhere, but I must be missing > > something. > > > > In any case, we'll get this refactored. > > Have you tried removing a device? The kernel should complain loudly > about there not being a release function for your device. Yes, device removal has been working from day 1. A brief look seems to indicate that the ref count never goes to zero, which needs to be debugged. Thanks, Stuart ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
[PATCH] staging: vc04_services: Fix NULL ptr sparse warnings
In calls to queue_message() in vchiq_core.c, the "void *context" parameter is set as 0 rather than NULL. This patch amends each call to use the proper NULL pointer. The following sparse warnings are fixed: drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:1623:23: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:1976:47: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2075:47: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2095:47: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2907:39: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:2929:39: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3059:72: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3860:31: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3870:31: warning: Using plain integer as NULL pointer drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c:3880:31: warning: Using plain integer as NULL pointer Signed-off-by: Mike Kofron --- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 20 ++-- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c index 028e90b..32b00f8 100644 --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c @@ -1620,7 +1620,7 @@ parse_open(VCHIQ_STATE_T *state, VCHIQ_HEADER_T *header) /* No available service, or an invalid request - send a CLOSE */ if (queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_CLOSE, 0, VCHIQ_MSG_SRCPORT(msgid)), - NULL, 0, 0, 0) == VCHIQ_RETRY) + NULL, NULL, 0, 0) == VCHIQ_RETRY) goto bail_not_ready; return 1; @@ -1973,7 +1973,7 @@ parse_rx_slots(VCHIQ_STATE_T *state) /* Send a PAUSE in response */ if (queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), - NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK) + NULL, NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK) == VCHIQ_RETRY) goto bail_not_ready; if (state->is_master) @@ -2072,7 +2072,7 @@ slot_handler_func(void *v) pause_bulks(state); if (queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_PAUSE, 0, 0), - NULL, 0, 0, + NULL, NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK) != VCHIQ_RETRY) { vchiq_set_conn_state(state, @@ -2092,7 +2092,7 @@ slot_handler_func(void *v) case VCHIQ_CONNSTATE_RESUMING: if (queue_message(state, NULL, VCHIQ_MAKE_MSG(VCHIQ_MSG_RESUME, 0, 0), - NULL, 0, 0, QMFLAGS_NO_MUTEX_LOCK) + NULL, NULL, 0, QMFLAGS_NO_MUTEX_LOCK) != VCHIQ_RETRY) { if (state->is_master) resume_bulks(state); @@ -2904,7 +2904,7 @@ vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) (VCHIQ_MSG_CLOSE, service->localport, VCHIQ_MSG_DSTPORT(service->remoteport)), - NULL, 0, 0, 0); + NULL, NULL, 0, 0); } break; @@ -2926,7 +2926,7 @@ vchiq_close_service_internal(VCHIQ_SERVICE_T *service, int close_recvd) (VCHIQ_MSG_CLOSE, service->localport, VCHIQ_MSG_DSTPORT(service->remoteport)), - NULL, 0, 0, QMFLAGS_NO_MUTEX_UNLOCK); + NULL, NULL, 0, QMFLAGS_NO_MUTEX_UNLOCK); if (status == VCHIQ_SUCCESS) { if (!close_recvd) { @@ -3056,7 +3056,7 @@ vchiq_connect_internal(VCHIQ_STATE_T *state, VCHIQ_INS
Re: [PATCH] uio-hv-generic: store physical addresses instead of virtual
On Fri, 9 Dec 2016 12:44:40 +0100 Arnd Bergmann wrote: > gcc warns about the newly added driver when phys_addr_t is wider than > a pointer: > > drivers/uio/uio_hv_generic.c: In function 'hv_uio_mmap': > drivers/uio/uio_hv_generic.c:71:17: error: cast to pointer from integer of > different size [-Werror=int-to-pointer-cast] > virt_to_phys((void *)info->mem[mi].addr) >> PAGE_SHIFT, > drivers/uio/uio_hv_generic.c: In function 'hv_uio_probe': > drivers/uio/uio_hv_generic.c:140:5: error: cast from pointer to integer of > different size [-Werror=pointer-to-int-cast] >= (phys_addr_t)dev->channel->ringbuffer_pages; > drivers/uio/uio_hv_generic.c:147:3: error: cast from pointer to integer of > different size [-Werror=pointer-to-int-cast] >(phys_addr_t)vmbus_connection.int_page; > drivers/uio/uio_hv_generic.c:153:3: error: cast from pointer to integer of > different size [-Werror=pointer-to-int-cast] >(phys_addr_t)vmbus_connection.monitor_pages[1]; > > I can't see why we store a virtual address in a phys_addr_t here, > as the only user of that variable converts it into a physical > address anyway, so this moves the conversion to where it logically > fits according to the types. > > Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") > Signed-off-by: Arnd Bergmann Thanks, the code was inherited from outside, and only tested on x86_64. Not sure which platform and GCC version generates the warning, was this just W=1? Acked-by: Stephen Hemminger ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
On Fri, 9 Dec 2016 08:31:22 +0100 Greg KH wrote: > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > -Original Message- > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > Sent: Thursday, December 8, 2016 7:56 AM > > > To: KY Srinivasan > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial > > > numbers > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, k...@exchange.microsoft.com > > > wrote: > > > > From: Haiyang Zhang > > > > > > > > We currently use MAC address to match VF and synthetic NICs. Hyper-V > > > > provides a serial number to both devices for this purpose. This patch > > > > implements the matching based on VF serial numbers. This is the way > > > > specified by the protocol and more reliable. > > > > > > > > Signed-off-by: Haiyang Zhang > > > > Signed-off-by: K. Y. Srinivasan > > > > --- > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > --- > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > b/drivers/net/hyperv/netvsc_drv.c > > > > index 9522763..c5778cf 100644 > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > @@ -1165,9 +1165,10 @@ static void netvsc_free_netdev(struct > > > net_device *netdev) > > > > free_netdev(netdev); > > > > } > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > { > > > > struct net_device *dev; > > > > + struct net_device_context *ndev_ctx; > > > > > > > > ASSERT_RTNL(); > > > > > > > > @@ -1175,7 +1176,8 @@ static void netvsc_free_netdev(struct net_device > > > *netdev) > > > > if (dev->netdev_ops != &device_ops) > > > > continue; /* not a netvsc device */ > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > + ndev_ctx = netdev_priv(dev); > > > > + if (ndev_ctx->vf_serial == vfser) > > > > return dev; > > > > } > > > > > > > > @@ -1205,21 +1207,66 @@ static void netvsc_free_netdev(struct > > > net_device *netdev) > > > > return NULL; > > > > } > > > > > > > > +static u32 netvsc_get_vfser(struct net_device *vf_netdev) > > > > +{ > > > > + struct device *dev; > > > > + struct hv_device *hdev; > > > > + struct hv_pcibus_device *hbus = NULL; > > > > + struct list_head *iter; > > > > + struct hv_pci_dev *hpdev; > > > > + unsigned long flags; > > > > + u32 vfser = 0; > > > > + u32 count = 0; > > > > + > > > > + for (dev = &vf_netdev->dev; dev; dev = dev->parent) { > > > > > > You are going to walk the whole device tree backwards? That's crazy. > > > And foolish. And racy and broken (what happens if the tree changes > > > while you do this?) Where is the lock being grabbed while this happens? > > > What about reference counts? Do you see other drivers ever doing this > > > (if you do, point them out and I'll go yell at them too...) > > > > Greg, > > > > We are registering for netdev events. Coming into this function, the caller > > guarantees that the list of netdevs does not change - we assert this on > > entry: > > ASSERT_RTNL(). We are only walking up the device tree for the netdevs whose > > state change is being notified to us - the device tree being walked here is > > limited to > > netdevs under question. > > But a netdev is a child of some type of "real" device, and you are now > walking the tree of all devices up to the "root" parent device, which > means you will hit PCI bridges, USB controllers, and all sorts of fun > things if you are a child of those types of devices. > > And can't you tell if the netdev for this event, really is "your" > netdev? Or are you getting called this for "all" netdevs? Sorry, I > don't know this api, any pointers to it would be appreciated. > > > We have a reference to the device and we know the device is not going away. > > Is it not > > safe to dereference the parent pointer - after all the child has taken a > > reference on > > the parent as part of device_add() call. > > It might be, and might not be. There's a reason you don't see this > pattern anywhere in the kernel because of this... > > > > > + if (!dev_is_vmbus(dev)) > > > > + continue; > > > > > > Ick. > > > > > > Why isn't your parent pointer a vmbus device all the time? How could > > > you get burried down in the device hierarchy when you are the driver for > > > a specific bus type
RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
> -Original Message- > From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, December 9, 2016 1:21 PM > To: Greg KH > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang Zhang > ; linux-ker...@vger.kernel.org; > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > leann.ogasaw...@canonical.com; jasow...@redhat.com > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > serial numbers > > On Fri, 9 Dec 2016 08:31:22 +0100 > Greg KH wrote: > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > -Original Message- > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > To: KY Srinivasan > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > serial > > > > numbers > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > k...@exchange.microsoft.com > > > > wrote: > > > > > From: Haiyang Zhang > > > > > > > > > > We currently use MAC address to match VF and synthetic NICs. > Hyper-V > > > > > provides a serial number to both devices for this purpose. This > patch > > > > > implements the matching based on VF serial numbers. This is the > way > > > > > specified by the protocol and more reliable. > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > Signed-off-by: K. Y. Srinivasan > > > > > --- > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > --- > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > index 9522763..c5778cf 100644 > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > @@ -1165,9 +1165,10 @@ static void netvsc_free_netdev(struct > > > > net_device *netdev) > > > > > free_netdev(netdev); > > > > > } > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > { > > > > > struct net_device *dev; > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void netvsc_free_netdev(struct > net_device > > > > *netdev) > > > > > if (dev->netdev_ops != &device_ops) > > > > > continue; /* not a netvsc device */ > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > + ndev_ctx = netdev_priv(dev); > > > > > + if (ndev_ctx->vf_serial == vfser) > > > > > return dev; > > > > > } > > > > > > > > > > @@ -1205,21 +1207,66 @@ static void netvsc_free_netdev(struct > > > > net_device *netdev) > > > > > return NULL; > > > > > } > > > > > > > > > > +static u32 netvsc_get_vfser(struct net_device *vf_netdev) > > > > > +{ > > > > > + struct device *dev; > > > > > + struct hv_device *hdev; > > > > > + struct hv_pcibus_device *hbus = NULL; > > > > > + struct list_head *iter; > > > > > + struct hv_pci_dev *hpdev; > > > > > + unsigned long flags; > > > > > + u32 vfser = 0; > > > > > + u32 count = 0; > > > > > + > > > > > + for (dev = &vf_netdev->dev; dev; dev = dev->parent) { > > > > > > > > You are going to walk the whole device tree backwards? That's > crazy. > > > > And foolish. And racy and broken (what happens if the tree > changes > > > > while you do this?) Where is the lock being grabbed while this > happens? > > > > What about reference counts? Do you see other drivers ever doing > this > > > > (if you do, point them out and I'll go yell at them too...) > > > > > > Greg, > > > > > > We are registering for netdev events. Coming into this function, the > caller > > > guarantees that the list of netdevs does not change - we assert this > on entry: > > > ASSERT_RTNL(). We are only walking up the device tree for the > netdevs whose > > > state change is being notified to us - the device tree being walked > here is limited to > > > netdevs under question. > > > > But a netdev is a child of some type of "real" device, and you are now > > walking the tree of all devices up to the "root" parent device, which > > means you will hit PCI bridges, USB controllers, and all sorts of fun > > things if you are a child of those types of devices. > > > > And can't you tell if the netdev for this event, really is "your" > > netdev? Or are you getting called this for "all" netdevs? Sorry, I > > don't know this api, any pointers to it would be appreciated. > > > > > We have a reference to the device and we know the device is no
Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
On Fri, 9 Dec 2016 20:09:49 + Haiyang Zhang wrote: > > -Original Message- > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Friday, December 9, 2016 1:21 PM > > To: Greg KH > > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang Zhang > > ; linux-ker...@vger.kernel.org; > > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > serial numbers > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > Greg KH wrote: > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > > > > -Original Message- > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > To: KY Srinivasan > > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > serial > > > > > numbers > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > k...@exchange.microsoft.com > > > > > wrote: > > > > > > From: Haiyang Zhang > > > > > > > > > > > > We currently use MAC address to match VF and synthetic NICs. > > Hyper-V > > > > > > provides a serial number to both devices for this purpose. This > > patch > > > > > > implements the matching based on VF serial numbers. This is the > > way > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > --- > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > --- > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > index 9522763..c5778cf 100644 > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > @@ -1165,9 +1165,10 @@ static void netvsc_free_netdev(struct > > > > > net_device *netdev) > > > > > > free_netdev(netdev); > > > > > > } > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) > > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > > { > > > > > > struct net_device *dev; > > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void netvsc_free_netdev(struct > > net_device > > > > > *netdev) > > > > > > if (dev->netdev_ops != &device_ops) > > > > > > continue; /* not a netvsc device */ > > > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > > + ndev_ctx = netdev_priv(dev); > > > > > > + if (ndev_ctx->vf_serial == vfser) > > > > > > return dev; > > > > > > } > > > > > > > > > > > > @@ -1205,21 +1207,66 @@ static void netvsc_free_netdev(struct > > > > > net_device *netdev) > > > > > > return NULL; > > > > > > } > > > > > > > > > > > > +static u32 netvsc_get_vfser(struct net_device *vf_netdev) > > > > > > +{ > > > > > > + struct device *dev; > > > > > > + struct hv_device *hdev; > > > > > > + struct hv_pcibus_device *hbus = NULL; > > > > > > + struct list_head *iter; > > > > > > + struct hv_pci_dev *hpdev; > > > > > > + unsigned long flags; > > > > > > + u32 vfser = 0; > > > > > > + u32 count = 0; > > > > > > + > > > > > > + for (dev = &vf_netdev->dev; dev; dev = dev->parent) { > > > > > > > > > > You are going to walk the whole device tree backwards? That's > > crazy. > > > > > And foolish. And racy and broken (what happens if the tree > > changes > > > > > while you do this?) Where is the lock being grabbed while this > > happens? > > > > > What about reference counts? Do you see other drivers ever doing > > this > > > > > (if you do, point them out and I'll go yell at them too...) > > > > > > > > Greg, > > > > > > > > We are registering for netdev events. Coming into this function, the > > caller > > > > guarantees that the list of netdevs does not change - we assert this > > on entry: > > > > ASSERT_RTNL(). We are only walking up the device tree for the > > netdevs whose > > > > state change is being notified to us - the device tree being walked > > here is limited to > > > > netdevs under question. > > > > > > But a netdev is a child of some type of "real" device, and you are now > > > walking the tree of all devices up to the "root" parent device, which > > > means you will hit PCI bridges, USB controllers, and all sorts of f
Re: [PATCH] uio-hv-generic: store physical addresses instead of virtual
On Friday, December 9, 2016 9:28:44 AM CET Stephen Hemminger wrote: > On Fri, 9 Dec 2016 12:44:40 +0100 > Arnd Bergmann wrote: > > Fixes: 95096f2fbd10 ("uio-hv-generic: new userspace i/o driver for VMBus") > > Signed-off-by: Arnd Bergmann > > Thanks, the code was inherited from outside, and only tested on x86_64. > Not sure which platform and GCC version generates the warning, was this just > W=1? > > Acked-by: Stephen Hemminger This was a regular warning with a randconfig build on arm32, but it happens on any 32-bit architecture when CONFIG_PHYS_ADDR_T_64BIT is enabled. Arnd ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
> -Original Message- > From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, December 9, 2016 3:30 PM > To: Haiyang Zhang > Cc: Greg KH ; KY Srinivasan > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > leann.ogasaw...@canonical.com; jasow...@redhat.com > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > serial numbers > > On Fri, 9 Dec 2016 20:09:49 + > Haiyang Zhang wrote: > > > > -Original Message- > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > Sent: Friday, December 9, 2016 1:21 PM > > > To: Greg KH > > > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang Zhang > > > ; linux-ker...@vger.kernel.org; > > > bjorn.helg...@gmail.com; a...@canonical.com; > de...@linuxdriverproject.org; > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > > serial numbers > > > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > > Greg KH wrote: > > > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > > > > > > > -Original Message- > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > > To: KY Srinivasan > > > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching > based on > > > serial > > > > > > numbers > > > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > > k...@exchange.microsoft.com > > > > > > wrote: > > > > > > > From: Haiyang Zhang > > > > > > > > > > > > > > We currently use MAC address to match VF and synthetic NICs. > > > Hyper-V > > > > > > > provides a serial number to both devices for this purpose. > This > > > patch > > > > > > > implements the matching based on VF serial numbers. This is > the > > > way > > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > > --- > > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > > --- > > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > > index 9522763..c5778cf 100644 > > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > > @@ -1165,9 +1165,10 @@ static void netvsc_free_netdev(struct > > > > > > net_device *netdev) > > > > > > > free_netdev(netdev); > > > > > > > } > > > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) > > > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > > > { > > > > > > > struct net_device *dev; > > > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void netvsc_free_netdev(struct > > > net_device > > > > > > *netdev) > > > > > > > if (dev->netdev_ops != &device_ops) > > > > > > > continue; /* not a netvsc device */ > > > > > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > > > + ndev_ctx = netdev_priv(dev); > > > > > > > + if (ndev_ctx->vf_serial == vfser) > > > > > > > return dev; > > > > > > > } > > > > > > > > > > > > > > @@ -1205,21 +1207,66 @@ static void > netvsc_free_netdev(struct > > > > > > net_device *netdev) > > > > > > > return NULL; > > > > > > > } > > > > > > > > > > > > > > +static u32 netvsc_get_vfser(struct net_device *vf_netdev) > > > > > > > +{ > > > > > > > + struct device *dev; > > > > > > > + struct hv_device *hdev; > > > > > > > + struct hv_pcibus_device *hbus = NULL; > > > > > > > + struct list_head *iter; > > > > > > > + struct hv_pci_dev *hpdev; > > > > > > > + unsigned long flags; > > > > > > > + u32 vfser = 0; > > > > > > > + u32 count = 0; > > > > > > > + > > > > > > > + for (dev = &vf_netdev->dev; dev; dev = dev->parent) { > > > > > > > > > > > > You are going to walk the whole device tree backwards? That's > > > crazy. > > > > > > And foolish. And racy and broken (what happens if the tree > > > changes > > > > > > while you do this?) Where is the lock being grabbed while > this > > > happens? > > > > > > What about reference counts? Do you see other drivers ever > doing > > > this > > > > > > (if you do, point them out and I'll go yell at them too...) > > > > > > > > > > Greg, > > > > > > > > > > We are registering for netdev events. Coming into this funct
Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
On Fri, 9 Dec 2016 21:31:25 + Haiyang Zhang wrote: > > -Original Message- > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Friday, December 9, 2016 3:30 PM > > To: Haiyang Zhang > > Cc: Greg KH ; KY Srinivasan > > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > serial numbers > > > > On Fri, 9 Dec 2016 20:09:49 + > > Haiyang Zhang wrote: > > > > > > -Original Message- > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > Sent: Friday, December 9, 2016 1:21 PM > > > > To: Greg KH > > > > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang Zhang > > > > ; linux-ker...@vger.kernel.org; > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > de...@linuxdriverproject.org; > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > > > serial numbers > > > > > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > > > Greg KH wrote: > > > > > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > > > > > > > > > > -Original Message- > > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > > > To: KY Srinivasan > > > > > > > Cc: linux-ker...@vger.kernel.org; de...@linuxdriverproject.org; > > > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching > > based on > > > > serial > > > > > > > numbers > > > > > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > > > k...@exchange.microsoft.com > > > > > > > wrote: > > > > > > > > From: Haiyang Zhang > > > > > > > > > > > > > > > > We currently use MAC address to match VF and synthetic NICs. > > > > Hyper-V > > > > > > > > provides a serial number to both devices for this purpose. > > This > > > > patch > > > > > > > > implements the matching based on VF serial numbers. This is > > the > > > > way > > > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > > > --- > > > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > > > --- > > > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > index 9522763..c5778cf 100644 > > > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > @@ -1165,9 +1165,10 @@ static void netvsc_free_netdev(struct > > > > > > > net_device *netdev) > > > > > > > > free_netdev(netdev); > > > > > > > > } > > > > > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 *mac) > > > > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > > > > { > > > > > > > > struct net_device *dev; > > > > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void netvsc_free_netdev(struct > > > > net_device > > > > > > > *netdev) > > > > > > > > if (dev->netdev_ops != &device_ops) > > > > > > > > continue; /* not a netvsc device > > > > > > > > */ > > > > > > > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > > > > + ndev_ctx = netdev_priv(dev); > > > > > > > > + if (ndev_ctx->vf_serial == vfser) > > > > > > > > return dev; > > > > > > > > } > > > > > > > > > > > > > > > > @@ -1205,21 +1207,66 @@ static void > > netvsc_free_netdev(struct > > > > > > > net_device *netdev) > > > > > > > > return NULL; > > > > > > > > } > > > > > > > > > > > > > > > > +static u32 netvsc_get_vfser(struct net_device *vf_netdev) > > > > > > > > +{ > > > > > > > > + struct device *dev; > > > > > > > > + struct hv_device *hdev; > > > > > > > > + struct hv_pcibus_device *hbus = NULL; > > > > > > > > + struct list_head *iter; > > > > > > > > + struct hv_pci_dev *hpdev; > > > > > > > > + unsigned long flags; > > > > > > > > + u32 vfser = 0; > > > > > > > > + u32 count = 0; > > > > > > > > + > > > > > > > > + for (dev = &vf_netdev->dev; dev; dev = dev->parent) { > > > > > > > > > > > > > > You are going to walk the
Re: [PATCH v2 2/2] staging: iio: ad7606: move out of staging
Hi Eva, [auto build test WARNING on iio/togreg] [also build test WARNING on next-20161209] [cannot apply to v4.9-rc8] [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/Eva-Rachel-Retuya/staging-iio-ad7606-move-driver-out-of-staging/20161210-041408 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg config: blackfin-allmodconfig (attached as .config) compiler: bfin-uclinux-gcc (GCC) 6.2.0 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=blackfin All warnings (new ones prefixed by >>): In file included from ./arch/blackfin/include/generated/asm/div64.h:1:0, from include/linux/kernel.h:142, from include/linux/interrupt.h:5, from drivers/iio/adc/ad7606.c:9: drivers/iio/adc/ad7606.c: In function 'ad7606_probe': include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ ^ >> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div' st->scale_avail[i][1] = do_div(scale, 1) * 10; ^~ In file included from include/linux/linkage.h:4:0, from include/linux/kernel.h:6, from include/linux/interrupt.h:5, from drivers/iio/adc/ad7606.c:9: include/asm-generic/div64.h:220:25: warning: right shift count >= width of type [-Wshift-count-overflow] } else if (likely(((n) >> 32) == 0)) { \ ^ include/linux/compiler.h:167:40: note: in definition of macro 'likely' # define likely(x) __builtin_expect(!!(x), 1) ^ >> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div' st->scale_avail[i][1] = do_div(scale, 1) * 10; ^~ In file included from ./arch/blackfin/include/generated/asm/div64.h:1:0, from include/linux/kernel.h:142, from include/linux/interrupt.h:5, from drivers/iio/adc/ad7606.c:9: include/asm-generic/div64.h:224:22: error: passing argument 1 of '__div64_32' from incompatible pointer type [-Werror=incompatible-pointer-types] __rem = __div64_32(&(n), __base); \ ^ >> drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div' st->scale_avail[i][1] = do_div(scale, 1) * 10; ^~ include/asm-generic/div64.h:198:17: note: expected 'uint64_t * {aka long long unsigned int *}' but argument is of type 'unsigned int *' extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); ^~ cc1: some warnings being treated as errors vim +/do_div +440 drivers/iio/adc/ad7606.c b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 424 e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-05-18 425 st = iio_priv(indio_dev); e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-05-18 426 b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 427 st->dev = dev; b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 428 st->bops = bops; b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 429 st->base_address = base_address; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 430 /* tied to logic low, analog input range is +/- 5V */ c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 431 st->range = 0; e79e8027 drivers/staging/iio/adc/ad7606_core.c Lars-Peter Clausen 2016-10-19 432 st->oversampling = 1; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 433 /* Populate the scales, 2.5/2**16 then 5/2**16 */ c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 434 range = 5000; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 435 for (i = 0, j = 1; i < ARRAY_SIZE(st->scale_avail); i++, j--) { c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 436 scale = ((u64)range * 1) >> c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 437 ad7606_channels[1].scan_type.realbits; c22bfdb9 drivers/staging/iio/adc/
RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
> -Original Message- > From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, December 9, 2016 4:45 PM > To: Haiyang Zhang > Cc: Greg KH ; KY Srinivasan > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > leann.ogasaw...@canonical.com; jasow...@redhat.com > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > serial numbers > > On Fri, 9 Dec 2016 21:31:25 + > Haiyang Zhang wrote: > > > > -Original Message- > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > Sent: Friday, December 9, 2016 3:30 PM > > > To: Haiyang Zhang > > > Cc: Greg KH ; KY Srinivasan > > > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > > > bjorn.helg...@gmail.com; a...@canonical.com; > de...@linuxdriverproject.org; > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > > serial numbers > > > > > > On Fri, 9 Dec 2016 20:09:49 + > > > Haiyang Zhang wrote: > > > > > > > > -Original Message- > > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > > Sent: Friday, December 9, 2016 1:21 PM > > > > > To: Greg KH > > > > > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang > Zhang > > > > > ; linux-ker...@vger.kernel.org; > > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > > de...@linuxdriverproject.org; > > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based > on > > > > > serial numbers > > > > > > > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > > > > Greg KH wrote: > > > > > > > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > > > > > > > > > > > > > -Original Message- > > > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > > > > To: KY Srinivasan > > > > > > > > Cc: linux-ker...@vger.kernel.org; > de...@linuxdriverproject.org; > > > > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching > > > based on > > > > > serial > > > > > > > > numbers > > > > > > > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > > > > k...@exchange.microsoft.com > > > > > > > > wrote: > > > > > > > > > From: Haiyang Zhang > > > > > > > > > > > > > > > > > > We currently use MAC address to match VF and synthetic > NICs. > > > > > Hyper-V > > > > > > > > > provides a serial number to both devices for this > purpose. > > > This > > > > > patch > > > > > > > > > implements the matching based on VF serial numbers. This > is > > > the > > > > > way > > > > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > > > > --- > > > > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > > > > --- > > > > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > index 9522763..c5778cf 100644 > > > > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > @@ -1165,9 +1165,10 @@ static void > netvsc_free_netdev(struct > > > > > > > > net_device *netdev) > > > > > > > > > free_netdev(netdev); > > > > > > > > > } > > > > > > > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 > *mac) > > > > > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > > > > > { > > > > > > > > > struct net_device *dev; > > > > > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void > netvsc_free_netdev(struct > > > > > net_device > > > > > > > > *netdev) > > > > > > > > > if (dev->netdev_ops != &device_ops) > > > > > > > > > continue; /* not a netvsc device > > > > > > > > > */ > > > > > > > > > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > > > > > + ndev_ctx = netdev_priv(dev); > > > > > > > > > + if (ndev_ctx->vf_serial == vfser) > > > > > > > > > return dev; > > > > > > > > > } > > > > > > > > > > > > > > > > > > @@ -1205,21 +1207,66 @@ static void > > > netvsc_free_netdev(struct > > > > > > > > net_device *netdev) > > > > > > > > > return NULL; > > > > > > > > > } > > > > > > > > > > > > > > > > > > +st
Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
On Fri, 9 Dec 2016 21:53:49 + Haiyang Zhang wrote: > > -Original Message- > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > Sent: Friday, December 9, 2016 4:45 PM > > To: Haiyang Zhang > > Cc: Greg KH ; KY Srinivasan > > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > serial numbers > > > > On Fri, 9 Dec 2016 21:31:25 + > > Haiyang Zhang wrote: > > > > > > -Original Message- > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > Sent: Friday, December 9, 2016 3:30 PM > > > > To: Haiyang Zhang > > > > Cc: Greg KH ; KY Srinivasan > > > > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > de...@linuxdriverproject.org; > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > > > serial numbers > > > > > > > > On Fri, 9 Dec 2016 20:09:49 + > > > > Haiyang Zhang wrote: > > > > > > > > > > -Original Message- > > > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > > > Sent: Friday, December 9, 2016 1:21 PM > > > > > > To: Greg KH > > > > > > Cc: KY Srinivasan ; o...@aepfle.de; Haiyang > > Zhang > > > > > > ; linux-ker...@vger.kernel.org; > > > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > > > de...@linuxdriverproject.org; > > > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based > > on > > > > > > serial numbers > > > > > > > > > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > > > > > Greg KH wrote: > > > > > > > > > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan wrote: > > > > > > > > > > > > > > > > > > > > > > > > > -Original Message- > > > > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > > > > > To: KY Srinivasan > > > > > > > > > Cc: linux-ker...@vger.kernel.org; > > de...@linuxdriverproject.org; > > > > > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching > > > > based on > > > > > > serial > > > > > > > > > numbers > > > > > > > > > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > > > > > k...@exchange.microsoft.com > > > > > > > > > wrote: > > > > > > > > > > From: Haiyang Zhang > > > > > > > > > > > > > > > > > > > > We currently use MAC address to match VF and synthetic > > NICs. > > > > > > Hyper-V > > > > > > > > > > provides a serial number to both devices for this > > purpose. > > > > This > > > > > > patch > > > > > > > > > > implements the matching based on VF serial numbers. This > > is > > > > the > > > > > > way > > > > > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > > > > > --- > > > > > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > > > > > --- > > > > > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > index 9522763..c5778cf 100644 > > > > > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > @@ -1165,9 +1165,10 @@ static void > > netvsc_free_netdev(struct > > > > > > > > > net_device *netdev) > > > > > > > > > > free_netdev(netdev); > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 > > *mac) > > > > > > > > > > +static struct net_device *get_netvsc_byvfser(u32 vfser) > > > > > > > > > > { > > > > > > > > > > struct net_device *dev; > > > > > > > > > > + struct net_device_context *ndev_ctx; > > > > > > > > > > > > > > > > > > > > ASSERT_RTNL(); > > > > > > > > > > > > > > > > > > > > @@ -1175,7 +1176,8 @@ static void > > netvsc_free_netdev(struct > > > > > > net_device > > > > > > > > > *netdev) > > > > > > > > > > if (dev->netdev_ops != &device_ops) > > > > > > > > > > continue; /* not a netvsc device > > > > > > > > > > */ > > > > > > > > > > > > > > > > > > > > - if (ether_addr_equal(mac, dev->perm_addr)) > > > > > > > > > > + ndev_ctx = netdev_priv(dev); > > > > >
RE: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
> -Original Message- > From: Stephen Hemminger [mailto:step...@networkplumber.org] > Sent: Friday, December 9, 2016 5:05 PM > To: Haiyang Zhang > Cc: Greg KH ; KY Srinivasan > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > bjorn.helg...@gmail.com; a...@canonical.com; de...@linuxdriverproject.org; > leann.ogasaw...@canonical.com; jasow...@redhat.com > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > serial numbers > > On Fri, 9 Dec 2016 21:53:49 + > Haiyang Zhang wrote: > > > > -Original Message- > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > Sent: Friday, December 9, 2016 4:45 PM > > > To: Haiyang Zhang > > > Cc: Greg KH ; KY Srinivasan > > > ; o...@aepfle.de; linux-ker...@vger.kernel.org; > > > bjorn.helg...@gmail.com; a...@canonical.com; > de...@linuxdriverproject.org; > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on > > > serial numbers > > > > > > On Fri, 9 Dec 2016 21:31:25 + > > > Haiyang Zhang wrote: > > > > > > > > -Original Message- > > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > > Sent: Friday, December 9, 2016 3:30 PM > > > > > To: Haiyang Zhang > > > > > Cc: Greg KH ; KY Srinivasan > > > > > ; o...@aepfle.de; linux- > ker...@vger.kernel.org; > > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > > de...@linuxdriverproject.org; > > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching based > on > > > > > serial numbers > > > > > > > > > > On Fri, 9 Dec 2016 20:09:49 + > > > > > Haiyang Zhang wrote: > > > > > > > > > > > > -Original Message- > > > > > > > From: Stephen Hemminger [mailto:step...@networkplumber.org] > > > > > > > Sent: Friday, December 9, 2016 1:21 PM > > > > > > > To: Greg KH > > > > > > > Cc: KY Srinivasan ; o...@aepfle.de; > Haiyang > > > Zhang > > > > > > > ; linux-ker...@vger.kernel.org; > > > > > > > bjorn.helg...@gmail.com; a...@canonical.com; > > > > > de...@linuxdriverproject.org; > > > > > > > leann.ogasaw...@canonical.com; jasow...@redhat.com > > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF matching > based > > > on > > > > > > > serial numbers > > > > > > > > > > > > > > On Fri, 9 Dec 2016 08:31:22 +0100 > > > > > > > Greg KH wrote: > > > > > > > > > > > > > > > On Fri, Dec 09, 2016 at 12:05:53AM +, KY Srinivasan > wrote: > > > > > > > > > > > > > > > > > > > > > > > > > > > > -Original Message- > > > > > > > > > > From: Greg KH [mailto:gre...@linuxfoundation.org] > > > > > > > > > > Sent: Thursday, December 8, 2016 7:56 AM > > > > > > > > > > To: KY Srinivasan > > > > > > > > > > Cc: linux-ker...@vger.kernel.org; > > > de...@linuxdriverproject.org; > > > > > > > > > > o...@aepfle.de; a...@canonical.com; vkuzn...@redhat.com; > > > > > > > > > > jasow...@redhat.com; leann.ogasaw...@canonical.com; > > > > > > > > > > bjorn.helg...@gmail.com; Haiyang Zhang > > > > > > > > > > > > > Subject: Re: [PATCH 3/3] hv_netvsc: Implement VF > matching > > > > > based on > > > > > > > serial > > > > > > > > > > numbers > > > > > > > > > > > > > > > > > > > > On Thu, Dec 08, 2016 at 12:33:43AM -0800, > > > > > > > k...@exchange.microsoft.com > > > > > > > > > > wrote: > > > > > > > > > > > From: Haiyang Zhang > > > > > > > > > > > > > > > > > > > > > > We currently use MAC address to match VF and > synthetic > > > NICs. > > > > > > > Hyper-V > > > > > > > > > > > provides a serial number to both devices for this > > > purpose. > > > > > This > > > > > > > patch > > > > > > > > > > > implements the matching based on VF serial numbers. > This > > > is > > > > > the > > > > > > > way > > > > > > > > > > > specified by the protocol and more reliable. > > > > > > > > > > > > > > > > > > > > > > Signed-off-by: Haiyang Zhang > > > > > > > > > > > Signed-off-by: K. Y. Srinivasan > > > > > > > > > > > --- > > > > > > > > > > > drivers/net/hyperv/netvsc_drv.c | 55 > > > > > > > > > > --- > > > > > > > > > > > 1 files changed, 51 insertions(+), 4 deletions(-) > > > > > > > > > > > > > > > > > > > > > > diff --git a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > > index 9522763..c5778cf 100644 > > > > > > > > > > > --- a/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > > +++ b/drivers/net/hyperv/netvsc_drv.c > > > > > > > > > > > @@ -1165,9 +1165,10 @@ static void > > > netvsc_free_netdev(struct > > > > > > > > > > net_device *netdev) > > > > > > > > > > > free_netdev(netdev); > > > > > > > > > > > } > > > > > > > > > > > > > > > > > > > > > > -static struct net_device *get_netvsc_bymac(const u8 > > > *mac) > > > > > > > > > > > +static struct net_device *get_netvsc_byvfser(u32 > vfser) > > > > > > > > > > > { > > > > > > > > > > > struct net_device *dev; > > > > > > > > > >
Re: [PATCH 10/14] rtlwifi: Add BTC_TRACE_STRING to new btcoex
On 12/09/2016 09:50 AM, Kalle Valo wrote: > Dan Carpenter writes: > >> On Thu, Dec 08, 2016 at 02:50:49PM +0300, Dan Carpenter wrote: >>> On Thu, Dec 08, 2016 at 01:43:42PM +0200, Kalle Valo wrote: But it would make me very happy if someone would add a similar grouping functionality to dyndbg to make it easy to enable a set of debug messages in a driver. >>> >>> Thats seems like a reasonable thing as well. >> >> I actually like the ath code... We could easily change it to be more >> generic and make it a top level function for everyone to use. > > That would be great. And maybe add a sysfs file with a description > different levels, like module parameters have. Too bad that I can't work > on that, too much stuff on my plate right now. > In this case I would like to step in and try to implement grouping of messages in the dynamic debug code. This seems to be an interesting learning opportunity. Regards, Markus ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH 3/3] hv_netvsc: Implement VF matching based on serial numbers
On Fri, 9 Dec 2016 22:35:05 + Haiyang Zhang wrote: > > > > > > > > Emulated NIC is already excluded in start of netvc notifier handler. > > > > > > > > static int netvsc_netdev_event(struct notifier_block *this, > > > >unsigned long event, void *ptr) > > > > { > > > > struct net_device *event_dev = netdev_notifier_info_to_dev(ptr); > > > > > > > > /* Skip our own events */ > > > > if (event_dev->netdev_ops == &device_ops) > > > > return NOTIFY_DONE; > > > > > > > > > > Emulated device is not based on netvsc. It's the native Linux > > (dec100M?) > > > Driver. So this line doesn't exclude it. And how about other NIC type > > > may be added in the future? > > > > Sorry, forgot about that haven't used emulated device in years. > > The emulated device should appear to be on a PCI bus, but the serial > > would not match?? > > It's not a vmbus device, not a hv_pci device either. Hv_PCI is a subset > of vmbus devices. So emulated NIC won't have hv_pci serial number. > > In my patch, the following code ensure, we only try to get serial number > after confirming it's vmbus and hv_pci device: > > + if (!dev_is_vmbus(dev)) > + continue; > + > + hdev = device_to_hv_device(dev); > + if (hdev->device_id != HV_PCIE) > + continue; Ok, the walk back up the device tree is logically ok, but I don't know enough about PCI device tree to be assured that it is safe. Also, you could short circuit away most of the unwanted devices by making sure the vf_netdev->dev.parent is a PCI device. Also the loop to look for serial number in the devices on the hv_pci bus could be made a separate function and have a short circuit return (although it probably doesn't matter since there will only be on e PCI VF device per bus there). ___ devel mailing list de...@linuxdriverproject.org http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel
Re: [PATCH v2 2/2] staging: iio: ad7606: move out of staging
Hi Eva, [auto build test WARNING on iio/togreg] [also build test WARNING on next-20161209] [cannot apply to v4.9-rc8] [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/Eva-Rachel-Retuya/staging-iio-ad7606-move-driver-out-of-staging/20161210-041408 base: https://git.kernel.org/pub/scm/linux/kernel/git/jic23/iio.git togreg config: xtensa-allyesconfig (attached as .config) compiler: xtensa-linux-gcc (GCC) 4.9.0 reproduce: wget https://git.kernel.org/cgit/linux/kernel/git/wfg/lkp-tests.git/plain/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross # save the attached .config to linux build tree make.cross ARCH=xtensa All warnings (new ones prefixed by >>): In file included from ./arch/xtensa/include/generated/asm/div64.h:1:0, from include/linux/kernel.h:142, from include/linux/interrupt.h:5, from drivers/iio/adc/ad7606.c:9: drivers/iio/adc/ad7606.c: In function 'ad7606_probe': include/asm-generic/div64.h:207:28: warning: comparison of distinct pointer types lacks a cast (void)(((typeof((n)) *)0) == ((uint64_t *)0)); \ ^ drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div' st->scale_avail[i][1] = do_div(scale, 1) * 10; ^ >> drivers/iio/adc/ad7606.c:440:3: warning: right shift count >= width of type st->scale_avail[i][1] = do_div(scale, 1) * 10; ^ In file included from ./arch/xtensa/include/generated/asm/div64.h:1:0, from include/linux/kernel.h:142, from include/linux/interrupt.h:5, from drivers/iio/adc/ad7606.c:9: include/asm-generic/div64.h:224:11: warning: passing argument 1 of '__div64_32' from incompatible pointer type __rem = __div64_32(&(n), __base); \ ^ drivers/iio/adc/ad7606.c:440:27: note: in expansion of macro 'do_div' st->scale_avail[i][1] = do_div(scale, 1) * 10; ^ include/asm-generic/div64.h:198:17: note: expected 'uint64_t *' but argument is of type 'unsigned int *' extern uint32_t __div64_32(uint64_t *dividend, uint32_t divisor); ^ vim +440 drivers/iio/adc/ad7606.c b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 424 e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-05-18 425 st = iio_priv(indio_dev); e61181d0 drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-05-18 426 b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 427 st->dev = dev; b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 428 st->bops = bops; b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 429 st->base_address = base_address; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 430 /* tied to logic low, analog input range is +/- 5V */ c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 431 st->range = 0; e79e8027 drivers/staging/iio/adc/ad7606_core.c Lars-Peter Clausen 2016-10-19 432 st->oversampling = 1; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 433 /* Populate the scales, 2.5/2**16 then 5/2**16 */ c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 434 range = 5000; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 435 for (i = 0, j = 1; i < ARRAY_SIZE(st->scale_avail); i++, j--) { c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 436 scale = ((u64)range * 1) >> c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 437 ad7606_channels[1].scan_type.realbits; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 438 scale >>= j; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 439 c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 @440 st->scale_avail[i][1] = do_div(scale, 1) * 10; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 441 st->scale_avail[i][0] = scale; c22bfdb9 drivers/staging/iio/adc/ad7606.c Eva Rachel Retuya 2016-12-09 442 } fa23105f drivers/staging/iio/adc/ad7606.c Lars-Peter Clausen 2016-10-19 443 INIT_WORK(&st->poll_work, &ad7606_poll_bh_to_ring); b9618c0c drivers/staging/iio/adc/ad7606_core.c Michael Hennerich 2011-02-22 444 12