[PATCH 1/1] Staging: iio: Coding Style Correction
Indentation corrections in struct initializations and one line over 80 characters split into two lines Signed-off-by: Tolga Ceylan --- drivers/staging/iio/magnetometer/hmc5843_i2c.c | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c b/drivers/staging/iio/magnetometer/hmc5843_i2c.c index 6acd614..e221a58 100644 --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c @@ -19,49 +19,49 @@ #include "hmc5843.h" static const struct regmap_range hmc5843_readable_ranges[] = { - regmap_reg_range(0, HMC5843_ID_END), + regmap_reg_range(0, HMC5843_ID_END), }; static struct regmap_access_table hmc5843_readable_table = { - .yes_ranges = hmc5843_readable_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), + .yes_ranges = hmc5843_readable_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), }; static const struct regmap_range hmc5843_writable_ranges[] = { - regmap_reg_range(0, HMC5843_MODE_REG), + regmap_reg_range(0, HMC5843_MODE_REG), }; static struct regmap_access_table hmc5843_writable_table = { - .yes_ranges = hmc5843_writable_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), + .yes_ranges = hmc5843_writable_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), }; static const struct regmap_range hmc5843_volatile_ranges[] = { - regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), + regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), }; static struct regmap_access_table hmc5843_volatile_table = { - .yes_ranges = hmc5843_volatile_ranges, - .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), + .yes_ranges = hmc5843_volatile_ranges, + .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), }; static struct regmap_config hmc5843_i2c_regmap_config = { - .reg_bits = 8, - .val_bits = 8, + .reg_bits = 8, + .val_bits = 8, - .rd_table = &hmc5843_readable_table, - .wr_table = &hmc5843_writable_table, - .volatile_table = &hmc5843_volatile_table, + .rd_table = &hmc5843_readable_table, + .wr_table = &hmc5843_writable_table, + .volatile_table = &hmc5843_volatile_table, - .cache_type = REGCACHE_RBTREE, + .cache_type = REGCACHE_RBTREE, }; static int hmc5843_i2c_probe(struct i2c_client *client, const struct i2c_device_id *id) { return hmc5843_common_probe(&client->dev, - devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), - id->driver_data); + devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), + id->driver_data); } static int hmc5843_i2c_remove(struct i2c_client *client) -- 2.3.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: ismt: fix type of return var of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. As ret is in used for other calls a new appropriately typed variable timeout is added to handle wait_for_completion_timeout Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with x86_64_defconfig + CONFIG_I2C_ISMT=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-ismt.c |5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-ismt.c b/drivers/i2c/busses/i2c-ismt.c index f2b0ff0..2197ac8 100644 --- a/drivers/i2c/busses/i2c-ismt.c +++ b/drivers/i2c/busses/i2c-ismt.c @@ -380,6 +380,7 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, int size, union i2c_smbus_data *data) { int ret; + unsigned long timeout; dma_addr_t dma_addr = 0; /* address of the data buffer */ u8 dma_size = 0; enum dma_data_direction dma_direction = 0; @@ -578,13 +579,13 @@ static int ismt_access(struct i2c_adapter *adap, u16 addr, ismt_submit_desc(priv); /* Now we wait for interrupt completion, 1s */ - ret = wait_for_completion_timeout(&priv->cmp, HZ*1); + timeout = wait_for_completion_timeout(&priv->cmp, HZ*1); /* unmap the data buffer */ if (dma_size != 0) dma_unmap_single(&adap->dev, dma_addr, dma_size, dma_direction); - if (unlikely(!ret)) { + if (unlikely(!timeout)) { dev_err(dev, "completion wait timed out\n"); ret = -ETIMEDOUT; goto out; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 0/3] More Line 6 cleanup
At Sat, 7 Feb 2015 10:43:16 -0600, Chris Rorvick wrote: > > Changes in v2: > > * return true/false instead of 1/0 > * do not include spaces in driver name > * drop patch altering struct names (unnecessary) Thanks, applied all three patches now. Takashi > > Chris Rorvick (3): > ALSA: line6: Add toneport_has_source_select() > ALSA: line6: Pass toneport pointer to toneport_has_led() > ALSA: line6: Pass driver name to line6_probe() > > sound/usb/line6/driver.c | 3 ++- > sound/usb/line6/driver.h | 3 +-- > sound/usb/line6/pod.c | 2 +- > sound/usb/line6/podhd.c| 2 +- > sound/usb/line6/toneport.c | 53 > +- > sound/usb/line6/variax.c | 2 +- > 6 files changed, 35 insertions(+), 30 deletions(-) > > -- > 2.1.0 > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: axxia: match var to return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as ret is only used for wait_for_completion_timeout here the type is simply changed unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with axm55xx_defconfig (implies CONFIG_I2C_AXXIA=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-axxia.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c index 768a598..1decc88 100644 --- a/drivers/i2c/busses/i2c-axxia.c +++ b/drivers/i2c/busses/i2c-axxia.c @@ -334,7 +334,7 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) u32 int_mask = MST_STATUS_ERR | MST_STATUS_SNS; u32 rx_xfer, tx_xfer; u32 addr_1, addr_2; - int ret; + unsigned long ret; if (msg->len > 255) { dev_warn(idev->dev, "unsupported length %u\n", msg->len); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: Re: [PATCH perf/core 1/2] [BUGFIX] perf-probe: Fix to handle optimized not-inlined but has no instance
(2015/01/30 23:21), Arnaldo Carvalho de Melo wrote: > Em Fri, Jan 30, 2015 at 06:37:44PM +0900, Masami Hiramatsu escreveu: >> Fix to handle optimized no-inline functions which have >> only function definition but no actual instance at >> that point. To fix this problem, we need to find actual >> instance of the function. >> >> Without this patch: >> >> # perf probe -a __up >> Failed to get entry address of __up. >> Error: Failed to add events. >> # perf probe -L __up >> Specified source line is not found. >> Error: Failed to show lines. >> >> >> With this patch: >> >> # perf probe -a __up >> Added new event: >> probe:__up (on __up) >> >> You can now use it in all perf tools, such as: >> >> perf record -e probe:__up -aR sleep 1 >> >> # perf probe -L __up >> <__up@/home/fedora/ksrc/linux-3/kernel/locking/semaphore.c:0> >> 0 static noinline void __sched __up(struct semaphore *sem) >>{ >> struct semaphore_waiter *waiter = >> list_first_entry(&sem->wait_ >> struct >> semaphore_waite >> 4 list_del(&waiter->list); >> 5 waiter->up = true; >> 6 wake_up_process(waiter->task); >> 7 } >> > > Since __up here was built in some other way, I looked for another > 'noinline' function to try, and it failed here: > > [root@zoo ~]# perf probe -L vmalloc_fault | head -5 > > 0 static noinline int vmalloc_fault(unsigned long address) > 1 { > pgd_t *pgd, *pgd_ref; > pud_t *pud, *pud_ref; > [root@zoo ~]# perf probe vmalloc_fault > Added new event: > Failed to write event: Invalid argument > Error: Failed to add events. > > >> APPLY THE PATCH, rebuild and try again: > > [root@zoo ~]# perf probe vmalloc_fault > Added new event: > Failed to write event: Invalid argument > Error: Failed to add events. > [root@zoo ~]# perf probe -v vmalloc_fault > probe-definition(0): vmalloc_fault > symbol:vmalloc_fault file:(null) line:0 offset:0 return:0 lazy:(null) > 0 arguments > Looking at the vmlinux_path (7 entries long) > Using /lib/modules/3.19.0-rc6+/build/vmlinux for symbols > Open Debuginfo file: /lib/modules/3.19.0-rc6+/build/vmlinux > Try to find probe point from debuginfo. > Probe point found: vmalloc_fault+0 > Found 1 probe_trace_events. > Opening /sys/kernel/debug/tracing/kprobe_events write=1 > Added new event: > Writing event: p:probe/vmalloc_fault _text+289600 > Failed to write event: Invalid argument > Error: Failed to add events. Reason: Invalid argument (Code: -22) > [root@zoo ~]# grep -w vmalloc_fault /proc/kallsyms > 81046b40 t vmalloc_fault > [root@zoo ~]# grep -w _text /proc/kallsyms > 8100 T _text > [root@zoo ~]# python > Python 2.7.5 (default, Nov 3 2014, 14:26:24) > [GCC 4.8.3 20140911 (Red Hat 4.8.3-7)] on linux2 > Type "help", "copyright", "credits" or "license" for more information. > >>> 0x81046b40 - 0x8100 > 289600L > >>> > [root@zoo ~]# readelf -s /lib/modules/3.19.0-rc6+/build/vmlinux | egrep -w > _text\|vmalloc_fault > 3499: 81046b40 410 FUNCLOCAL DEFAULT1 vmalloc_fault >48873: 8100 0 NOTYPE GLOBAL DEFAULT1 _text > [root@zoo ~]# > > --- > > So perhaps I need a 'noinline' _and_ '__sched', so that I have a "optimized > no-inline functions which have only function definition but no actual instance > at that point"? Ok, actually vmalloc_fault is marked as a nokprobe symbol. $ grep vmalloc_fault -r arch/x86/ arch/x86/mm/fault.c:static noinline int vmalloc_fault(unsigned long address) arch/x86/mm/fault.c:NOKPROBE_SYMBOL(vmalloc_fault); arch/x86/mm/fault.c:static noinline int vmalloc_fault(unsigned long address) arch/x86/mm/fault.c:NOKPROBE_SYMBOL(vmalloc_fault); arch/x86/mm/fault.c:if (vmalloc_fault(address) >= 0) All the symbols which marked by NOKPROBE_SYMBOL macro can not be kprobed. And we now have /kprobes/blacklist special file to get all nokprobe symbols. I'll make another perf-probe patch which looks the blacklist before trying define new events. Thank you, > > Looking for one, will post here after objdump -dS finishes... > > - Arnaldo > -- > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html > Please read the FAQ at http://www.tux.org/lkml/ > -- Masami HIRAMATSU Software Platform Research Dept. Linux Technology Research Center Hitachi, Ltd., Yokohama Research Laboratory E-mail: masami.hiramatsu...@hitachi.com -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a m
Re: [PATCH 0/2] Add device_create_files() and device_remove_files() helpers
At Sat, 7 Feb 2015 18:10:48 +0800, Greg Kroah-Hartman wrote: > > On Fri, Jan 30, 2015 at 05:31:51PM +0100, Takashi Iwai wrote: > > If we export device_add_groups() and device_remove_groups(), is it > > safe to call it before device_add()? If yes, some drivers/subsystems > > can have a code flow like: > > > > some_subsystem_init(struct device *dev) > > { > > device_initialize(dev); > > devs->groups = subsystem_groups; > > > > } > > > > driver_init(struct device *dev) > > { > > some_subsystem_init(dev); > > device_add_groups(dev, additional_groups); > > > > device_add(dev); > > > > } > > > > The network device has a own multi dev_groups array so that the driver > > can put an own group while the net core fills common groups > > dynamically just before the device registration call. I though of > > implementing similar for others (including the sound stuff), but if > > the scheme above works, the rewrite will become smaller. > > > > Of corse, the drawback of the explicit device_add_groups() call would > > be that you'll have to call device_remove_groups() at removal or error > > paths. > > Right now, no, you can't call device_add_groups() until after > device_add() happens, as it device_initialize() doesn't do enough sysfs > work in order to be able to create the files. OK, that's not so trivial as I hoped. One can add some list to manage the additional attributes, but it would put at least a pointer to each struct device, and it's certainly a waste that doesn't pay enough for the gain. BTW, I wonder whether we can drop many codes in the remove path. IIRC, kobject_del() should remove the whole sysfs files recursively, so we don't have to remove files individually. > > > > > > What if having a link to the chained group for appending entries > > > > > > dynamically? Just a wild idea, but it might make things easier. > > > > > > > > > > We have the ability to pass a group list pointer to device_create > > > > > already, and the attribute pointer is a list of groups as well, how > > > > > can > > > > > we change this to be "easier"? > > > > > > > > I guess the order is the problem. In many cases, you know the > > > > additional entries only after the device creation. The device > > > > creation is often done by a helper code. So the driver has no control > > > > to it, just gets the resultant device. > > > > > > Yeah, that's the problem. And another problem is drivers adding > > > attributes to devices after they are bound to a device, which is kind of > > > pointless, as the uevent is long past at that point in time. I've > > > cleaned up a bunch of those, but odds are there are still more to fix. > > > > Right, there are a bunch of drivers doing it. I guess partly because > > they don't need uevents for creation, but also partly because there is > > no way to give attribute groups properly in some cases. For example, > > misc_register() or register_framebuffer() calls device_create() so the > > caller can't pass groups. > > > > It'd be trivial to extend struct miscdevice to carry an optional group > > field and change the call to device_create_with_groups(). But, > > fb_info has also common sysfs entries, so it'd need also the solution > > above with device_add_groups() in addition. > > Your patch to do that looks good, I'll queue them all up after 3.20-rc1 > is out as it's too close to 3.19 at the moment. Yeah, 3.20 is good enough. Thanks for picking it up. I've submitted other cleanup patches to various subsystems, some have been merged for 3.20 and some are pending to 3.21, as it seems. There are still a few easy lowhanging fruits left, but mostly arch stuff (or arch-specific drivers). However, there are also many device_create_file() calls that can't be translated to static attribute groups. Namely, lots of drivers add the sysfs files onto the device that is being probed. That is, in xxx_probe() for a platform device or a pci device (or others), the driver puts new files to the probed device itself. I have no idea how this can be implemented in a better way. Takashi -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] at86rf230: assign wait_for_completion_timeout to appropriately typed var
return type of wait_for_completion_timeout is unsigned long not int. As rc is used here only for wait_for_completion_timeout the type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with x86_64_defconfig + CONFIG_IEEE802154=m, CONFIG_MAC802154=m CONFIG_SPI=m, CONFIG_IEEE802154_AT86RF230=m Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/net/ieee802154/at86rf230.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 7b051ea..cbfc8c5 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -689,7 +689,7 @@ at86rf230_sync_state_change_complete(void *context) static int at86rf230_sync_state_change(struct at86rf230_local *lp, unsigned int state) { - int rc; + unsigned long rc; at86rf230_async_state_change(lp, &lp->state, state, at86rf230_sync_state_change_complete, -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] kernel: Conditionally support non-root users, groups and capabilities
Hi Iulia, On Fri, Feb 6, 2015 at 2:10 PM, Iulia Manda wrote: > On 6 February 2015 at 02:03, Iulia Manda wrote: >> There are a lot of embedded systems that run most or all of their >> functionality >> in init, running as root:root. For these systems, supporting multiple users >> is >> not necessary. >> >> This patch adds a new symbol, CONFIG_MULTIUSER, that makes support for >> non-root >> users, non-root groups, and capabilities optional. It is enabled under >> CONFIG_EXPERT menu. >> >> When this symbol is not defined, UID and GID are zero in any possible case >> and processes always have all capabilities. >> >> The following syscalls are compiled out: setuid, setregid, setgid, >> setreuid, setresuid, getresuid, setresgid, getresgid, setgroups, getgroups, >> setfsuid, setfsgid, capget, capset. >> >> Also, groups.c is compiled out completely. >> >> This change saves about 25 KB on a defconfig build. >> >> The kernel was booted in Qemu. All the common functionalities work. Adding >> users/groups is not possible, failing with -ENOSYS. >> >> Bloat-o-meter output: >> add/remove: 7/87 grow/shrink: 19/397 up/down: 1675/-26325 (-24650) >> > > Forgot to add: > > Signed-off-by: Iulia Manda > Reviewed-by: Josh Triplett > >> --- >> Changes since v2: >> - rename symbol; >> - make SECURITY dependent on MULTIUSER >> > > + make symbols depend on MULTIUSER instead of selecting it. Thanks for the update! Acked-by: Geert Uytterhoeven Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] HID: sony: Enable Gasia third-party PS3 controllers, v2
Without this, my "Gasia Co.,Ltd PS(R) Gamepad" would not send any events. Now everything works including the leds. Based on work by Andrew Haines and Antonio Ospite. v2: - edited error messages - use output_report cc: Antonio Ospite cc: Andrew Haines Signed-off-by: Lauri Kasanen --- drivers/hid/hid-sony.c | 20 ++-- 1 file changed, 18 insertions(+), 2 deletions(-) Despite Andrew's report, using output_report worked fine. diff --git a/drivers/hid/hid-sony.c b/drivers/hid/hid-sony.c index 31e9d25..2661227 100644 --- a/drivers/hid/hid-sony.c +++ b/drivers/hid/hid-sony.c @@ -1131,7 +1131,8 @@ static void sony_input_configured(struct hid_device *hdev, static int sixaxis_set_operational_usb(struct hid_device *hdev) { int ret; - char *buf = kmalloc(18, GFP_KERNEL); + char *buf = kmalloc(65, GFP_KERNEL); + unsigned char buf2[] = { 0x00 }; if (!buf) return -ENOMEM; @@ -1140,7 +1141,22 @@ static int sixaxis_set_operational_usb(struct hid_device *hdev) HID_REQ_GET_REPORT); if (ret < 0) - hid_err(hdev, "can't set operational mode\n"); + hid_err(hdev, "can't set operational mode: step 1\n"); + + /* +* Some compatible controllers like the Speedlink Strike FX and +* Gasia need another query plus an USB interrupt to get operational. +*/ + ret = hid_hw_raw_request(hdev, 0xf5, buf, 64, HID_FEATURE_REPORT, +HID_REQ_GET_REPORT); + + if (ret < 0) + hid_err(hdev, "can't set operational mode: step 2\n"); + + ret = hid_hw_output_report(hdev, buf2, sizeof(buf2)); + + if (ret < 0) + hid_err(hdev, "can't set operational mode: step 3\n"); kfree(buf); -- 1.8.3.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 0/2] dma: at_hdmac: Fix residue calculation and add mem to mem sg support
From: Torsten Fleischer This series fixes the calculation of the residual bytes and adds support for memory to memory scatter-gather transfers. Torsten Fleischer (2): dma: at_hdmac: Fix calculation of the residual bytes dma: at_hdmac: Add support for memory to memory sg transfers drivers/dma/at_hdmac.c | 316 drivers/dma/at_hdmac_regs.h | 11 +- 2 files changed, 233 insertions(+), 94 deletions(-) -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] dma: at_hdmac: Add support for memory to memory sg transfers
From: Torsten Fleischer This patch adds support for memory to memory scatter-gather transfers. Signed-off-by: Torsten Fleischer --- drivers/dma/at_hdmac.c | 165 + 1 file changed, 154 insertions(+), 11 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index 0fb98a3..4d2dff6 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -60,6 +60,21 @@ static void atc_issue_pending(struct dma_chan *chan); /*--*/ +static inline unsigned int atc_get_xfer_width(dma_addr_t src, dma_addr_t dst, + size_t len) +{ + unsigned int width; + + if (!((src | dst | len) & 3)) + width = 2; + else if (!((src | dst | len) & 1)) + width = 1; + else + width = 0; + + return width; +} + static struct at_desc *atc_first_active(struct at_dma_chan *atchan) { return list_first_entry(&atchan->active_list, @@ -620,16 +635,10 @@ atc_prep_dma_memcpy(struct dma_chan *chan, dma_addr_t dest, dma_addr_t src, * We can be a lot more clever here, but this should take care * of the most common optimization. */ - if (!((src | dest | len) & 3)) { - ctrla = ATC_SRC_WIDTH_WORD | ATC_DST_WIDTH_WORD; - src_width = dst_width = 2; - } else if (!((src | dest | len) & 1)) { - ctrla = ATC_SRC_WIDTH_HALFWORD | ATC_DST_WIDTH_HALFWORD; - src_width = dst_width = 1; - } else { - ctrla = ATC_SRC_WIDTH_BYTE | ATC_DST_WIDTH_BYTE; - src_width = dst_width = 0; - } + src_width = dst_width = atc_get_xfer_width(src, dest, len); + + ctrla = ATC_SRC_WIDTH(src_width) | + ATC_DST_WIDTH(dst_width); for (offset = 0; offset < len; offset += xfer_count << src_width) { xfer_count = min_t(size_t, (len - offset) >> src_width, @@ -815,6 +824,134 @@ err: } /** + * atc_prep_dma_sg - prepare memory to memory scather-gather operation + * @chan: the channel to prepare operation on + * @dst_sg: destination scatterlist + * @dst_nents: number of destination scatterlist entries + * @src_sg: source scatterlist + * @src_nents: number of source scatterlist entries + * @flags: tx descriptor status flags + */ +static struct dma_async_tx_descriptor * +atc_prep_dma_sg(struct dma_chan *chan, + struct scatterlist *dst_sg, unsigned int dst_nents, + struct scatterlist *src_sg, unsigned int src_nents, + unsigned long flags) +{ + struct at_dma_chan *atchan = to_at_dma_chan(chan); + struct at_desc *desc = NULL; + struct at_desc *first = NULL; + struct at_desc *prev = NULL; + unsigned intsrc_width; + unsigned intdst_width; + size_t xfer_count; + u32 ctrla; + u32 ctrlb; + size_t dst_len = 0, src_len = 0; + dma_addr_t dst = 0, src = 0; + size_t len = 0, total_len = 0; + + if (unlikely(dst_nents == 0 || src_nents == 0)) + return NULL; + + if (unlikely(dst_sg == NULL || src_sg == NULL)) + return NULL; + + ctrlb = ATC_DEFAULT_CTRLB | ATC_IEN + | ATC_SRC_ADDR_MODE_INCR + | ATC_DST_ADDR_MODE_INCR + | ATC_FC_MEM2MEM; + + /* loop until there is either no more source or no more destination +* scatterlist entry */ + while (true) { + + /* prepare the next transfer */ + if (dst_len == 0) { + + /* no more destination scatterlist entries */ + if (!dst_sg || !dst_nents) + break; + + dst = sg_dma_address(dst_sg); + dst_len = sg_dma_len(dst_sg); + + dst_sg = sg_next(dst_sg); + dst_nents--; + } + + if (src_len == 0) { + + /* no more source scatterlist entries */ + if (!src_sg || !src_nents) + break; + + src = sg_dma_address(src_sg); + src_len = sg_dma_len(src_sg); + + src_sg = sg_next(src_sg); + src_nents--; + } + + len = min_t(size_t, src_len, dst_len); + if (len == 0) + continue; + + /* take care for the alignment */ + src_width = dst_width = atc_get_xfer_width(src, dst, len); + + ctrla = ATC_SRC_WIDTH(src_width) | + ATC_DST_WIDTH(dst_width); + + /* The number of
[PATCH 1/2] dma: at_hdmac: Fix calculation of the residual bytes
From: Torsten Fleischer This patch fixes the following issues regarding to the calculation of the residue: 1. The residue is always calculated for the current transfer even if the cookie is associated to a pending transfer. 2. For scatter/gather DMA the calculation of the residue for the current transfer doesn't include the bytes of the child descriptors that are already transferred. It only calculates the difference between the transfer's total length minus the number of bytes that are already transferred for the current child descriptor. For example: There is a scatter/gather DMA transfer with a total length of 1 MByte. Getting the residue several times while the transfer is running shows something like that: 1: residue = 975584 2: residue = 1002766 3: residue = 992627 4: residue = 983767 5: residue = 985694 6: residue = 1008094 7: residue = 1009741 8: residue = 1011195 3. The driver stores the residue but never resets it when starting a new transfer. For example: If there are two subsequent DMA transfers. The first one with a total length of 1 MByte and the second one with a total length of 1 kByte. Getting the residue for both transfers shows something like that: transfer 1: residue = 975584 transfer 2: residue = 1048380 Signed-off-by: Torsten Fleischer --- drivers/dma/at_hdmac.c | 151 ++-- drivers/dma/at_hdmac_regs.h | 11 ++-- 2 files changed, 79 insertions(+), 83 deletions(-) diff --git a/drivers/dma/at_hdmac.c b/drivers/dma/at_hdmac.c index ca9dd26..0fb98a3 100644 --- a/drivers/dma/at_hdmac.c +++ b/drivers/dma/at_hdmac.c @@ -233,93 +233,92 @@ static void atc_dostart(struct at_dma_chan *atchan, struct at_desc *first) } /* - * atc_get_current_descriptors - - * locate the descriptor which equal to physical address in DSCR - * @atchan: the channel we want to start - * @dscr_addr: physical descriptor address in DSCR + * atc_get_desc_by_cookie - get the descriptor of a cookie + * @atchan: the DMA channel + * @cookie: the cookie to get the descriptor for */ -static struct at_desc *atc_get_current_descriptors(struct at_dma_chan *atchan, - u32 dscr_addr) +static struct at_desc *atc_get_desc_by_cookie(struct at_dma_chan *atchan, + dma_cookie_t cookie) { - struct at_desc *desc, *_desc, *child, *desc_cur = NULL; + struct at_desc *desc, *_desc; - list_for_each_entry_safe(desc, _desc, &atchan->active_list, desc_node) { - if (desc->lli.dscr == dscr_addr) { - desc_cur = desc; - break; - } + list_for_each_entry_safe(desc, _desc, &atchan->queue, desc_node) { + if (desc->txd.cookie == cookie) + return desc; + } - list_for_each_entry(child, &desc->tx_list, desc_node) { - if (child->lli.dscr == dscr_addr) { - desc_cur = child; - break; - } - } + list_for_each_entry_safe(desc, _desc, &atchan->active_list, desc_node) { + if (desc->txd.cookie == cookie) + return desc; } - return desc_cur; + return NULL; } -/* - * atc_get_bytes_left - - * Get the number of bytes residue in dma buffer, - * @chan: the channel we want to start +/** + * atc_get_bytes_left - get the number of bytes residue for a cookie + * @chan: DMA channel + * @cookie: transaction identifier to check status of */ -static int atc_get_bytes_left(struct dma_chan *chan) +static int atc_get_bytes_left(struct dma_chan *chan, dma_cookie_t cookie) { struct at_dma_chan *atchan = to_at_dma_chan(chan); - struct at_dma *atdma = to_at_dma(chan->device); - int chan_id = atchan->chan_common.chan_id; struct at_desc *desc_first = atc_first_active(atchan); - struct at_desc *desc_cur; + struct at_desc *desc; int ret = 0, count = 0; + u32 ctrla, dscr; - /* -* Initialize necessary values in the first time. -* remain_desc record remain desc length. -*/ - if (atchan->remain_desc == 0) - /* First descriptor embedds the transaction length */ - atchan->remain_desc = desc_first->len; + /* If the cookie doesn't match to the currently running transfer then +* we can return the total length of the associated DMA transfer, +* because it is still queued. */ + desc = atc_get_desc_by_cookie(atchan, cookie); + if (desc == NULL) + return -EINVAL; + else if (desc != desc_first) + return desc->total_len; - /* -* This happens when current descriptor transfer complete. -* The residual buffer size should reduce current descriptor length. -*/ - if (unlikely(t
Re: [PATCH] at86rf230: assign wait_for_completion_timeout to appropriately typed var
On Sun, Feb 08, 2015 at 03:55:00AM -0500, Nicholas Mc Guire wrote: > return type of wait_for_completion_timeout is unsigned long not int. > As rc is used here only for wait_for_completion_timeout the type is simply > changed to unsigned long. > > Signed-off-by: Nicholas Mc Guire Acked-by: Alexander Aring Marcel, can you please queue this for bluetooth-next. Should be able to apply against bluetooth-next. Thanks. - Alex -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/1] Staging: rtl8192u: Coding Style Improvements
Lines over 80 were corrected Signed-off-by: Tolga Ceylan --- drivers/staging/rtl8192u/r8190_rtl8256.c | 244 ++- 1 file changed, 174 insertions(+), 70 deletions(-) diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c b/drivers/staging/rtl8192u/r8190_rtl8256.c index 1868352..3c3e85f 100644 --- a/drivers/staging/rtl8192u/r8190_rtl8256.c +++ b/drivers/staging/rtl8192u/r8190_rtl8256.c @@ -37,43 +37,71 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, HT_CHANNEL_WIDTH Bandwidth) switch (Bandwidth) { case HT_CHANNEL_WIDTH_20: - if (priv->card_8192_version == VERSION_819xU_A - || priv->card_8192_version - == VERSION_819xU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */ - rtl8192_phy_SetRFReg(dev, - (RF90_RADIO_PATH_E)eRFPath, - 0x0b, bMask12Bits, 0x100); /* phy para:1ba */ - rtl8192_phy_SetRFReg(dev, - (RF90_RADIO_PATH_E)eRFPath, - 0x2c, bMask12Bits, 0x3d7); + /* 8256 D-cut, E-cut, xiong: consider it later! */ + if (priv->card_8192_version == VERSION_819xU_A + || priv->card_8192_version == VERSION_819xU_B) { + + /* phy para:1ba */ + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x0b, bMask12Bits, 0x100); + + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x2c, bMask12Bits, 0x3d7); + + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x0e, bMask12Bits, 0x021); + + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x14, bMask12Bits, 0x5ab); + + } else { + RT_TRACE(COMP_ERR, + "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); + } + break; + case HT_CHANNEL_WIDTH_20_40: + /* 8256 D-cut, E-cut, xiong: consider it later! */ + if (priv->card_8192_version == VERSION_819xU_A || + priv->card_8192_version == VERSION_819xU_B) { + + /* phy para:3ba */ + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x0b, bMask12Bits, 0x300); + + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x2c, bMask12Bits, 0x3df); + + rtl8192_phy_SetRFReg(dev, + (RF90_RADIO_PATH_E)eRFPath, + 0x0e, bMask12Bits, 0x0a1); + + if (priv->chan == 3 || priv->chan == 9) + /* I need to set priv->chan whenever +* current channel changes +*/ rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, - 0x0e, bMask12Bits, 0x021); + 0x14, bMask12Bits, 0x59b); + else rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x14, bMask12Bits, 0x5ab); - } else { - RT_TRACE(COMP_ERR, "PHY_SetRF8256Bandwidth(): unknown hardware version\n"); - } - break; - case HT_CHANNEL_WIDTH_20_40: - if (priv->card_8192_version == VERSION_819xU_A || priv->card_8192_version == VERSION_819xU_B) { /* 8256 D-cut, E-cut, xiong: consider it later! */ - rtl8192_phy_SetRFReg(dev, (RF90_RADIO_PATH_E)eRFPath, 0x0b, bMask12Bits, 0x300); /* phy para:3ba */ - rtl8192_phy_SetRFReg(dev
Re: [PATCH 0/5] virtio 1.0 cleanups and one fix.
On Fri, Feb 06, 2015 at 03:36:51PM +1030, Rusty Russell wrote: > Hi all, > > Some minor fixes for my virtio-next tree. Michael, does > QEMU implement the (compuslory!) VIRTIO_PCI_CAP_PCI_CFG field? I'm > guessing not, since it wasn't defined in the Linux header :( Not yet, thanks for the reminder. BIOS is going to use that one so you can be sure it'll be there when support is merged finally. > Rusty Russell (5): > virtio: define VIRTIO_PCI_CAP_PCI_CFG in header. > virtio: Don't expose legacy block features when VIRTIO_BLK_NO_LEGACY > defined. > virtio: Don't expose legacy net features when VIRTIO_NET_NO_LEGACY > defined. > virtio: Don't expose legacy config features when > VIRTIO_CONFIG_NO_LEGACY defined. > virtio: don't require a config space on the console device. > > drivers/char/virtio_console.c | 12 > include/uapi/linux/virtio_blk.h| 17 + > include/uapi/linux/virtio_config.h | 2 ++ > include/uapi/linux/virtio_net.h| 30 -- > include/uapi/linux/virtio_pci.h| 4 +++- > 5 files changed, 54 insertions(+), 11 deletions(-) > > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] Staging: rtl8192u: Coding Style Improvements
On Sun, 2015-02-08 at 01:49 -0800, Tolga Ceylan wrote: > Lines over 80 were corrected [] > diff --git a/drivers/staging/rtl8192u/r8190_rtl8256.c > b/drivers/staging/rtl8192u/r8190_rtl8256.c [] > @@ -37,43 +37,71 @@ void PHY_SetRF8256Bandwidth(struct net_device *dev, > HT_CHANNEL_WIDTH Bandwidth) [] > + /* 8256 D-cut, E-cut, xiong: consider it later! */ > + if (priv->card_8192_version == VERSION_819xU_A > + || priv->card_8192_version == VERSION_819xU_B) { This is more commonly written: if (priv->card_8192_version == VERSION_819xU_A || priv->card_8192_version == VERSION_819xU_B) { -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] dm ioctl: Delete an unnecessary check before the function call "dm_table_destroy"
> Your proposed patch (while technically correct) hurts code clarity. How many source code readability and understanding challenges does each additional condition check cause? Can the affected place become also a bit more efficient? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: axxia: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as ret is only used for wait_for_completion_timeout here the type is simply changed unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with axm55xx_defconfig (implies CONFIG_I2C_AXXIA=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-axxia.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c index 1decc88..9434824 100644 --- a/drivers/i2c/busses/i2c-axxia.c +++ b/drivers/i2c/busses/i2c-axxia.c @@ -408,7 +408,7 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) static int axxia_i2c_stop(struct axxia_i2c_dev *idev) { u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC; - int ret; + unsigned long ret; reinit_completion(&idev->msg_complete); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: wmt: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as wait_result is only used for wait_for_completion_timeout here the type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with vt8500_v6_v7_defconfig (implies CONFIG_I2C_WMT=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-wmt.c |6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-wmt.c b/drivers/i2c/busses/i2c-wmt.c index 82ea349..464600a 100644 --- a/drivers/i2c/busses/i2c-wmt.c +++ b/drivers/i2c/busses/i2c-wmt.c @@ -128,7 +128,8 @@ static int wmt_i2c_write(struct i2c_adapter *adap, struct i2c_msg *pmsg, { struct wmt_i2c_dev *i2c_dev = i2c_get_adapdata(adap); u16 val, tcr_val; - int ret, wait_result; + int ret; + unsigned long wait_result; int xfer_len = 0; if (!(pmsg->flags & I2C_M_NOSTART)) { @@ -218,7 +219,8 @@ static int wmt_i2c_read(struct i2c_adapter *adap, struct i2c_msg *pmsg, { struct wmt_i2c_dev *i2c_dev = i2c_get_adapdata(adap); u16 val, tcr_val; - int ret, wait_result; + int ret; + unsigned long wait_result; u32 xfer_len = 0; if (!(pmsg->flags & I2C_M_NOSTART)) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: thunderbolt: Deletion of unnecessary checks before the function call "ring_free"
> Do symbols which are not exported (no EXPORT_SYMBOL_(GPL)) cause conflicts? How do you think about to mark more functions from your software module as static? > I was under the impression that those are module private. > If they are indeed private then I would prefer to not rename them. Would you like to help in avoiding difficulties around name space issues? Will specific prefixes make understanding a bit easier? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/5] virtio: Don't expose legacy net features when VIRTIO_NET_NO_LEGACY defined.
On Fri, Feb 06, 2015 at 03:36:54PM +1030, Rusty Russell wrote: > In particular, the virtio header always has the u16 num_buffers field. > We define a new 'struct virtio_net_modern_hdr' for this (rather than > simply calling it 'struct virtio_net_hdr', to avoid nasty type errors > if some parts of a project define VIRTIO_NET_NO_LEGACY and some don't. > > Signed-off-by: Rusty Russell > --- > include/uapi/linux/virtio_net.h | 30 -- > 1 file changed, 28 insertions(+), 2 deletions(-) > > diff --git a/include/uapi/linux/virtio_net.h b/include/uapi/linux/virtio_net.h > index b5f1677b291c..32754f3000e8 100644 > --- a/include/uapi/linux/virtio_net.h > +++ b/include/uapi/linux/virtio_net.h > @@ -35,7 +35,6 @@ > #define VIRTIO_NET_F_CSUM0 /* Host handles pkts w/ partial csum */ > #define VIRTIO_NET_F_GUEST_CSUM 1 /* Guest handles pkts w/ > partial csum */ > #define VIRTIO_NET_F_MAC 5 /* Host has given MAC address. */ > -#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ > #define VIRTIO_NET_F_GUEST_TSO4 7 /* Guest can handle TSOv4 in. */ > #define VIRTIO_NET_F_GUEST_TSO6 8 /* Guest can handle TSOv6 in. */ > #define VIRTIO_NET_F_GUEST_ECN 9 /* Guest can handle TSO[6] w/ > ECN in. */ > @@ -56,6 +55,10 @@ >* Steering */ > #define VIRTIO_NET_F_CTRL_MAC_ADDR 23/* Set MAC address */ > > +#ifndef VIRTIO_NET_NO_LEGACY > +#define VIRTIO_NET_F_GSO 6 /* Host handles pkts w/ any GSO type */ > +#endif /* VIRTIO_NET_NO_LEGACY */ > + > #define VIRTIO_NET_S_LINK_UP 1 /* Link is up */ > #define VIRTIO_NET_S_ANNOUNCE2 /* Announcement is needed */ > > @@ -71,8 +74,9 @@ struct virtio_net_config { > __u16 max_virtqueue_pairs; > } __attribute__((packed)); > > +#ifndef VIRTIO_NET_NO_LEGACY > /* This header comes first in the scatter-gather list. > - * If VIRTIO_F_ANY_LAYOUT is not negotiated, it must > + * For legacy virtio, if VIRTIO_F_ANY_LAYOUT is not negotiated, it must > * be the first element of the scatter-gather list. If you don't > * specify GSO or CSUM features, you can simply ignore the header. */ > struct virtio_net_hdr { > @@ -97,6 +101,28 @@ struct virtio_net_hdr_mrg_rxbuf { > struct virtio_net_hdr hdr; > __virtio16 num_buffers; /* Number of merged rx buffers */ > }; > +#else /* ... VIRTIO_NET_NO_LEGACY */ > +/* > + * This header comes first in the scatter-gather list. If you don't > + * specify GSO or CSUM features, you can simply ignore the header. > + */ > +struct virtio_net_modern_hdr { > +#define VIRTIO_NET_HDR_F_NEEDS_CSUM 1 /* Use csum_start, csum_offset > */ > +#define VIRTIO_NET_HDR_F_DATA_VALID 2 /* Csum is valid */ > + __u8 flags; > +#define VIRTIO_NET_HDR_GSO_NONE 0 /* Not a GSO frame */ > +#define VIRTIO_NET_HDR_GSO_TCPV4 1 /* GSO frame, IPv4 TCP (TSO) */ > +#define VIRTIO_NET_HDR_GSO_UDP 3 /* GSO frame, IPv4 UDP > (UFO) */ > +#define VIRTIO_NET_HDR_GSO_TCPV6 4 /* GSO frame, IPv6 TCP */ > +#define VIRTIO_NET_HDR_GSO_ECN 0x80/* TCP has ECN set */ > + __u8 gso_type; > + __virtio16 hdr_len; /* Ethernet + IP + tcp/udp hdrs */ > + __virtio16 gso_size;/* Bytes to append to hdr_len per frame */ > + __virtio16 csum_start; /* Position to start checksumming from */ > + __virtio16 csum_offset; /* Offset after that to place checksum */ > + __virtio16 num_buffers; /* Number of merged rx buffers */ > +}; > +#endif /* ...VIRTIO_NET_NO_LEGACY */ This kind of masks the fact that it's the same as virtio_net_hdr_mrg_rxbuf. So it's forcing people to duplicate code for transitional devices. How about struct virtio_net_modern_hdr { struct virtio_net_hdr_mrg_rxbuf hdr; } This will also make it look nicer when we start adding stuff in the header, the main header is separated in a struct by its own, so it's easy to apply operations such as sizeof. > /* > * Control virtqueue data structures > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/5] virtio: define VIRTIO_PCI_CAP_PCI_CFG in header.
On Fri, Feb 06, 2015 at 03:36:52PM +1030, Rusty Russell wrote: > This provides backdoor access to the device MMIOs, and every device should > have one. From the virtio 1.0 spec (CS03): > > 4.1.4.7.1 Device Requirements: PCI configuration access capability > > The device MUST present at least one VIRTIO_PCI_CAP_PCI_CFG capability. > > Signed-off-by: Rusty Russell Acked-by: Michael S. Tsirkin > --- > include/uapi/linux/virtio_pci.h | 4 +++- > 1 file changed, 3 insertions(+), 1 deletion(-) > > diff --git a/include/uapi/linux/virtio_pci.h b/include/uapi/linux/virtio_pci.h > index 3b7e4d2765fb..75301468359f 100644 > --- a/include/uapi/linux/virtio_pci.h > +++ b/include/uapi/linux/virtio_pci.h > @@ -109,8 +109,10 @@ > #define VIRTIO_PCI_CAP_NOTIFY_CFG2 > /* ISR access */ > #define VIRTIO_PCI_CAP_ISR_CFG 3 > -/* Device specific confiuration */ > +/* Device specific configuration */ > #define VIRTIO_PCI_CAP_DEVICE_CFG4 > +/* PCI configuration access */ > +#define VIRTIO_PCI_CAP_PCI_CFG 5 > > /* This is the PCI capability header: */ > struct virtio_pci_cap { > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/5] virtio: Don't expose legacy block features when VIRTIO_BLK_NO_LEGACY defined.
On Fri, Feb 06, 2015 at 03:36:53PM +1030, Rusty Russell wrote: > This allows modern implementations to ensure they don't use legacy > feature bits or SCSI commands (which are not used in v1.0 non-legacy). > > Signed-off-by: Rusty Russell Acked-by: Michael S. Tsirkin > --- > include/uapi/linux/virtio_blk.h | 17 + > 1 file changed, 13 insertions(+), 4 deletions(-) > > diff --git a/include/uapi/linux/virtio_blk.h b/include/uapi/linux/virtio_blk.h > index 247c8ba8544a..3c53eec4ae22 100644 > --- a/include/uapi/linux/virtio_blk.h > +++ b/include/uapi/linux/virtio_blk.h > @@ -31,22 +31,25 @@ > #include > > /* Feature bits */ > -#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ > #define VIRTIO_BLK_F_SIZE_MAX1 /* Indicates maximum segment > size */ > #define VIRTIO_BLK_F_SEG_MAX 2 /* Indicates maximum # of segments */ > #define VIRTIO_BLK_F_GEOMETRY4 /* Legacy geometry available */ > #define VIRTIO_BLK_F_RO 5 /* Disk is read-only */ > #define VIRTIO_BLK_F_BLK_SIZE6 /* Block size of disk is > available*/ > -#define VIRTIO_BLK_F_SCSI7 /* Supports scsi command passthru */ > -#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ > #define VIRTIO_BLK_F_TOPOLOGY10 /* Topology information is > available */ > -#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in > config */ > #define VIRTIO_BLK_F_MQ 12 /* support more than one vq */ > > +/* Legacy feature bits */ > +#ifndef VIRTIO_BLK_NO_LEGACY > +#define VIRTIO_BLK_F_BARRIER 0 /* Does host support barriers? */ > +#define VIRTIO_BLK_F_SCSI7 /* Supports scsi command passthru */ > +#define VIRTIO_BLK_F_WCE 9 /* Writeback mode enabled after reset */ > +#define VIRTIO_BLK_F_CONFIG_WCE 11 /* Writeback mode available in > config */ > #ifndef __KERNEL__ > /* Old (deprecated) name for VIRTIO_BLK_F_WCE. */ > #define VIRTIO_BLK_F_FLUSH VIRTIO_BLK_F_WCE > #endif > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > #define VIRTIO_BLK_ID_BYTES 20 /* ID string length */ > > @@ -100,8 +103,10 @@ struct virtio_blk_config { > #define VIRTIO_BLK_T_IN 0 > #define VIRTIO_BLK_T_OUT 1 > > +#ifndef VIRTIO_BLK_NO_LEGACY > /* This bit says it's a scsi command, not an actual read or write. */ > #define VIRTIO_BLK_T_SCSI_CMD2 > +#endif /* VIRTIO_BLK_NO_LEGACY */ > > /* Cache flush command */ > #define VIRTIO_BLK_T_FLUSH 4 > @@ -109,8 +114,10 @@ struct virtio_blk_config { > /* Get device ID command */ > #define VIRTIO_BLK_T_GET_ID8 > > +#ifndef VIRTIO_BLK_NO_LEGACY > /* Barrier before this op. */ > #define VIRTIO_BLK_T_BARRIER 0x8000 > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > /* This is the first element of the read scatter-gather list. */ > struct virtio_blk_outhdr { > @@ -122,12 +129,14 @@ struct virtio_blk_outhdr { > __virtio64 sector; > }; > > +#ifndef VIRTIO_BLK_NO_LEGACY > struct virtio_scsi_inhdr { > __virtio32 errors; > __virtio32 data_len; > __virtio32 sense_len; > __virtio32 residual; > }; > +#endif /* !VIRTIO_BLK_NO_LEGACY */ > > /* And this is the final byte of the write scatter-gather list. */ > #define VIRTIO_BLK_S_OK 0 > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/2] staging: unisys: remove unused variable
On Sat, Feb 07, 2015 at 05:22:16PM +0800, Greg Kroah-Hartman wrote: > On Fri, Feb 06, 2015 at 06:13:21PM +0530, Sudip Mukherjee wrote: > > we were getting lots of warnings about _tempresult set but not used. > > _tempresult was used in the macro ISSUE_IO_VMCALL_POSTCODE_SEVERITY > > which was again using another macro ISSUE_IO_EXTENDED_VMCALL. > > but the vallue assigned to it was never used. > > > > Signed-off-by: Sudip Mukherjee > > Your From: address, and this address don't match, so I can't take this > :( all my patches have been like this way, and you have taken them before :) the reason its like this way - (already discussed with Dan Carpenter, reference https://lkml.org/lkml/2014/9/3/473) we have strict DMARC check for the corporate mail server. DMARC = domain based message authentication. So the mail i sent reached all the list subscriber from a different server than our designated server, and as a result it is marked as spam in many places and I have already received a few complaints regarding that. so at https://lkml.org/lkml/2014/9/3/535 Dan said its ok for him, but depends on you if you want to accept. And since you have accepted all my patches before so i thought it is ok with you. if you want I can add an extra From: line, but Dan has already given his commments for that at https://lkml.org/lkml/2014/9/3/135 quoting him : "If everyone starts using From headers like this then it becomes a pain to deal with." please let me know how you want me to send the patches if different email address is a problem. I thought different name is a problem, but different email address??? > > Fix that up please and resend. > > Also, what tool generated those warnings? just make W=1 will give these warnings. regards sudip > > thanks, > > greg k-h -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/5] virtio: Don't expose legacy config features when VIRTIO_CONFIG_NO_LEGACY defined.
On Fri, Feb 06, 2015 at 03:36:55PM +1030, Rusty Russell wrote: > The VIRTIO_F_ANY_LAYOUT and VIRTIO_F_NOTIFY_ON_EMPTY features are pre-1.0 > only. > > Signed-off-by: Rusty Russell Acked-by: Michael S. Tsirkin > --- > include/uapi/linux/virtio_config.h | 2 ++ > 1 file changed, 2 insertions(+) > > diff --git a/include/uapi/linux/virtio_config.h > b/include/uapi/linux/virtio_config.h > index a6d0cdeaacd4..c18264df9504 100644 > --- a/include/uapi/linux/virtio_config.h > +++ b/include/uapi/linux/virtio_config.h > @@ -49,12 +49,14 @@ > #define VIRTIO_TRANSPORT_F_START 28 > #define VIRTIO_TRANSPORT_F_END 33 > > +#ifndef VIRTIO_CONFIG_NO_LEGACY > /* Do we get callbacks when the ring is completely used, even if we've > * suppressed them? */ > #define VIRTIO_F_NOTIFY_ON_EMPTY 24 > > /* Can the device handle any descriptor layout? */ > #define VIRTIO_F_ANY_LAYOUT 27 > +#endif /* VIRTIO_CONFIG_NO_LEGACY */ > > /* v1.0 compliant. */ > #define VIRTIO_F_VERSION_1 32 > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/5] virtio: don't require a config space on the console device.
On Fri, Feb 06, 2015 at 03:36:56PM +1030, Rusty Russell wrote: > Strictly, it's only needed when we have features (size or multiport). > > Signed-off-by: Rusty Russell > --- > drivers/char/virtio_console.c | 12 > 1 file changed, 8 insertions(+), 4 deletions(-) > > diff --git a/drivers/char/virtio_console.c b/drivers/char/virtio_console.c > index 26afb56a8073..8f182b0015b5 100644 > --- a/drivers/char/virtio_console.c > +++ b/drivers/char/virtio_console.c > @@ -1986,10 +1986,14 @@ static int virtcons_probe(struct virtio_device *vdev) > bool multiport; > bool early = early_put_chars != NULL; > > - if (!vdev->config->get) { > - dev_err(&vdev->dev, "%s failure: config access disabled\n", > - __func__); > - return -EINVAL; > + /* We only need a config space if features are offered */ > + if (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE) > + || virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) { > + if (!vdev->config->get) { I dislike nested ifs. How about if (!vdev->config->get && ( (virtio_has_feature(vdev, VIRTIO_CONSOLE_F_SIZE) || virtio_has_feature(vdev, VIRTIO_CONSOLE_F_MULTIPORT)) ? > + dev_err(&vdev->dev, "%s failure: config access > disabled\n", > + __func__); > + return -EINVAL; > + } > } > > /* Ensure to read early_put_chars now */ > -- > 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v8 2/3] i2c: iproc: Add Broadcom iProc I2C Driver
> > Is it really a HW limitation? Could the driver later be extended to > > continue filling the FIFO if a certain threshold is reached? > > > > Will return -EOPNOTSUPP. This really depends on whether or not we expect > one sequence of START + SLV ADDR + DATA + STOP per i2c message. I can > later extend the driver to refill/re-drain the FIFO for data size >= 64 > bytes, if one sequence of SATRT...STOP per message is not a requirement. It is important to have the terminology clear here: One transfer can consist of multiple messages. The transfer uses START/STOP at the beginning/end, the messages within the transfer only REPEATED_START. signature.asc Description: Digital signature
[PATCH] i2c: i2c-bcm2835: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as time_left is used for wait_for_completion_timeout exclusively here its type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-bcm2835.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-bcm2835.c b/drivers/i2c/busses/i2c-bcm2835.c index 5d6feb9..c9336a3 100644 --- a/drivers/i2c/busses/i2c-bcm2835.c +++ b/drivers/i2c/busses/i2c-bcm2835.c @@ -147,7 +147,7 @@ static int bcm2835_i2c_xfer_msg(struct bcm2835_i2c_dev *i2c_dev, struct i2c_msg *msg) { u32 c; - int time_left; + unsigned long time_left; i2c_dev->msg_buf = msg->buf; i2c_dev->msg_buf_remaining = msg->len; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/6] drivers: usb: core: hcd.c: remove assignment of variables in if conditions.
Hello. On 2/8/2015 12:55 AM, Bas Peters wrote: This patch removes assignment of variables in if conditions, as specified in CodingStyle. Signed-off-by: Bas Peters --- drivers/usb/core/hcd.c | 15 ++- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 11cee55..37c40d1 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c [...] @@ -2733,7 +2736,8 @@ int usb_add_hcd(struct usb_hcd *hcd, /* "reset" is misnamed; its role is now one-time init. the controller * should already have been reset (and boot firmware kicked off etc). */ - if (hcd->driver->reset && (retval = hcd->driver->reset(hcd)) < 0) { + retval = hcd->driver->reset(hcd); This will crash if 'hcd->driver->reset' is NULL (which is only checked below). + if (hcd->driver->reset && retval < 0) { It wasn't equivalent change anyway as the right part of && is only executed if the left part is true. WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 4/6] drivers: usb: core: hub.c: remove NULL initialization of static variables.
On 2/8/2015 12:55 AM, Bas Peters wrote: NULL Rather 0-. initialization of static variables is unnecessary as GCC kindly does this for us. It's rather the C run-time library that does this. Signed-off-by: Bas Peters [...] WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 5/6] drivers: usb: core: hub.c: remove assignment of variables in if conditions.
On 2/8/2015 12:55 AM, Bas Peters wrote: As specified in the CodingStyle. Signed-off-by: Bas Peters --- drivers/usb/core/hub.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 82983d9..9afe8b0 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c @@ -671,8 +671,8 @@ resubmit: if (hub->quiescing) return; - if ((status = usb_submit_urb (hub->urb, GFP_ATOMIC)) != 0 - && status != -ENODEV && status != -EPERM) + status = usb_submit_urb (hub->urb, GFP_ATOMIC); checkpatch.pl should also complain about space before (. [...] WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 2/3] drivers: usb: storage: cypress_atacb.c: trivial checkpatch fixes
On 2/8/2015 1:42 AM, Bas Peters wrote: Fixes errors thrown by checkpatch over a space issue and the incorrect indentation of a switch statement. Signed-off-by: Bas Peters --- drivers/usb/storage/cypress_atacb.c | 17 - 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/drivers/usb/storage/cypress_atacb.c b/drivers/usb/storage/cypress_atacb.c index 8514a2d..b3466d1 100644 --- a/drivers/usb/storage/cypress_atacb.c +++ b/drivers/usb/storage/cypress_atacb.c @@ -96,13 +96,13 @@ static void cypress_atacb_passthrough(struct scsi_cmnd *srb, struct us_data *us) if (save_cmnd[1] >> 5) /* MULTIPLE_COUNT */ goto invalid_fld; /* check protocol */ - switch((save_cmnd[1] >> 1) & 0xf) { - case 3: /*no DATA */ - case 4: /* PIO in */ - case 5: /* PIO out */ - break; - default: - goto invalid_fld; + switch ((save_cmnd[1] >> 1) & 0xf) { + case 3: /*no DATA */ Could also add space after /*, while at it. + case 4: /* PIO in */ + case 5: /* PIO out */ + break; + default: + goto invalid_fld; } /* first build the ATACB command */ [...] WBR, Sergei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] media:firewire:Remove unneeded function definition,avc_tuner_host2ca
On Feb 08 Nicholas Krause wrote: > Removes the function,avc_tuner_host2ca and the ifdef marco statements > around this function as there are no more callers of this function > and therefor no need for it's definition anymore. > > Signed-off-by: Nicholas Krause Your changelog is incorrect. If you had checked the history, you would have learned that the function was added without callers in the first place and never gained any callers since then. How about first checking what the Host2CA AV/C command is for, and then deciding on whether to add proper usage of it or to drop its implementation from the source for good. > --- > drivers/media/firewire/firedtv-avc.c | 31 --- > 1 file changed, 31 deletions(-) > > diff --git a/drivers/media/firewire/firedtv-avc.c > b/drivers/media/firewire/firedtv-avc.c > index 251a556..a7f2617 100644 > --- a/drivers/media/firewire/firedtv-avc.c > +++ b/drivers/media/firewire/firedtv-avc.c > @@ -912,37 +912,6 @@ void avc_remote_ctrl_work(struct work_struct *work) > avc_register_remote_control(fdtv); > } > > -#if 0 /* FIXME: unused */ > -int avc_tuner_host2ca(struct firedtv *fdtv) > -{ > - struct avc_command_frame *c = (void *)fdtv->avc_data; > - int ret; > - > - mutex_lock(&fdtv->avc_mutex); > - > - c->ctype = AVC_CTYPE_CONTROL; > - c->subunit = AVC_SUBUNIT_TYPE_TUNER | fdtv->subunit; > - c->opcode = AVC_OPCODE_VENDOR; > - > - c->operand[0] = SFE_VENDOR_DE_COMPANYID_0; > - c->operand[1] = SFE_VENDOR_DE_COMPANYID_1; > - c->operand[2] = SFE_VENDOR_DE_COMPANYID_2; > - c->operand[3] = SFE_VENDOR_OPCODE_HOST2CA; > - c->operand[4] = 0; /* slot */ > - c->operand[5] = SFE_VENDOR_TAG_CA_APPLICATION_INFO; /* ca tag */ > - clear_operands(c, 6, 8); > - > - fdtv->avc_data_length = 12; > - ret = avc_write(fdtv); > - > - /* FIXME: check response code? */ > - > - mutex_unlock(&fdtv->avc_mutex); > - > - return ret; > -} > -#endif > - > static int get_ca_object_pos(struct avc_response_frame *r) > { > int length = 1; -- Stefan Richter -=-= --=- -=--- http://arcgraph.de/sr/ -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: imx: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. An appropriate variable of type unsigned long is introduced and the assignments fixed up. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with imx_v6_v7_defconfig (implies CONFIG_I2C_IMX=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-imx.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c index d7b26fc..2840ff4 100644 --- a/drivers/i2c/busses/i2c-imx.c +++ b/drivers/i2c/busses/i2c-imx.c @@ -601,6 +601,7 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs) { int result; + unsigned long timeout; unsigned int temp = 0; unsigned long orig_jiffies = jiffies; struct imx_i2c_dma *dma = i2c_imx->dma; @@ -624,10 +625,10 @@ static int i2c_imx_dma_write(struct imx_i2c_struct *i2c_imx, */ imx_i2c_write_reg(msgs->addr << 1, i2c_imx, IMX_I2C_I2DR); reinit_completion(&i2c_imx->dma->cmd_complete); - result = wait_for_completion_timeout( + timeout = wait_for_completion_timeout( &i2c_imx->dma->cmd_complete, msecs_to_jiffies(DMA_TIMEOUT)); - if (result == 0) { + if (timeout == 0) { dmaengine_terminate_all(dma->chan_using); return -ETIMEDOUT; } @@ -663,6 +664,7 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx, struct i2c_msg *msgs, bool is_lastmsg) { int result; + unsigned long timeout; unsigned int temp; unsigned long orig_jiffies = jiffies; struct imx_i2c_dma *dma = i2c_imx->dma; @@ -682,10 +684,10 @@ static int i2c_imx_dma_read(struct imx_i2c_struct *i2c_imx, return result; reinit_completion(&i2c_imx->dma->cmd_complete); - result = wait_for_completion_timeout( + timeout = wait_for_completion_timeout( &i2c_imx->dma->cmd_complete, msecs_to_jiffies(DMA_TIMEOUT)); - if (result == 0) { + if (timeout == 0) { dmaengine_terminate_all(dma->chan_using); return -ETIMEDOUT; } -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v12 04/20] mm: Allow page fault handlers to perform the COW
On Thu, Feb 5, 2015 at 11:39 PM, Matthew Wilcox wrote: > > On Thu, Feb 05, 2015 at 11:16:53AM +0200, Yigal Korman wrote: > > I have a question on a related issue (I think). > > I've noticed that for pfn-only mappings (VM_FAULT_NOPAGE) > > do_shared_fault only maps the pfn with r/o permissions. > > So if I use DAX to write the mmap()-ed pfn I get two faults - first > > handled by do_shared_fault and then again for making it r/w in > > do_wp_page. > > Is this simply a missing optimization like was done here with the > > cow_page? or am I missing something? > > I have also noticed this behaviour. I tracked down why it's happening: > > DAX calls: > error = vm_insert_mixed(vma, vaddr, pfn); > which calls: > return insert_pfn(vma, addr, pfn, vma->vm_page_prot); > > If you insert some debugging, you'll notice here that vm_page_prot does > not include PROT_WRITE. > > That got cleared during mmap_region() where it does: > > if (vma_wants_writenotify(vma)) { > pgprot_t pprot = vma->vm_page_prot; > ... > vma->vm_page_prot = vm_get_page_prot(vm_flags & ~VM_SHARED); > > > And why do we want writenotify (according to the VM)? Because we have: > > /* The backer wishes to know when pages are first written to? */ > if (vma->vm_ops && vma->vm_ops->page_mkwrite) > return 1; > > We don't really want to be notified on a first write; we want the page to be > inserted write-enabled. But in the case where we've covered a hole with a > read-only zero page, we need to be notified so we can allocate a page of > storage. > > So, how to fix? We could adjust vm_page_prot to include PROT_WRITE. > I think that should work, since we'll only insert zeroed pages for read > faults, and so the maybe_mkwrite() won't be called in do_set_pte(). > I'm just not entirely sure where to set it. Perhaps a MM person could > make a helpful suggestion? I was thinking that do_shared_fault should simply call maybe_mkwrite() in case of VM_FAULT_NOPAGE. I think it's what do_wp_page does afterwards anyway: entry = maybe_mkwrite(pte_mkdirty(entry), vma); But I'm sure it's not the whole picture... Help from MM would indeed be appreciated. Y -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] Staging: iio: Coding Style Correction
On 08/02/15 08:04, Tolga Ceylan wrote: > Indentation corrections in struct initializations and > one line over 80 characters split into two lines > > Signed-off-by: Tolga Ceylan Whilst I find it hard to be inspired by these sort of patches, you have presented the patch well and it's entirely sensible. Only slight niggle that I've fixed is your patch title doesn't mention the driver in question (and hence is identical to the other patch you submitted at a quick glance). Anyhow, applied to the togreg branch of iio.git which will get pushed out as testing sometime soonish - perhaps controlled by when my plane actually shows up today > --- > drivers/staging/iio/magnetometer/hmc5843_i2c.c | 34 > +- > 1 file changed, 17 insertions(+), 17 deletions(-) > > diff --git a/drivers/staging/iio/magnetometer/hmc5843_i2c.c > b/drivers/staging/iio/magnetometer/hmc5843_i2c.c > index 6acd614..e221a58 100644 > --- a/drivers/staging/iio/magnetometer/hmc5843_i2c.c > +++ b/drivers/staging/iio/magnetometer/hmc5843_i2c.c > @@ -19,49 +19,49 @@ > #include "hmc5843.h" > > static const struct regmap_range hmc5843_readable_ranges[] = { > - regmap_reg_range(0, HMC5843_ID_END), > + regmap_reg_range(0, HMC5843_ID_END), > }; > > static struct regmap_access_table hmc5843_readable_table = { > - .yes_ranges = hmc5843_readable_ranges, > - .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), > + .yes_ranges = hmc5843_readable_ranges, > + .n_yes_ranges = ARRAY_SIZE(hmc5843_readable_ranges), > }; > > static const struct regmap_range hmc5843_writable_ranges[] = { > - regmap_reg_range(0, HMC5843_MODE_REG), > + regmap_reg_range(0, HMC5843_MODE_REG), > }; > > static struct regmap_access_table hmc5843_writable_table = { > - .yes_ranges = hmc5843_writable_ranges, > - .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), > + .yes_ranges = hmc5843_writable_ranges, > + .n_yes_ranges = ARRAY_SIZE(hmc5843_writable_ranges), > }; > > static const struct regmap_range hmc5843_volatile_ranges[] = { > - regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), > + regmap_reg_range(HMC5843_DATA_OUT_MSB_REGS, HMC5843_STATUS_REG), > }; > > static struct regmap_access_table hmc5843_volatile_table = { > - .yes_ranges = hmc5843_volatile_ranges, > - .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), > + .yes_ranges = hmc5843_volatile_ranges, > + .n_yes_ranges = ARRAY_SIZE(hmc5843_volatile_ranges), > }; > > static struct regmap_config hmc5843_i2c_regmap_config = { > - .reg_bits = 8, > - .val_bits = 8, > + .reg_bits = 8, > + .val_bits = 8, > > - .rd_table = &hmc5843_readable_table, > - .wr_table = &hmc5843_writable_table, > - .volatile_table = &hmc5843_volatile_table, > + .rd_table = &hmc5843_readable_table, > + .wr_table = &hmc5843_writable_table, > + .volatile_table = &hmc5843_volatile_table, > > - .cache_type = REGCACHE_RBTREE, > + .cache_type = REGCACHE_RBTREE, > }; > > static int hmc5843_i2c_probe(struct i2c_client *client, >const struct i2c_device_id *id) > { > return hmc5843_common_probe(&client->dev, > - devm_regmap_init_i2c(client, > &hmc5843_i2c_regmap_config), > - id->driver_data); > + devm_regmap_init_i2c(client, &hmc5843_i2c_regmap_config), > + id->driver_data); > } > > static int hmc5843_i2c_remove(struct i2c_client *client) > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/1] Staging: iio: Coding style correction
On 08/02/15 07:40, Tolga Ceylan wrote: > Line over 80 characters corrected > > Signed-off-by: Tolga Ceylan Applied, again with an amended patch title to reflect the driver it is changing rather that simply the subsystem. > --- > drivers/staging/iio/meter/ade7854-i2c.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/meter/ade7854-i2c.c > b/drivers/staging/iio/meter/ade7854-i2c.c > index 5b33c7f..5d0671a 100644 > --- a/drivers/staging/iio/meter/ade7854-i2c.c > +++ b/drivers/staging/iio/meter/ade7854-i2c.c > @@ -195,7 +195,8 @@ static int ade7854_i2c_read_reg_32(struct device *dev, > if (ret) > goto out; > > - *val = (st->rx[0] << 24) | (st->rx[1] << 16) | (st->rx[2] << 8) | > st->rx[3]; > + *val = (st->rx[0] << 24) | (st->rx[1] << 16) | > + (st->rx[2] << 8) | st->rx[3]; > out: > mutex_unlock(&st->buf_lock); > return ret; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: trigger: iio-trig-periodic-rtc: Change type in printf format string
On 27/01/15 21:32, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'unsigned int' > but the argument type is 'int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist Whilst you have identified a bug, I think the better fix would be to take frequency unsigned. It is always treated as such in the driver so they type should probably reflect this. If you want to put together such a patch that would be great. If not I'll get to it at some point (probably!) > --- > drivers/staging/iio/trigger/iio-trig-periodic-rtc.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c > b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c > index a24caf7..66d54a0 100644 > --- a/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c > +++ b/drivers/staging/iio/trigger/iio-trig-periodic-rtc.c > @@ -52,7 +52,7 @@ static ssize_t iio_trig_periodic_read_freq(struct device > *dev, > struct iio_trigger *trig = to_iio_trigger(dev); > struct iio_prtc_trigger_info *trig_info = iio_trigger_get_drvdata(trig); > > - return sprintf(buf, "%u\n", trig_info->frequency); > + return sprintf(buf, "%d\n", trig_info->frequency); > } > > static ssize_t iio_trig_periodic_write_freq(struct device *dev, > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: impedance-analyzer: ad5933: Change type in printf format string
On 27/01/15 22:18, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'int' > but the argument type is 'unsigned int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist Sorry, you were beaten to this one by Asaf Vertz a few weeks back. Jonathan > --- > drivers/staging/iio/impedance-analyzer/ad5933.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/impedance-analyzer/ad5933.c > b/drivers/staging/iio/impedance-analyzer/ad5933.c > index b6bd609..4230a43 100644 > --- a/drivers/staging/iio/impedance-analyzer/ad5933.c > +++ b/drivers/staging/iio/impedance-analyzer/ad5933.c > @@ -360,11 +360,11 @@ static ssize_t ad5933_show(struct device *dev, > mutex_lock(&indio_dev->mlock); > switch ((u32) this_attr->address) { > case AD5933_OUT_RANGE: > - len = sprintf(buf, "%d\n", > + len = sprintf(buf, "%u\n", > st->range_avail[(st->ctrl_hb >> 1) & 0x3]); > break; > case AD5933_OUT_RANGE_AVAIL: > - len = sprintf(buf, "%d %d %d %d\n", st->range_avail[0], > + len = sprintf(buf, "%u %u %u %u\n", st->range_avail[0], > st->range_avail[3], st->range_avail[2], > st->range_avail[1]); > break; > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 0/5] sched_clock: Optimize and avoid deadlock during read from NMI
This patchset optimizes the generic sched_clock implementation by removing branches and significantly reducing the data cache profile. It also makes it safe to call sched_clock() from NMI (or FIQ on ARM). The data cache profile of sched_clock() in the original code is somewhere between 2 and 3 (64-byte) cache lines, depending on alignment of struct clock_data. After patching, the cache profile for the normal case should be a single cacheline. NMI safety was tested on i.MX6 with perf drowning the system in FIQs and using the perf handler to check that sched_clock() returned monotonic values. At the same time I forcefully reduced kt_wrap so that update_sched_clock() is being called at >1000Hz. Without the patches the above system is grossly unstable, surviving [9K,115K,25K] perf event cycles during three separate runs. With the patch I ran for over 9M perf event cycles before getting bored. v4: * Optimized sched_clock() to be branchless by introducing a dummy function to provide clock values while the clock is suspended (Stephen Boyd). * Improved commenting, including the kerneldoc comments (Stephen Boyd). * Removed a redundant notrace from the update logic (Steven Rostedt). v3: * Optimized to minimise cache profile, including elimination of the suspended flag (Thomas Gleixner). * Replaced the update_bank_begin/end with a single update function (Thomas Gleixner). * Split into multiple patches to aid review. v2: * Extended the scope of the read lock in sched_clock() so we can bank all data consumed there (John Stultz) Daniel Thompson (5): sched_clock: Match scope of read and write seqcounts sched_clock: Optimize cache line usage sched_clock: Remove suspend from clock_read_data sched_clock: Remove redundant notrace from update function sched_clock: Avoid deadlock during read from NMI kernel/time/sched_clock.c | 195 -- 1 file changed, 138 insertions(+), 57 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 1/5] sched_clock: Match scope of read and write seqcounts
Currently the scope of the raw_write_seqcount_begin/end in sched_clock_register far exceeds the scope of the read section in sched_clock. This gives the impression of safety during cursory review but achieves little. Note that this is likely to be a latent issue at present because sched_clock_register() is typically called before we enable interrupts, however the issue does risk bugs being needlessly introduced as the code evolves. This patch fixes the problem by increasing the scope of the read locking performed by sched_clock() to cover all data modified by sched_clock_register. We also improve clarity by moving writes to struct clock_data that do not impact sched_clock() outside of the critical section. Signed-off-by: Daniel Thompson Cc: Russell King Cc: Will Deacon Cc: Catalin Marinas --- kernel/time/sched_clock.c | 25 +++-- 1 file changed, 11 insertions(+), 14 deletions(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 01d2d15aa662..3d21a8719444 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -58,23 +58,21 @@ static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) unsigned long long notrace sched_clock(void) { - u64 epoch_ns; - u64 epoch_cyc; - u64 cyc; + u64 cyc, res; unsigned long seq; - if (cd.suspended) - return cd.epoch_ns; - do { seq = raw_read_seqcount_begin(&cd.seq); - epoch_cyc = cd.epoch_cyc; - epoch_ns = cd.epoch_ns; + + res = cd.epoch_ns; + if (!cd.suspended) { + cyc = read_sched_clock(); + cyc = (cyc - cd.epoch_cyc) & sched_clock_mask; + res += cyc_to_ns(cyc, cd.mult, cd.shift); + } } while (read_seqcount_retry(&cd.seq, seq)); - cyc = read_sched_clock(); - cyc = (cyc - epoch_cyc) & sched_clock_mask; - return epoch_ns + cyc_to_ns(cyc, cd.mult, cd.shift); + return res; } /* @@ -124,10 +122,11 @@ void __init sched_clock_register(u64 (*read)(void), int bits, clocks_calc_mult_shift(&new_mult, &new_shift, rate, NSEC_PER_SEC, 3600); new_mask = CLOCKSOURCE_MASK(bits); + cd.rate = rate; /* calculate how many ns until we wrap */ wrap = clocks_calc_max_nsecs(new_mult, new_shift, 0, new_mask); - new_wrap_kt = ns_to_ktime(wrap - (wrap >> 3)); + cd.wrap_kt = ns_to_ktime(wrap - (wrap >> 3)); /* update epoch for new counter and update epoch_ns from old counter*/ new_epoch = read(); @@ -138,8 +137,6 @@ void __init sched_clock_register(u64 (*read)(void), int bits, raw_write_seqcount_begin(&cd.seq); read_sched_clock = read; sched_clock_mask = new_mask; - cd.rate = rate; - cd.wrap_kt = new_wrap_kt; cd.mult = new_mult; cd.shift = new_shift; cd.epoch_cyc = new_epoch; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: light: tsl2583: Change type in printf format string
On 27/01/15 22:19, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'int' > but the argument type is 'unsigned int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist This one is already fixed as well I'm afraid! > --- > drivers/staging/iio/light/tsl2583.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/light/tsl2583.c > b/drivers/staging/iio/light/tsl2583.c > index cc4ddcc..8afae8e 100644 > --- a/drivers/staging/iio/light/tsl2583.c > +++ b/drivers/staging/iio/light/tsl2583.c > @@ -692,7 +692,7 @@ static ssize_t taos_luxtable_show(struct device *dev, > int offset = 0; > > for (i = 0; i < ARRAY_SIZE(taos_device_lux); i++) { > - offset += sprintf(buf + offset, "%d,%d,%d,", > + offset += sprintf(buf + offset, "%u,%u,%u,", > taos_device_lux[i].ratio, > taos_device_lux[i].ch0, > taos_device_lux[i].ch1); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 3/5] sched_clock: Remove suspend from clock_read_data
Currently cd.read_data.suspended is read by the hotpath function sched_clock(). This variable need not be accessed on the hotpath. In fact, once it is removed, we can remove the conditional branches from sched_clock() and install a dummy read_sched_clock function to suspend the clock. The new master copy of the function pointer (actual_read_sched_clock) is introduced and is used this for all reads of the clock hardware except those within sched_clock itself. Suggested-by: Thomas Gleixner Signed-off-by: Daniel Thompson Cc: Russell King Cc: Will Deacon Cc: Catalin Marinas --- kernel/time/sched_clock.c | 40 +--- 1 file changed, 25 insertions(+), 15 deletions(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 695b2ac2e8b4..5d6407951fb8 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -28,10 +28,9 @@ * @read_sched_clock: Current clock source (or dummy source when suspended) * @mult: Multipler for scaled math conversion * @shift: Shift value for scaled math conversion - * @suspended: Flag to indicate if the clock is suspended (stopped) * * Care must be taken when updating this structure; it is read by - * some very hot code paths. It occupies <=48 bytes and, when combined + * some very hot code paths. It occupies <=40 bytes and, when combined * with the seqcount used to synchronize access, comfortably fits into * a 64 byte cache line. */ @@ -42,7 +41,6 @@ struct clock_read_data { u64 (*read_sched_clock)(void); u32 mult; u32 shift; - bool suspended; }; /** @@ -64,6 +62,7 @@ struct clock_data { struct clock_read_data read_data; ktime_t wrap_kt; unsigned long rate; + u64 (*actual_read_sched_clock)(void); }; static struct hrtimer sched_clock_timer; @@ -83,6 +82,8 @@ static u64 notrace jiffy_sched_clock_read(void) static struct clock_data cd cacheline_aligned = { .read_data = { .mult = NSEC_PER_SEC / HZ, .read_sched_clock = jiffy_sched_clock_read, }, + .actual_read_sched_clock = jiffy_sched_clock_read, + }; static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) @@ -99,12 +100,9 @@ unsigned long long notrace sched_clock(void) do { seq = raw_read_seqcount_begin(&cd.seq); - res = rd->epoch_ns; - if (!rd->suspended) { - cyc = rd->read_sched_clock(); - cyc = (cyc - rd->epoch_cyc) & rd->sched_clock_mask; - res += cyc_to_ns(cyc, rd->mult, rd->shift); - } + cyc = (rd->read_sched_clock() - rd->epoch_cyc) & + rd->sched_clock_mask; + res = rd->epoch_ns + cyc_to_ns(cyc, rd->mult, rd->shift); } while (read_seqcount_retry(&cd.seq, seq)); return res; @@ -120,7 +118,7 @@ static void notrace update_sched_clock(void) u64 ns; struct clock_read_data *rd = &cd.read_data; - cyc = rd->read_sched_clock(); + cyc = cd.actual_read_sched_clock(); ns = rd->epoch_ns + cyc_to_ns((cyc - rd->epoch_cyc) & rd->sched_clock_mask, rd->mult, rd->shift); @@ -166,10 +164,11 @@ void __init sched_clock_register(u64 (*read)(void), int bits, /* update epoch for new counter and update epoch_ns from old counter*/ new_epoch = read(); - cyc = rd->read_sched_clock(); + cyc = cd.actual_read_sched_clock(); ns = rd->epoch_ns + cyc_to_ns((cyc - rd->epoch_cyc) & rd->sched_clock_mask, rd->mult, rd->shift); + cd.actual_read_sched_clock = read; raw_write_seqcount_begin(&cd.seq); rd->read_sched_clock = read; @@ -209,7 +208,7 @@ void __init sched_clock_postinit(void) * If no sched_clock function has been provided at that point, * make it the final one one. */ - if (cd.read_data.read_sched_clock == jiffy_sched_clock_read) + if (cd.actual_read_sched_clock == jiffy_sched_clock_read) sched_clock_register(jiffy_sched_clock_read, BITS_PER_LONG, HZ); update_sched_clock(); @@ -223,13 +222,24 @@ void __init sched_clock_postinit(void) hrtimer_start(&sched_clock_timer, cd.wrap_kt, HRTIMER_MODE_REL); } +/* + * Clock read function for use when the clock is suspended. + * + * This function makes it appear to sched_clock() as if the clock + * stopped counting at its last update. + */ +static u64 notrace suspended_sched_clock_read(void) +{ + return cd.read_data.epoch_cyc; +} + static int sched_clock_suspend(void) { struct clock_read_data *rd = &cd.read_data; update_sched_clock(); hrtimer_cancel(&sched_clock_timer); - rd->suspended = true; + rd->read_sched_clock = suspended_sched_clock_read; return 0; } @@ -237,9 +247,9 @@ static
[PATCH v4 4/5] sched_clock: Remove redundant notrace from update function
Currently update_sched_clock() is marked as notrace but this function is not called by ftrace. This is trivially fixed by removing the mark up. Signed-off-by: Daniel Thompson --- kernel/time/sched_clock.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 5d6407951fb8..9280327676dc 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -111,7 +111,7 @@ unsigned long long notrace sched_clock(void) /* * Atomically update the sched_clock epoch. */ -static void notrace update_sched_clock(void) +static void update_sched_clock(void) { unsigned long flags; u64 cyc; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: magnetometer: hmc5843_core: Change type in printf format string
On 27/01/15 22:21, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'int' > but the argument type is 'unsigned int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist This one is fixed to I'm afraid. Very bad luck on timing as 2 weeks ago you'd have been first to post a patch for it. > --- > drivers/staging/iio/magnetometer/hmc5843_core.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/magnetometer/hmc5843_core.c > b/drivers/staging/iio/magnetometer/hmc5843_core.c > index fd171d8..cd049bb 100644 > --- a/drivers/staging/iio/magnetometer/hmc5843_core.c > +++ b/drivers/staging/iio/magnetometer/hmc5843_core.c > @@ -217,7 +217,7 @@ static ssize_t > hmc5843_show_measurement_configuration(struct device *dev, > return ret; > val &= HMC5843_MEAS_CONF_MASK; > > - return sprintf(buf, "%d\n", val); > + return sprintf(buf, "%u\n", val); > } > > static ssize_t hmc5843_set_measurement_configuration(struct device *dev, > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: light: tsl2x7x_core: Change type in printf format string
On 27/01/15 22:20, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'int' > but the argument type is 'unsigned int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist Another one with a fix already in place. > --- > drivers/staging/iio/light/tsl2x7x_core.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/staging/iio/light/tsl2x7x_core.c > b/drivers/staging/iio/light/tsl2x7x_core.c > index 423f96b..4a5dc26 100644 > --- a/drivers/staging/iio/light/tsl2x7x_core.c > +++ b/drivers/staging/iio/light/tsl2x7x_core.c > @@ -1147,7 +1147,7 @@ static ssize_t tsl2x7x_luxtable_show(struct device *dev, > int offset = 0; > > while (i < (TSL2X7X_MAX_LUX_TABLE_SIZE * 3)) { > - offset += snprintf(buf + offset, PAGE_SIZE, "%d,%d,%d,", > + offset += snprintf(buf + offset, PAGE_SIZE, "%u,%u,%u,", > chip->tsl2x7x_device_lux[i].ratio, > chip->tsl2x7x_device_lux[i].ch0, > chip->tsl2x7x_device_lux[i].ch1); > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v4 5/5] sched_clock: Avoid deadlock during read from NMI
Currently it is possible for an NMI (or FIQ on ARM) to come in and read sched_clock() whilst update_sched_clock() has locked the seqcount for writing. This results in the NMI handler locking up when it calls raw_read_seqcount_begin(). This patch fixes the NMI safety issues by providing banked clock data. This is a similar approach to the one used in Thomas Gleixner's 4396e058c52e("timekeeping: Provide fast and NMI safe access to CLOCK_MONOTONIC"). Suggested-by: Stephen Boyd Signed-off-by: Daniel Thompson Cc: Russell King Cc: Will Deacon Cc: Catalin Marinas --- kernel/time/sched_clock.c | 103 ++ 1 file changed, 68 insertions(+), 35 deletions(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 9280327676dc..a23d98c33dab 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -47,19 +47,20 @@ struct clock_read_data { * struct clock_data - all data needed for sched_clock (including * registration of a new clock source) * - * @seq: Sequence counter for protecting updates. + * @seq: Sequence counter for protecting updates. The lowest + * bit is the index for @read_data. * @read_data: Data required to read from sched_clock. * @wrap_kt: Duration for which clock can run before wrapping * @rate: Tick rate of the registered clock * @actual_read_sched_clock: Registered clock read function * * The ordering of this structure has been chosen to optimize cache - * performance. In particular seq and read_data (combined) should fit + * performance. In particular seq and read_data[0] (combined) should fit * into a single 64 byte cache line. */ struct clock_data { seqcount_t seq; - struct clock_read_data read_data; + struct clock_read_data read_data[2]; ktime_t wrap_kt; unsigned long rate; u64 (*actual_read_sched_clock)(void); @@ -80,10 +81,9 @@ static u64 notrace jiffy_sched_clock_read(void) } static struct clock_data cd cacheline_aligned = { - .read_data = { .mult = NSEC_PER_SEC / HZ, - .read_sched_clock = jiffy_sched_clock_read, }, + .read_data[0] = { .mult = NSEC_PER_SEC / HZ, + .read_sched_clock = jiffy_sched_clock_read, }, .actual_read_sched_clock = jiffy_sched_clock_read, - }; static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) @@ -95,10 +95,11 @@ unsigned long long notrace sched_clock(void) { u64 cyc, res; unsigned long seq; - struct clock_read_data *rd = &cd.read_data; + struct clock_read_data *rd; do { - seq = raw_read_seqcount_begin(&cd.seq); + seq = raw_read_seqcount(&cd.seq); + rd = cd.read_data + (seq & 1); cyc = (rd->read_sched_clock() - rd->epoch_cyc) & rd->sched_clock_mask; @@ -109,26 +110,50 @@ unsigned long long notrace sched_clock(void) } /* + * Updating the data required to read the clock. + * + * sched_clock will never observe mis-matched data even if called from + * an NMI. We do this by maintaining an odd/even copy of the data and + * steering sched_clock to one or the other using a sequence counter. + * In order to preserve the data cache profile of sched_clock as much + * as possible the system reverts back to the even copy when the update + * completes; the odd copy is used *only* during an update. + */ +static void update_clock_read_data(struct clock_read_data *rd) +{ + /* update the backup (odd) copy with the new data */ + cd.read_data[1] = *rd; + + /* steer readers towards the odd copy */ + raw_write_seqcount_latch(&cd.seq); + + /* now its safe for us to update the normal (even) copy */ + cd.read_data[0] = *rd; + + /* switch readers back to the even copy */ + raw_write_seqcount_latch(&cd.seq); +} + +/* * Atomically update the sched_clock epoch. */ static void update_sched_clock(void) { - unsigned long flags; u64 cyc; u64 ns; - struct clock_read_data *rd = &cd.read_data; + struct clock_read_data rd; + + rd = cd.read_data[0]; cyc = cd.actual_read_sched_clock(); - ns = rd->epoch_ns + -cyc_to_ns((cyc - rd->epoch_cyc) & rd->sched_clock_mask, - rd->mult, rd->shift); - - raw_local_irq_save(flags); - raw_write_seqcount_begin(&cd.seq); - rd->epoch_ns = ns; - rd->epoch_cyc = cyc; - raw_write_seqcount_end(&cd.seq); - raw_local_irq_restore(flags); + ns = rd.epoch_ns + +cyc_to_ns((cyc - rd.epoch_cyc) & rd.sched_clock_mask, + rd.mult, rd.shift); + + rd.epoch_ns = ns; + rd.epoch_cyc = cyc; + + update_clock_read_data(&rd); } static enum hrtimer_restart sched_clock_poll(struct hrtimer *hrt) @@ -145,7 +170,7 @
[PATCH v4 2/5] sched_clock: Optimize cache line usage
Currently sched_clock(), a very hot code path, is not optimized to minimise its cache profile. In particular: 1. cd is not cacheline_aligned, 2. struct clock_data does not distinguish between hotpath and coldpath data, reducing locality of reference in the hotpath, 3. Some hotpath data is missing from struct clock_data and is marked __read_mostly (which more or less guarantees it will not share a cache line with cd). This patch corrects these problems by extracting all hotpath data into a separate structure and using cacheline_aligned to ensure the hotpath uses a single (64 byte) cache line. Signed-off-by: Daniel Thompson Cc: Russell King Cc: Will Deacon Cc: Catalin Marinas --- kernel/time/sched_clock.c | 113 +++--- 1 file changed, 77 insertions(+), 36 deletions(-) diff --git a/kernel/time/sched_clock.c b/kernel/time/sched_clock.c index 3d21a8719444..695b2ac2e8b4 100644 --- a/kernel/time/sched_clock.c +++ b/kernel/time/sched_clock.c @@ -18,28 +18,59 @@ #include #include -struct clock_data { - ktime_t wrap_kt; +/** + * struct clock_read_data - data required to read from sched_clock + * + * @epoch_ns: sched_clock value at last update + * @epoch_cyc: Clock cycle value at last update + * @sched_clock_mask: Bitmask for two's complement subtraction of non 64bit + * clocks + * @read_sched_clock: Current clock source (or dummy source when suspended) + * @mult: Multipler for scaled math conversion + * @shift: Shift value for scaled math conversion + * @suspended: Flag to indicate if the clock is suspended (stopped) + * + * Care must be taken when updating this structure; it is read by + * some very hot code paths. It occupies <=48 bytes and, when combined + * with the seqcount used to synchronize access, comfortably fits into + * a 64 byte cache line. + */ +struct clock_read_data { u64 epoch_ns; u64 epoch_cyc; - seqcount_t seq; - unsigned long rate; + u64 sched_clock_mask; + u64 (*read_sched_clock)(void); u32 mult; u32 shift; bool suspended; }; +/** + * struct clock_data - all data needed for sched_clock (including + * registration of a new clock source) + * + * @seq: Sequence counter for protecting updates. + * @read_data: Data required to read from sched_clock. + * @wrap_kt: Duration for which clock can run before wrapping + * @rate: Tick rate of the registered clock + * @actual_read_sched_clock: Registered clock read function + * + * The ordering of this structure has been chosen to optimize cache + * performance. In particular seq and read_data (combined) should fit + * into a single 64 byte cache line. + */ +struct clock_data { + seqcount_t seq; + struct clock_read_data read_data; + ktime_t wrap_kt; + unsigned long rate; +}; + static struct hrtimer sched_clock_timer; static int irqtime = -1; core_param(irqtime, irqtime, int, 0400); -static struct clock_data cd = { - .mult = NSEC_PER_SEC / HZ, -}; - -static u64 __read_mostly sched_clock_mask; - static u64 notrace jiffy_sched_clock_read(void) { /* @@ -49,7 +80,10 @@ static u64 notrace jiffy_sched_clock_read(void) return (u64)(jiffies - INITIAL_JIFFIES); } -static u64 __read_mostly (*read_sched_clock)(void) = jiffy_sched_clock_read; +static struct clock_data cd cacheline_aligned = { + .read_data = { .mult = NSEC_PER_SEC / HZ, + .read_sched_clock = jiffy_sched_clock_read, }, +}; static inline u64 notrace cyc_to_ns(u64 cyc, u32 mult, u32 shift) { @@ -60,15 +94,16 @@ unsigned long long notrace sched_clock(void) { u64 cyc, res; unsigned long seq; + struct clock_read_data *rd = &cd.read_data; do { seq = raw_read_seqcount_begin(&cd.seq); - res = cd.epoch_ns; - if (!cd.suspended) { - cyc = read_sched_clock(); - cyc = (cyc - cd.epoch_cyc) & sched_clock_mask; - res += cyc_to_ns(cyc, cd.mult, cd.shift); + res = rd->epoch_ns; + if (!rd->suspended) { + cyc = rd->read_sched_clock(); + cyc = (cyc - rd->epoch_cyc) & rd->sched_clock_mask; + res += cyc_to_ns(cyc, rd->mult, rd->shift); } } while (read_seqcount_retry(&cd.seq, seq)); @@ -83,16 +118,17 @@ static void notrace update_sched_clock(void) unsigned long flags; u64 cyc; u64 ns; + struct clock_read_data *rd = &cd.read_data; - cyc = read_sched_clock(); - ns = cd.epoch_ns + - cyc_to_ns((cyc - cd.epoch_cyc) & sched_clock_mask, - cd.mult, cd.shift); + cyc = rd->read_sched_clock(); + ns = rd->
Re: [PATCH] staging: iio: resolver: ad2s1210: Change type in printf format string
On 27/01/15 22:22, Rickard Strandqvist wrote: > Wrong type in printf format string, requires 'int' > but the argument type is 'unsigned int' > > This was found using a static code analysis program called cppcheck > > Signed-off-by: Rickard Strandqvist Finally one I don't already have a fix in place for! Applied to the togreg branch of iio.git. Note this will first get pushed out as staging when I get a few minutes at home (no sign of my plane yet that was meant to leave an hour ago...) > --- > drivers/staging/iio/resolver/ad2s1210.c |4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) > > diff --git a/drivers/staging/iio/resolver/ad2s1210.c > b/drivers/staging/iio/resolver/ad2s1210.c > index b4c14ba..a8ecf87 100644 > --- a/drivers/staging/iio/resolver/ad2s1210.c > +++ b/drivers/staging/iio/resolver/ad2s1210.c > @@ -198,7 +198,7 @@ static ssize_t ad2s1210_show_fclkin(struct device *dev, > { > struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); > > - return sprintf(buf, "%d\n", st->fclkin); > + return sprintf(buf, "%u\n", st->fclkin); > } > > static ssize_t ad2s1210_store_fclkin(struct device *dev, > @@ -237,7 +237,7 @@ static ssize_t ad2s1210_show_fexcit(struct device *dev, > { > struct ad2s1210_state *st = iio_priv(dev_to_iio_dev(dev)); > > - return sprintf(buf, "%d\n", st->fexcit); > + return sprintf(buf, "%u\n", st->fexcit); > } > > static ssize_t ad2s1210_store_fexcit(struct device *dev, > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] staging: iio: adc: mxs-lradc: Change type in printf format string
On 27/01/15 22:59, Marek Vasut wrote: > On Tuesday, January 27, 2015 at 11:23:33 PM, Rickard Strandqvist wrote: >> Wrong type in printf format string, requires 'int' >> but the argument type is 'unsigned int' >> >> This was found using a static code analysis program called cppcheck >> >> Signed-off-by: Rickard Strandqvist > > Makes sense, thanks! > > Reviewed-by: Marek Vasut Applied. > > Best regards, > Marek Vasut > -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3 0/4] sched_clock: Optimize and avoid deadlock during read from NMI
On 05/02/15 17:05, Daniel Thompson wrote: > On 05/02/15 00:50, Stephen Boyd wrote: >> On 01/30, Daniel Thompson wrote: >>> This patchset optimizes the generic sched_clock implementation to >>> significantly reduce the data cache profile. It also makes it safe to call >>> sched_clock() from NMI (or FIQ on ARM). >>> >>> The data cache profile of sched_clock() in both the original code and >>> my previous patch was somewhere between 2 and 3 (64-byte) cache lines, >>> depending on alignment of struct clock_data. After patching, the cache >>> profile for the normal case should be a single cacheline. >>> >>> NMI safety was tested on i.MX6 with perf drowning the system in FIQs and >>> using the perf handler to check that sched_clock() returned monotonic >>> values. At the same time I forcefully reduced kt_wrap so that >>> update_sched_clock() is being called at >1000Hz. >>> >>> Without the patches the above system is grossly unstable, surviving >>> [9K,115K,25K] perf event cycles during three separate runs. With the >>> patch I ran for over 9M perf event cycles before getting bored. >> >> I wanted to see if there was any speedup from these changes so I >> made a tight loop around sched_clock() that ran for 10 seconds >> and I ran it 10 times before and after this patch series: >> >> unsigned long long clock, start_clock; >> int count = 0; >> >> clock = start_clock = sched_clock(); >> while ((clock - start_clock) < 10ULL * NSEC_PER_SEC) { >> clock = sched_clock(); >> count++; >> } >> >> pr_info("Made %d calls in %llu ns\n", count, clock - start_clock); >> >> Before >> -- >> Made 19218953 calls in 1000439 ns >> Made 19212790 calls in 1000438 ns >> Made 19217121 calls in 1000142 ns >> Made 19227304 calls in 1000142 ns >> Made 19217559 calls in 1000142 ns >> Made 19230193 calls in 1000290 ns >> Made 19212715 calls in 1000290 ns >> Made 19234446 calls in 1000438 ns >> Made 19226274 calls in 1000439 ns >> Made 19236118 calls in 1000143 ns >> >> After >> - >> Made 19434797 calls in 1000438 ns >> Made 19435733 calls in 1000439 ns >> Made 19434499 calls in 1000438 ns >> Made 19438482 calls in 1000438 ns >> Made 19435604 calls in 1000142 ns >> Made 19438551 calls in 1000438 ns >> Made 19444550 calls in 1000290 ns >> Made 19437580 calls in 1000290 ns >> Made 19439429 calls in 1048142 ns >> Made 19439493 calls in 1000438 ns >> >> So it seems to be a small improvement. >> > > Awesome! > > I guess this is mostly the effect of simplifying the suspend logic since > the changes to the cache profile probably wouldn't reveal much in such a > tight loop. > > I will re-run this after acting on your other review comments. BTW what > device did you run on? I ran the same test on my Snapdragon 600 board. The results are a little odd. There is an odd quantization effect that I cannot easily explain and the results of the v4 patch seem almost too good to be true. My results are below but I'd be very interested to see what results you get with the v4 patch! Latest (branchless approach): Made 18736519 calls in 1000439 ns Made 19958774 calls in 1000439 ns Made 18736500 calls in 1000587 ns Made 21703993 calls in 1000439 ns Made 18734458 calls in 1000142 ns Made 18736175 calls in 1000439 ns Made 19961406 calls in 1000291 ns Made 19953920 calls in 1000143 ns Made 21709619 calls in 1000290 ns Made 18734077 calls in 1000142 ns v3: Made 15971788 calls in 1000438 ns Made 14594357 calls in 1000734 ns Made 14590951 calls in 1000735 ns Made 14595048 calls in 1000290 ns Made 14595157 calls in 1000143 ns Made 14594117 calls in 1000142 ns Made 14597277 calls in 1000142 ns Made 14594472 calls in 1000586 ns Made 14601292 calls in 1000587 ns Made 15968630 calls in 1000587 ns Current: Made 14274871 calls in 1000587 ns Made 15634136 calls in 1000587 ns Made 16453528 calls in 1000142 ns Made 14275854 calls in 1000586 ns Made 15634128 calls in 1000438 ns Made 14277672 calls in 1000143 ns Made 14282904 calls in 1000290 ns Made 14278673 calls in 1000142 ns Made 14276096 calls in 1000290 ns Made 14275336 calls in 1000143 ns -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3] ext4: fix indirect punch hole corruption
Commit 4f579ae7de56 (ext4: fix punch hole on files with indirect mapping) rewrote FALLOC_FL_PUNCH_HOLE for ext4 files with indirect mapping. However, there are a bugs in a few cases. In the case where the punch happens within one level of indirection, we expect the start and end shared branches to converge on an indirect block. However, because the branches returned from ext4_find_shared do not necessarily start at the same level (e.g., the partial2 chain will be shallower if the last block occurs at the beginning of an indirect group), the walk of the two chains can end up "missing" each other and freeing a bunch of extra blocks in the process. This mismatch can be handled by first making sure that the chains are at the same level, then walking them together until they converge. In the case that a punch spans different levels of indirection, the original code skips freeing the intermediate indirect trees if the last block is the first triply-indirected block because it returns instead of jumping to do_indirects. Additionally, a non-zero nr2 does not mean that there's nothing else to free at the level of partial2: consider the case where the all_zeroes in ext4_find_shared backed up the shared branch. Signed-off-by: Omar Sandoval --- Here's a couple more fixes folded in. Still applies to v3.19-rc7. Changes from v2: Handle skipped do_indirects when n < 4, n2 == 4, and partial2 == chain2 and skipped ext4_free_branches when nr2 != 0 Changes from v1: Handle partial == chain || partial2 == chain2 cases. fs/ext4/indirect.c | 62 -- 1 file changed, 32 insertions(+), 30 deletions(-) diff --git a/fs/ext4/indirect.c b/fs/ext4/indirect.c index 36b3696..279d9ba 100644 --- a/fs/ext4/indirect.c +++ b/fs/ext4/indirect.c @@ -1393,10 +1393,7 @@ end_range: * to free. Everything was covered by the start * of the range. */ - return 0; - } else { - /* Shared branch grows from an indirect block */ - partial2--; + goto do_indirects; } } else { /* @@ -1434,49 +1431,54 @@ end_range: * in punch_hole so we need to point to the next element */ partial2->p++; - while ((partial > chain) || (partial2 > chain2)) { - /* We're at the same block, so we're almost finished */ - if ((partial->bh && partial2->bh) && - (partial->bh->b_blocknr == partial2->bh->b_blocknr)) { - if ((partial > chain) && (partial2 > chain2)) { - ext4_free_branches(handle, inode, partial->bh, - partial->p + 1, - partial2->p, - (chain+n-1) - partial); - BUFFER_TRACE(partial->bh, "call brelse"); - brelse(partial->bh); - BUFFER_TRACE(partial2->bh, "call brelse"); - brelse(partial2->bh); - } + while (partial > chain || partial2 > chain2) { + int depth = (chain+n-1) - partial; + int depth2 = (chain2+n2-1) - partial2; + + if (partial > chain && partial2 > chain2 && + partial->bh->b_blocknr == partial2->bh->b_blocknr) { + /* +* We've converged on the same block. Clear the range, +* then we're done. +*/ + ext4_free_branches(handle, inode, partial->bh, + partial->p + 1, + partial2->p, + (chain+n-1) - partial); + BUFFER_TRACE(partial->bh, "call brelse"); + brelse(partial->bh); + BUFFER_TRACE(partial2->bh, "call brelse"); + brelse(partial2->bh); return 0; } + /* -* Clear the ends of indirect blocks on the shared branch -* at the start of the range +* The start and end partial branches may not be at the same +* level even though the punch happened within one level. So, we +* give them a chance to arrive at the same level, then walk +* them in step with each other until we converge on the same +* block. */ - if (partial > chain) { + if (partial > chain && depth <= depth2) { ext4_free_branches(ha
Re: 1e918876 breaks r8169 (linux-3.18+)
On Fri, 06 Feb 2015 15:04:50 +0100, Tomas Szepe wrote: > Unfortunately, I have to take this back. I made the conclusion too early. > The problem appears with this patch applied, too, only perhaps later and > with a different frequency pattern. +1 can confirm - I also see the stack trace in question [1] from time to time, however even under low/moderate load and more or less randomly. This also used to happen with 3.14.x, so I don't think it has anything to do woth the BQL patch pe se. I *think* - and have suspected for some time now - that this is caused by a change in TSO/GSO or other offload settings, and that some r8169 models consequently suffer occasional (or in your case frequent) hiccups. BQL and/or a qdisc doing requeues might just interfer with whatever upsets the driver or HW. I used to turn on all possible settings via ethtool, but am now back to defaults, which disables sg/tso/gso. Exactly which of these settings is the culprit remains to be seen. Holger [1] https://lkml.org/lkml/2014/12/11/65 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] net: bluetooth: hci_sock: Use 'const u32 *' instead of 'void *' for 2nd parameter of hci_test_bit()
On 2/8/15 08:00, Chen Gang S wrote: > On 2/8/15 03:52, Joe Perches wrote: >> On Sat, 2015-02-07 at 21:24 +0800, Chen Gang S wrote: >>> hci_test_bit() does not modify 2nd parameter, so it is better to let it >>> be constant, or may cause build warning. The related warning (with >>> allmodconfig under xtensa): >>> >>> net/bluetooth/hci_sock.c: In function 'hci_sock_sendmsg': >>> net/bluetooth/hci_sock.c:955:8: warning: passing argument 2 of >>> 'hci_test_bit' discards 'const' qualifier from pointer target type >>> [-Wdiscarded-array-qualifiers] >>> &hci_sec_filter.ocf_mask[ogf])) && >>> ^ >>> net/bluetooth/hci_sock.c:49:19: note: expected 'void *' but argument is >>> of type 'const __u32 (*)[4] {aka const unsigned int (*)[4]}' >>>static inline int hci_test_bit(int nr, void *addr) >>> ^ >>> >>> hci_test_bit() always treats 2nd parameter is u32, and all callers also >>> know about it, so 2nd parameter of hci_test_bit() need use 'const u32 *' >>> instead of 'void *'. >>> >>> C language treats the array function parameter as a pointer, so the >>> caller need not use '&' for the 2 demotion array, or it reports warning: >>> 'const unsigned int (*)[4]' is different with 'const unsigned int *'. >> >> I still think you are possibly papering over potential bugs >> on big-endian 64 bit systems. >> >> unsigned long vs u32. >> >> How are the bits actually set? >> > >>From current usage of event_mask, "(u32 *) f->event_mask" is only for > event_mask data storage, not for calculation (always as "u32 *" for > calculation). > > [root@localhost linux-next]# grep -rn "\" > include/net/bluetooth net/bluetooth > include/net/bluetooth/hci_sock.h:51:unsigned long event_mask[2]; e.g. use "unsigned char event_mask[2 * sizeof(unsigned long)]" instead of "unsigned long event_mask[2]". There is still no any issue within "hci_sock.c" (although I am not sure whether this modification may cause issues in another modules outside kernel). Thanks. > include/net/bluetooth/hci_sock.h:57:__u32 event_mask[2]; > net/bluetooth/hci_sock.c:59:__u32 event_mask[2]; > net/bluetooth/hci_sock.c:110: if (!hci_test_bit(flt_event, (u32 > *)&flt->event_mask)) > net/bluetooth/hci_sock.c:1041: uf.event_mask[0] = > *((u32 *) f->event_mask + 0); > net/bluetooth/hci_sock.c:1042: uf.event_mask[1] = > *((u32 *) f->event_mask + 1); > net/bluetooth/hci_sock.c:1053: uf.event_mask[0] &= > *((u32 *) hci_sec_filter.event_mask + 0); > net/bluetooth/hci_sock.c:1054: uf.event_mask[1] &= > *((u32 *) hci_sec_filter.event_mask + 1); > net/bluetooth/hci_sock.c:1062: *((u32 *) f->event_mask > + 0) = uf.event_mask[0]; > net/bluetooth/hci_sock.c:1063: *((u32 *) f->event_mask > + 1) = uf.event_mask[1]; > net/bluetooth/hci_sock.c:1124: uf.event_mask[0] = > *((u32 *) f->event_mask + 0); > net/bluetooth/hci_sock.c:1125: uf.event_mask[1] = > *((u32 *) f->event_mask + 1); > > Calculation is machine endian dependency, but event_mask is always as > "u32 *" for calculation, so there is no any type cast for calculation, > it is OK. > > Storage is independent from machine endian, but it depends on machine > bits. In our case, 'unsigned long' array has enough space to accept u32 > array, so there is no any data overwritten, it is OK. > > > By the way, I intended to remain event_mask as 'unsigned long' type, > because I am not quite sure whether it is also used by another modules > in kernel (or any other systems). May we change it to u32? > > Thanks. > -- Chen Gang Open, share, and attitude like air, water, and life which God blessed -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] [Bugfix] x86/boot/compressed: Fix serial I/O during compressed boot
Previously it used early_serial_base from the arch/x86/boot/compressed/early_serial_console.c, and it's zero everytime, so serial I/O didn't work/print anything in the kernel decompressing code. Let's define early_serial_base in the arch/x86/boot/early_serial_console.c and make it extern, so code from boot/compressed directory can use it. Signed-off-by: Alexander Kuleshov --- arch/x86/boot/compressed/early_serial_console.c | 2 -- arch/x86/boot/compressed/misc.c | 3 ++- arch/x86/boot/early_serial_console.c| 2 ++ arch/x86/boot/tty.c | 2 -- 4 files changed, 4 insertions(+), 5 deletions(-) diff --git a/arch/x86/boot/compressed/early_serial_console.c b/arch/x86/boot/compressed/early_serial_console.c index 261e81f..c80d915 100644 --- a/arch/x86/boot/compressed/early_serial_console.c +++ b/arch/x86/boot/compressed/early_serial_console.c @@ -1,5 +1,3 @@ #include "misc.h" -int early_serial_base; - #include "../early_serial_console.c" diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c index a950864..2bde4db 100644 --- a/arch/x86/boot/compressed/misc.c +++ b/arch/x86/boot/compressed/misc.c @@ -390,7 +390,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, memptr heap, lines = real_mode->screen_info.orig_video_lines; cols = real_mode->screen_info.orig_video_cols; - console_init(); /* * serial i/o can be already initialized if we runned in 16-bit * real mode and didn't use 32/64-bit boot protocol. */ + if (!early_serial_base) + console_init(); debug_putstr("early console in decompress_kernel\n"); free_mem_ptr = heap;/* Heap */ diff --git a/arch/x86/boot/early_serial_console.c b/arch/x86/boot/early_serial_console.c index 5df2869..af32b39 100644 --- a/arch/x86/boot/early_serial_console.c +++ b/arch/x86/boot/early_serial_console.c @@ -1,5 +1,7 @@ #include "boot.h" +int early_serial_base; + #define DEFAULT_SERIAL_PORT 0x3f8 /* ttyS0 */ #define XMTRDY 0x20 diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c index def2451..0cb0b4c 100644 --- a/arch/x86/boot/tty.c +++ b/arch/x86/boot/tty.c @@ -15,8 +15,6 @@ #include "boot.h" -int early_serial_base; - #define XMTRDY 0x20 #define TXR 0 /* Transmit register (WRITE) */ -- 2.3.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/2] i2c: nomadik: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as timeout is used for wait_for_completion_timeout exclusively here its type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with multi_v5_defconfig (implies CONFIG_I2C_NOMADIK=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-nomadik.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 9799894..6ca6ad6 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -448,7 +448,7 @@ static int read_i2c(struct nmk_i2c_dev *dev, u16 flags) { u32 status = 0; u32 mcr, irq_mask; - int timeout; + unsigned long timeout; mcr = load_i2c_mcr_reg(dev, flags); writel(mcr, dev->virtbase + I2C_MCR); @@ -517,7 +517,7 @@ static int write_i2c(struct nmk_i2c_dev *dev, u16 flags) { u32 status = 0; u32 mcr, irq_mask; - int timeout; + unsigned long timeout; mcr = load_i2c_mcr_reg(dev, flags); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/2] i2c: nomadik: match status to return type of read_i2c
return type of read_i2c() is int not u32. As the assignments to status are consistent with int here its type is changed to int. Signed-off-by: Nicholas Mc Guire --- This patch depends on "[PATCH 1/2] i2c: nomadik: match return type of wait_for_completion_timeout" Patch was only compile tested with multi_v5_defconfig (implies CONFIG_I2C_NOMADIK=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-nomadik.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c index 6ca6ad6..bcd17e8 100644 --- a/drivers/i2c/busses/i2c-nomadik.c +++ b/drivers/i2c/busses/i2c-nomadik.c @@ -446,7 +446,7 @@ static void setup_i2c_controller(struct nmk_i2c_dev *dev) */ static int read_i2c(struct nmk_i2c_dev *dev, u16 flags) { - u32 status = 0; + int status = 0; u32 mcr, irq_mask; unsigned long timeout; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: cadence: match return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. as ret is only used for wait_for_completion_timeout anyway the type is simply changed to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with multi_v7_defconfig (implies CONFIG_I2C_CADENCE=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-cadence.c |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/i2c/busses/i2c-cadence.c b/drivers/i2c/busses/i2c-cadence.c index 7d7a14c..5fbffe0 100644 --- a/drivers/i2c/busses/i2c-cadence.c +++ b/drivers/i2c/busses/i2c-cadence.c @@ -475,7 +475,7 @@ static void cdns_i2c_master_reset(struct i2c_adapter *adap) static int cdns_i2c_process_msg(struct cdns_i2c *id, struct i2c_msg *msg, struct i2c_adapter *adap) { - int ret; + unsigned long ret; u32 reg; id->p_msg = msg; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
BENEFICIAL TRANSACTION
View the file for details of the inheritance. Dennis Walker Esq. +27 78 3449667 INHERITANCE.rtf Description: MS-Word document
[PATCH] acpi: Remove unneeded nested #ifdef
In commit 5de21bb998b8 ("ACPI / PM: Drop CONFIG_PM_RUNTIME from the ACPI core"), all occurrences of CONFIG_PM_RUNTIME were replaced with CONFIG_PM. This created the following structure of #ifdef blocks in the code: [...] #ifdef CONFIG_PM #ifdef CONFIG_PM /* always on / undead */ #ifdef CONFIG_PM_SLEEP [...] #endif #endif [...] #endif This patch removes the inner "#ifdef CONFIG_PM" block as it will always be enabled when the outer block is enabled. This inconsistency was found using the undertaker-checkpatch tool. Signed-off-by: Andreas Ruprecht --- drivers/acpi/device_pm.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/acpi/device_pm.c b/drivers/acpi/device_pm.c index c0d44d3..735db11 100644 --- a/drivers/acpi/device_pm.c +++ b/drivers/acpi/device_pm.c @@ -1027,7 +1027,6 @@ EXPORT_SYMBOL_GPL(acpi_subsys_freeze); static struct dev_pm_domain acpi_general_pm_domain = { .ops = { -#ifdef CONFIG_PM .runtime_suspend = acpi_subsys_runtime_suspend, .runtime_resume = acpi_subsys_runtime_resume, #ifdef CONFIG_PM_SLEEP @@ -1041,7 +1040,6 @@ static struct dev_pm_domain acpi_general_pm_domain = { .poweroff_late = acpi_subsys_suspend_late, .restore_early = acpi_subsys_resume_early, #endif -#endif }, }; -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
DRM edid logspam even with loading edid data from file
Hi, I have a monitor connected via a KVM to a radeon card (ATI RV620 LE [Radeon HD 3450]), since it's a server i previously used "nomodeset", however i just tried using DRM/KMS but my logs get spammed with messages about invalid EDID. I have tried to circumvent this by loading the edid data from file with "drm_kms_helper.edid_firmware=edid/1680x1050.bin", that seems to work in principle but the log spamming didn't stop: [ 329.576557] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.622352] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.668097] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.713887] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.759526] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.805154] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.849913] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.894569] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.939304] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 329.983970] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.028634] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.073433] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.118026] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.162748] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.207441] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.265010] [drm:drm_edid_block_valid] *ERROR* EDID checksum is invalid, remainder is 128 [ 330.266315] Raw EDID: [ 330.267487] 00 ff ff ff ff ff ff 00 1e 6d f1 59 e6 87 02 00 [ 330.268684] 08 18 01 03 80 3a 18 78 ea ca 95 a6 55 4e a1 26 [ 330.269885] 0f 50 54 a5 4b 80 71 4f 81 80 81 c0 a9 ff ff ff [ 330.271129] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 330.272204] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 330.273356] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 330.274443] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 330.275500] ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff [ 330.27] [drm:radeon_vga_detect] *ERROR* VGA-2: probed a monitor but no|invalid EDID [ 330.281293] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.285507] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.330888] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.375586] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.420277] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.464931] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.509780] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.554440] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.599291] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.644827] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.689515] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.734242] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.778901] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.821557] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.866191] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.910993] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin" for connector "HDMI-A-1" [ 330.955628] [drm] Got built-in EDID base block and 0 extensions from "edid/1680x1050.bin"
Re: [PATCH] [Bugfix] x86/boot/compressed: Fix serial I/O during compressed boot
rejected 2015-02-08 18:33 GMT+06:00 Alexander Kuleshov : > Previously it used early_serial_base from the > arch/x86/boot/compressed/early_serial_console.c, and it's zero everytime, > so serial I/O didn't work/print anything in the kernel decompressing code. > > Let's define early_serial_base in the arch/x86/boot/early_serial_console.c > and make it extern, so code from boot/compressed directory can use it. > > Signed-off-by: Alexander Kuleshov > --- > arch/x86/boot/compressed/early_serial_console.c | 2 -- > arch/x86/boot/compressed/misc.c | 3 ++- > arch/x86/boot/early_serial_console.c| 2 ++ > arch/x86/boot/tty.c | 2 -- > 4 files changed, 4 insertions(+), 5 deletions(-) > > diff --git a/arch/x86/boot/compressed/early_serial_console.c > b/arch/x86/boot/compressed/early_serial_console.c > index 261e81f..c80d915 100644 > --- a/arch/x86/boot/compressed/early_serial_console.c > +++ b/arch/x86/boot/compressed/early_serial_console.c > @@ -1,5 +1,3 @@ > #include "misc.h" > > -int early_serial_base; > - > #include "../early_serial_console.c" > diff --git a/arch/x86/boot/compressed/misc.c b/arch/x86/boot/compressed/misc.c > index a950864..2bde4db 100644 > --- a/arch/x86/boot/compressed/misc.c > +++ b/arch/x86/boot/compressed/misc.c > @@ -390,7 +390,8 @@ asmlinkage __visible void *decompress_kernel(void *rmode, > memptr heap, > lines = real_mode->screen_info.orig_video_lines; > cols = real_mode->screen_info.orig_video_cols; > > - console_init(); > /* > * serial i/o can be already initialized if we runned in 16-bit > * real mode and didn't use 32/64-bit boot protocol. > */ > + if (!early_serial_base) > + console_init(); > debug_putstr("early console in decompress_kernel\n"); > > free_mem_ptr = heap;/* Heap */ > diff --git a/arch/x86/boot/early_serial_console.c > b/arch/x86/boot/early_serial_console.c > index 5df2869..af32b39 100644 > --- a/arch/x86/boot/early_serial_console.c > +++ b/arch/x86/boot/early_serial_console.c > @@ -1,5 +1,7 @@ > #include "boot.h" > > +int early_serial_base; > + > #define DEFAULT_SERIAL_PORT 0x3f8 /* ttyS0 */ > > #define XMTRDY 0x20 > diff --git a/arch/x86/boot/tty.c b/arch/x86/boot/tty.c > index def2451..0cb0b4c 100644 > --- a/arch/x86/boot/tty.c > +++ b/arch/x86/boot/tty.c > @@ -15,8 +15,6 @@ > > #include "boot.h" > > -int early_serial_base; > - > #define XMTRDY 0x20 > > #define TXR 0 /* Transmit register (WRITE) */ > -- > 2.3.0 > -- _ 0xAX -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i2c: ismt: fix type of return var of wait_for_completion_timeout
On Sun, Feb 08, 2015 at 03:03:30AM -0500, Nicholas Mc Guire wrote: > return type of wait_for_completion_timeout is unsigned long not int. As > ret is in used for other calls a new appropriately typed variable timeout > is added to handle wait_for_completion_timeout > > Signed-off-by: Nicholas Mc Guire Acked-by: Neil Horman -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] dm ioctl: Delete an unnecessary check before the function call "dm_table_destroy"
On Sun, Feb 8, 2015 at 4:55 AM, SF Markus Elfring wrote: >> Your proposed patch (while technically correct) hurts code clarity. > > How many source code readability and understanding challenges does each > additional condition check cause? Please don't make a mountain out of a mole hill in an attempt to defend your robotic patch (I'm quite tired of some of these static analyzer patch submissions). FYI, I did stage your other patch for 3.20, see: https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-for-3.20&id=d0ce7e911c97c7c6df1081dcedfefced82a0c6bf > Can the affected place become also a bit more efficient? Efficiency isn't a concern in this instance (it isn't a hot IO path). And even if it were, a branch (with current code) is more efficient vs a a jump + branch (your proposed patch) -- in the case that no active table exists. Now if it likely that old_map does exist then yes your patch is always a very slight win. But given the duality of the calling function (deals with loading a new map and destroying the old map if it exists) I prefer to keep the code as is. Sorry. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 0/3] lib: find_*_bit reimplementation
This patchset does rework find_bit functions family to achieve better performance, and decrease size of text. All rework is done in patch 1. Patches 2 and 3 are about code moving and renaming. It was boot-tested on x86_64 and MIPS (big-endian) machines. Performance tests were ran on userspace with code like this: /* addr[] is filled from /dev/urandom */ start = clock(); while (ret < nbits) ret = find_next_bit(addr, nbits, ret + 1); end = clock(); printf("%ld\t", (unsigned long) end - start); On Intel(R) Core(TM) i7-3770 CPU @ 3.40GHz rezults are next: (for find_next_bit, nbits is 8M, for find_first_bit - 80K) find_next_bit: find_first_bit: new current new current 26932 43151 14777 14925 26947 43182 14521 15423 26507 43824 15053 14705 27329 43759 14473 14777 26895 43367 14847 15023 26990 43693 15103 15163 26775 43299 15067 15232 27282 42752 14544 15121 27504 43088 14644 14858 26761 43856 14699 15193 26692 43075 14781 14681 27137 42969 14451 15061 ... ... find_next_bit performance gain is 35-40%; find_first_bit - no measurable difference. On ARM machine, there is arch-specific implementation for find_bit. To disable it, and use generic one, please apply next patch: --- arch/arm/include/asm/bitops.h | 19 --- arch/arm/kernel/armksyms.c | 11 --- arch/arm/lib/Makefile | 2 +- include/asm-generic/bitops/le.h | 1 + 4 files changed, 2 insertions(+), 31 deletions(-) diff --git a/arch/arm/include/asm/bitops.h b/arch/arm/include/asm/bitops.h index 5638099..e0611d1 100644 --- a/arch/arm/include/asm/bitops.h +++ b/arch/arm/include/asm/bitops.h @@ -192,25 +192,6 @@ extern int _find_next_bit_be(const unsigned long *p, int size, int offset); #define test_and_clear_bit(nr,p) ATOMIC_BITOP(test_and_clear_bit,nr,p) #define test_and_change_bit(nr,p) ATOMIC_BITOP(test_and_change_bit,nr,p) -#ifndef __ARMEB__ -/* - * These are the little endian, atomic definitions. - */ -#define find_first_zero_bit(p,sz) _find_first_zero_bit_le(p,sz) -#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_le(p,sz,off) -#define find_first_bit(p,sz) _find_first_bit_le(p,sz) -#define find_next_bit(p,sz,off) _find_next_bit_le(p,sz,off) - -#else -/* - * These are the big endian, atomic definitions. - */ -#define find_first_zero_bit(p,sz) _find_first_zero_bit_be(p,sz) -#define find_next_zero_bit(p,sz,off) _find_next_zero_bit_be(p,sz,off) -#define find_first_bit(p,sz) _find_first_bit_be(p,sz) -#define find_next_bit(p,sz,off) _find_next_bit_be(p,sz,off) - -#endif #if __LINUX_ARM_ARCH__ < 5 diff --git a/arch/arm/kernel/armksyms.c b/arch/arm/kernel/armksyms.c index a88671c..22e8748 100644 --- a/arch/arm/kernel/armksyms.c +++ b/arch/arm/kernel/armksyms.c @@ -146,17 +146,6 @@ EXPORT_SYMBOL(_clear_bit); EXPORT_SYMBOL(_test_and_clear_bit); EXPORT_SYMBOL(_change_bit); EXPORT_SYMBOL(_test_and_change_bit); -EXPORT_SYMBOL(_find_first_zero_bit_le); -EXPORT_SYMBOL(_find_next_zero_bit_le); -EXPORT_SYMBOL(_find_first_bit_le); -EXPORT_SYMBOL(_find_next_bit_le); - -#ifdef __ARMEB__ -EXPORT_SYMBOL(_find_first_zero_bit_be); -EXPORT_SYMBOL(_find_next_zero_bit_be); -EXPORT_SYMBOL(_find_first_bit_be); -EXPORT_SYMBOL(_find_next_bit_be); -#endif #ifdef CONFIG_FUNCTION_TRACER #ifdef CONFIG_OLD_MCOUNT diff --git a/arch/arm/lib/Makefile b/arch/arm/lib/Makefile index 0573faa..de369aa 100644 --- a/arch/arm/lib/Makefile +++ b/arch/arm/lib/Makefile @@ -6,7 +6,7 @@ lib-y := backtrace.o changebit.o csumipv6.o csumpartial.o \ csumpartialcopy.o csumpartialcopyuser.o clearbit.o \ - delay.o delay-loop.o findbit.o memchr.o memcpy.o \ + delay.o delay-loop.o memchr.o memcpy.o \ memmove.o memset.o memzero.o setbit.o \ strchr.o strrchr.o \ testchangebit.o testclearbit.o testsetbit.o\ diff --git a/inclu
[PATCH v3 3/3] lib: rename lib/find_next_bit.c to lib/find_bit.c
This file contains implementation for all find_*_bit{,_le} So giving it more generic name looks reasonable. Signed-off-by: Yury Norov --- lib/Makefile| 2 +- lib/{find_next_bit.c => find_bit.c} | 0 2 files changed, 1 insertion(+), 1 deletion(-) rename lib/{find_next_bit.c => find_bit.c} (100%) diff --git a/lib/Makefile b/lib/Makefile index 13990aa..1cc93f4 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -25,7 +25,7 @@ obj-y += lockref.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ -bsearch.o find_next_bit.o llist.o memweight.o kfifo.o \ +bsearch.o find_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o diff --git a/lib/find_next_bit.c b/lib/find_bit.c similarity index 100% rename from lib/find_next_bit.c rename to lib/find_bit.c -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 2/3] lib: move find_last_bit to lib/find_next_bit.c
Currently all 'find_*_bit' family is located in lib/find_next_bit.c, except 'find_last_bit', which is in lib/find_last_bit.c. It seems, there's no major benefit to have it separated. Signed-off-by: Yury Norov --- lib/Makefile| 2 +- lib/find_last_bit.c | 35 --- lib/find_next_bit.c | 21 - 3 files changed, 21 insertions(+), 37 deletions(-) delete mode 100644 lib/find_last_bit.c diff --git a/lib/Makefile b/lib/Makefile index 3c3b30b..13990aa 100644 --- a/lib/Makefile +++ b/lib/Makefile @@ -25,7 +25,7 @@ obj-y += lockref.o obj-y += bcd.o div64.o sort.o parser.o halfmd4.o debug_locks.o random32.o \ bust_spinlocks.o hexdump.o kasprintf.o bitmap.o scatterlist.o \ gcd.o lcm.o list_sort.o uuid.o flex_array.o iovec.o clz_ctz.o \ -bsearch.o find_last_bit.o find_next_bit.o llist.o memweight.o kfifo.o \ +bsearch.o find_next_bit.o llist.o memweight.o kfifo.o \ percpu-refcount.o percpu_ida.o rhashtable.o reciprocal_div.o obj-y += string_helpers.o obj-$(CONFIG_TEST_STRING_HELPERS) += test-string_helpers.o diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c deleted file mode 100644 index 106050f..000 --- a/lib/find_last_bit.c +++ /dev/null @@ -1,35 +0,0 @@ -/* find_last_bit.c: fallback find next bit implementation - * - * Copyright (C) 2008 IBM Corporation - * Written by Rusty Russell - * (Inspired by David Howell's find_next_bit implementation) - * - * Rewritten by Yury Norov to decrease - * size and improve performance, 2015. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License - * as published by the Free Software Foundation; either version - * 2 of the License, or (at your option) any later version. - */ - -#include -#include -#include - -#ifndef find_last_bit - -unsigned long find_last_bit(const unsigned long *addr, unsigned long size) -{ - unsigned long idx = DIV_ROUND_UP(size, BITS_PER_LONG); - - while (idx--) { - if (addr[idx]) - return min(idx * BITS_PER_LONG + __fls(addr[idx]), size); - } - - return size; -} -EXPORT_SYMBOL(find_last_bit); - -#endif diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c index 71aa497..5ec0ab9 100644 --- a/lib/find_next_bit.c +++ b/lib/find_next_bit.c @@ -1,8 +1,12 @@ -/* find_next_bit.c: fallback find next bit implementation +/* bit search implementation * * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowe...@redhat.com) * + * Copyright (C) 2008 IBM Corporation + * 'find_last_bit' is written by Rusty Russell + * (Inspired by David Howell's find_next_bit implementation) + * * Rewritten by Yury Norov to decrease * size and improve performance, 2015. * @@ -114,6 +118,21 @@ unsigned long find_first_zero_bit(const unsigned long *addr, unsigned long size) EXPORT_SYMBOL(find_first_zero_bit); #endif +#ifndef find_last_bit +unsigned long find_last_bit(const unsigned long *addr, unsigned long size) +{ + unsigned long idx = DIV_ROUND_UP(size, BITS_PER_LONG); + + while (idx--) { + if (addr[idx]) + return min(idx * BITS_PER_LONG + __fls(addr[idx]), size); + } + + return size; +} +EXPORT_SYMBOL(find_last_bit); +#endif + #ifdef __BIG_ENDIAN /* include/linux/byteorder does not support "unsigned long" type */ -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/3] lib: find_*_bit reimplementation
New implementations takes less space in source file (see diffstat) and in object. For me it's 710 vs 453 bytes of text. It also shows better performance. Signed-off-by: Yury Norov --- lib/find_last_bit.c | 30 ++ lib/find_next_bit.c | 275 2 files changed, 92 insertions(+), 213 deletions(-) diff --git a/lib/find_last_bit.c b/lib/find_last_bit.c index 91ca09f..106050f 100644 --- a/lib/find_last_bit.c +++ b/lib/find_last_bit.c @@ -4,6 +4,9 @@ * Written by Rusty Russell * (Inspired by David Howell's find_next_bit implementation) * + * Rewritten by Yury Norov to decrease + * size and improve performance, 2015. + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -12,36 +15,19 @@ #include #include -#include -#include +#include #ifndef find_last_bit unsigned long find_last_bit(const unsigned long *addr, unsigned long size) { - unsigned long words; - unsigned long tmp; - - /* Start at final word. */ - words = size / BITS_PER_LONG; - - /* Partial final word? */ - if (size & (BITS_PER_LONG-1)) { - tmp = (addr[words] & (~0UL >> (BITS_PER_LONG -- (size & (BITS_PER_LONG-1); - if (tmp) - goto found; - } + unsigned long idx = DIV_ROUND_UP(size, BITS_PER_LONG); - while (words) { - tmp = addr[--words]; - if (tmp) { -found: - return words * BITS_PER_LONG + __fls(tmp); - } + while (idx--) { + if (addr[idx]) + return min(idx * BITS_PER_LONG + __fls(addr[idx]), size); } - /* Not found */ return size; } EXPORT_SYMBOL(find_last_bit); diff --git a/lib/find_next_bit.c b/lib/find_next_bit.c index 0cbfc0b..71aa497 100644 --- a/lib/find_next_bit.c +++ b/lib/find_next_bit.c @@ -3,6 +3,9 @@ * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. * Written by David Howells (dhowe...@redhat.com) * + * Rewritten by Yury Norov to decrease + * size and improve performance, 2015. + * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version @@ -11,10 +14,48 @@ #include #include -#include -#include +#include + +#define HIGH_BITS_MASK(nr) (ULONG_MAX << (nr)) + +#if !defined(find_next_bit) || !defined(find_next_zero_bit) +static unsigned long _find_next_bit(const unsigned long *addr, + unsigned long nbits, unsigned long start, unsigned long mask) +{ + unsigned long tmp; + + if (start >= nbits) + return nbits; + + tmp = addr[start / BITS_PER_LONG] ^ mask; -#define BITOP_WORD(nr) ((nr) / BITS_PER_LONG) + /* Handle 1st word. */ + if (!IS_ALIGNED(start, BITS_PER_LONG)) { + tmp &= HIGH_BITS_MASK(start % BITS_PER_LONG); + start = round_down(start, BITS_PER_LONG); + } + + while (!tmp) { + start += BITS_PER_LONG; + if (start >= nbits) + return nbits; + + /* +* This is an equvalent for: +* +* tmp = find_set ? addr[start / BITS_PER_LONG] +* : ~addr[start / BITS_PER_LONG]; +* +* but saves a branch condition. +* +* Thanks George Spelvin for idea. +*/ + tmp = addr[start / BITS_PER_LONG] ^ mask; + } + + return min(start + __ffs(tmp), nbits); +} +#endif #ifndef find_next_bit /* @@ -23,86 +64,16 @@ unsigned long find_next_bit(const unsigned long *addr, unsigned long size, unsigned long offset) { - const unsigned long *p = addr + BITOP_WORD(offset); - unsigned long result = offset & ~(BITS_PER_LONG-1); - unsigned long tmp; - - if (offset >= size) - return size; - size -= result; - offset %= BITS_PER_LONG; - if (offset) { - tmp = *(p++); - tmp &= (~0UL << offset); - if (size < BITS_PER_LONG) - goto found_first; - if (tmp) - goto found_middle; - size -= BITS_PER_LONG; - result += BITS_PER_LONG; - } - while (size & ~(BITS_PER_LONG-1)) { - if ((tmp = *(p++))) - goto found_middle; - result += BITS_PER_LONG; - size -= BITS_PER_LONG; - } - if (!size) - return result; - tmp = *p; - -found_first: - tmp &= (~0UL >> (BITS_PER_LONG - s
Re: [PATCH 6/6 v2] perf: Make perf aware of tracefs
Hi Steve, On Mon, Feb 02, 2015 at 02:35:07PM -0500, Steven Rostedt wrote: > From: "Steven Rostedt (Red Hat)" > > As tracefs may be mounted instead of debugfs to get to the event directories, > have perf know about tracefs, and use that file system over debugfs if it > is present. > > Signed-off-by: Steven Rostedt > --- > tools/perf/tests/open-syscall-all-cpus.c | 7 +++- > tools/perf/tests/open-syscall.c | 7 +++- > tools/perf/tests/parse-events.c | 13 +-- > tools/perf/util/cache.h | 1 + > tools/perf/util/evlist.c | 1 - > tools/perf/util/parse-events.h | 2 +- > tools/perf/util/probe-event.c| 24 - > tools/perf/util/util.c | 60 > ++-- > tools/perf/util/util.h | 1 + > 9 files changed, 91 insertions(+), 25 deletions(-) > > diff --git a/tools/perf/tests/open-syscall-all-cpus.c > b/tools/perf/tests/open-syscall-all-cpus.c > index 8fa82d1700c7..21969e99ea46 100644 > --- a/tools/perf/tests/open-syscall-all-cpus.c > +++ b/tools/perf/tests/open-syscall-all-cpus.c > @@ -29,7 +29,12 @@ int test__open_syscall_event_on_all_cpus(void) > > evsel = perf_evsel__newtp("syscalls", "sys_enter_open"); > if (evsel == NULL) { > - pr_debug("is debugfs mounted on /sys/kernel/debug?\n"); > + if (tracefs_configured()) > + pr_debug("is tracefs mounted on /sys/kernel/debug?\n"); Shouldn't it be /sys/kernel/tracing/ ? > + else if (debugfs_configured()) > + pr_debug("is debugfs mounted on /sys/kernel/debug?\n"); > + else > + pr_debug("Neither tracefs or debugfs is enabled in this > kernel\n"); > goto out_thread_map_delete; > } > > diff --git a/tools/perf/tests/open-syscall.c b/tools/perf/tests/open-syscall.c > index a33b2daae40f..4250e40234d2 100644 > --- a/tools/perf/tests/open-syscall.c > +++ b/tools/perf/tests/open-syscall.c > @@ -18,7 +18,12 @@ int test__open_syscall_event(void) > > evsel = perf_evsel__newtp("syscalls", "sys_enter_open"); > if (evsel == NULL) { > - pr_debug("is debugfs mounted on /sys/kernel/debug?\n"); > + if (tracefs_configured()) > + pr_debug("is tracefs mounted on /sys/kernel/debug?\n"); Ditto. Thanks, Namhyung > + else if (debugfs_configured()) > + pr_debug("is debugfs mounted on /sys/kernel/debug?\n"); > + else > + pr_debug("Neither tracefs or debugfs is enabled in this > kernel\n"); > goto out_thread_map_delete; > } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i2c: axxia: match return type of wait_for_completion_timeout
On Sun, Feb 08, 2015 at 05:31:25AM -0500, Nicholas Mc Guire wrote: > return type of wait_for_completion_timeout is unsigned long not int. as ret > is only used for wait_for_completion_timeout here the type is simply changed > unsigned long. > > Signed-off-by: Nicholas Mc Guire > --- > > Patch was only compile tested with axm55xx_defconfig > (implies CONFIG_I2C_AXXIA=y) > > Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) > > drivers/i2c/busses/i2c-axxia.c |2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c > index 1decc88..9434824 100644 > --- a/drivers/i2c/busses/i2c-axxia.c > +++ b/drivers/i2c/busses/i2c-axxia.c > @@ -408,7 +408,7 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, > struct i2c_msg *msg) > static int axxia_i2c_stop(struct axxia_i2c_dev *idev) > { > u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC; > - int ret; > + unsigned long ret; 'ret' being an int is kind of an idiom, so I'd rather see the variable renamed, too, like the other patches do. Also, please combine the two axxia patches into one. signature.asc Description: Digital signature
Re: [PATCH v2 1/2] sched/rt: Check to push the task when changing its affinity
Hi Steve, On 7 February 2015 at 05:09, Steven Rostedt wrote: > On Thu, 5 Feb 2015 23:59:33 +0800 >> + >> + if (task_running(rq, p) && >> + cpumask_test_cpu(task_cpu(p), new_mask) && > > Why the check for task_cpu being in new_mask? If the current cpu of this task is not in the new_mask, it will get migrated by set_cpus_allowed_ptr(), so we don't need to resched. > >> + cpupri_find(&rq->rd->cpupri, p, NULL)) { >> + /* >> + * At this point, current task gets migratable most >> + * likely due to the change of its affinity, let's >> + * figure out if we can migrate it. >> + * >> + * Is there any task with the same priority as that >> + * of current task? If found one, we should resched. >> + * NOTE: The target may be unpushable. >> + */ >> + if (p->prio == rq->rt.highest_prio.next) { >> + /* One target just in pushable_tasks list. */ >> + requeue_task_rt(rq, p, 0); >> + preempt_push = 1; >> + } else if (rq->rt.rt_nr_total > 1) { >> + struct task_struct *next; >> + >> + requeue_task_rt(rq, p, 0); >> + next = peek_next_task_rt(rq); >> + if (next != p && next->prio == p->prio) >> + preempt_push = 1; >> + } >> + } else if (!task_running(rq, p)) >> + direct_push = 1; > > We could avoid the second check (!task_running()) by splitting up the > first if: ok, I'll adjust it. > > if (task_running(rq, p)) { > if (cpumask_test_cpu() && cpupri_find()) { > } > } else { > direct push = 1 > > Also, is the copy of cpus_allowed only done so that cpupri_find is > called? If so maybe move it in there too: > > if (task_running(rq, p)) { > if (!cpumask_test_cpu()) > goto update; > > cpumask_copy(&p->cpus_allowed, new_mask); > p->nr_cpus_allowed = new_weight; > > if (!cpupri_find()) > goto update; > > [...] > > This way we avoid the double copy of cpumask unless we truly need to do > it. The new_mask can also be used by direct_push case, so I think it's ok. > >> + } >> >> /* >>* Only update if the process changes its state from whether it >>* can migrate or not. >>*/ >> - if ((p->nr_cpus_allowed > 1) == (weight > 1)) >> - return; >> - >> - rq = task_rq(p); >> + if ((old_weight > 1) == (new_weight > 1)) >> + goto out; >> >> /* >>* The process used to be able to migrate OR it can now migrate >>*/ >> - if (weight <= 1) { >> + if (new_weight <= 1) { >> if (!task_current(rq, p)) >> dequeue_pushable_task(rq, p); >> BUG_ON(!rq->rt.rt_nr_migratory); >> @@ -1919,6 +1970,15 @@ static void set_cpus_allowed_rt(struct task_struct *p, >> } >> >> update_rt_migration(&rq->rt); >> + >> +out: >> + BUG_ON(direct_push == 1 && preempt_push == 1); > > Do we really need this bug on? > >> + >> + if (direct_push) >> + push_rt_tasks(rq); >> + >> + if (preempt_push) > > We could make that an "else if" if they really are mutually exclusive. > I'll fix those things, and resend another version. Thanks, Xunlei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v3] pinctrl: exynos: Add support for Exynos5433
Hi, 2015-01-29 18:48 GMT+09:00 Linus Walleij : > On Wed, Jan 21, 2015 at 7:43 AM, Chanwoo Choi wrote: > >> This patch adds driver data for Exynos5433 SoC. Exynos5433 includes 228 >> multi- >> functional input/output port pins and 135 memory port pins. There are 41 >> general >> port groups and 2 memory port groups. >> >> Cc: Tomasz Figa >> Cc: Thomas Abraham >> Cc: Linus Walleij >> Signed-off-by: Chanwoo Choi >> Acked-by: Inki Dae >> --- >> Changes from v2: >> - Rebase it on v3.19-rc5 > > Waiting for Tomasz to review this. Thanks Linus. Looks good to me. Acked-by: Tomasz Figa Best regards, Tomasz -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] spi: bcm53xx: use msecs_to_jiffies for conversion
Converting milliseconds to jiffies by "val * HZ / 1000" is technically ok but msecs_to_jiffies(val) is the cleaner solution and handles all corner cases correctly. This is only an API consolidation and should make things more readable Signed-off-by: Nicholas Mc Guire --- Patch was compile-tested only with Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/spi/spi-bcm53xx.c |4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/spi/spi-bcm53xx.c b/drivers/spi/spi-bcm53xx.c index 17b34cb..1933ef3 100644 --- a/drivers/spi/spi-bcm53xx.c +++ b/drivers/spi/spi-bcm53xx.c @@ -44,7 +44,7 @@ static int bcm53xxspi_wait(struct bcm53xxspi *b53spi, unsigned int timeout_ms) u32 tmp; /* SPE bit has to be 0 before we read MSPI STATUS */ - deadline = jiffies + BCM53XXSPI_SPE_TIMEOUT_MS * HZ / 1000; + deadline = jiffies + msecs_to_jiffies(BCM53XXSPI_SPE_TIMEOUT_MS); do { tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_SPCR2); if (!(tmp & B53SPI_MSPI_SPCR2_SPE)) @@ -56,7 +56,7 @@ static int bcm53xxspi_wait(struct bcm53xxspi *b53spi, unsigned int timeout_ms) goto spi_timeout; /* Check status */ - deadline = jiffies + timeout_ms * HZ / 1000; + deadline = jiffies + msecs_to_jiffies(timeout_ms); do { tmp = bcm53xxspi_read(b53spi, B53SPI_MSPI_MSPI_STATUS); if (tmp & B53SPI_MSPI_MSPI_STATUS_SPIF) { -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v2 1/2] sched/rt: Check to push the task when changing its affinity
On 8 February 2015 at 22:55, Xunlei Pang wrote: > Hi Steve, > > On 7 February 2015 at 05:09, Steven Rostedt wrote: >> On Thu, 5 Feb 2015 23:59:33 +0800 >> >> if (task_running(rq, p)) { >> if (cpumask_test_cpu() && cpupri_find()) { >> } >> } else { >> direct push = 1 >> >> Also, is the copy of cpus_allowed only done so that cpupri_find is >> called? If so maybe move it in there too: >> >> if (task_running(rq, p)) { >> if (!cpumask_test_cpu()) >> goto update; >> >> cpumask_copy(&p->cpus_allowed, new_mask); >> p->nr_cpus_allowed = new_weight; >> >> if (!cpupri_find()) >> goto update; >> >> [...] >> >> This way we avoid the double copy of cpumask unless we truly need to do >> it. > > The new_mask can also be used by direct_push case, so I think it's ok. I guess you mean to avoid the copy if cpumask_test_cpu() is false. I think this function is not the hot path, making this will make the code indents too many times or not so good to look, a little awful. Thanks, Xunlei -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [RFC PATCH 3/8] kmod - teach call_usermodehelper() to use a namespace
On Sun, 08 Feb 2015 11:07:32 +0800 Ian Kent wrote: > On Fri, 2015-02-06 at 07:08 -0500, Jeff Layton wrote: > > On Thu, 05 Feb 2015 10:34:11 +0800 > > Ian Kent wrote: > > > > > The call_usermodehelper() function executes all binaries in the > > > global "init" root context. This doesn't allow a binary to be run > > > within a namespace (eg. the namespace of a container). > > > > > > Both containerized NFS client and NFS server need the ability to > > > execute a binary in a container's context. To do this use the init > > > process of the callers environment is used to setup the namespaces > > > in the same way the root init process is used otherwise. > > > > > > Signed-off-by: Ian Kent > > > Cc: Benjamin Coddington > > > Cc: Al Viro > > > Cc: J. Bruce Fields > > > Cc: David Howells > > > Cc: Trond Myklebust > > > Cc: Oleg Nesterov > > > Cc: Eric W. Biederman > > > Cc: Jeff Layton > > > --- > > > include/linux/kmod.h | 16 +++ > > > kernel/kmod.c| 115 > > > +- > > > 2 files changed, 128 insertions(+), 3 deletions(-) > > > > > > diff --git a/include/linux/kmod.h b/include/linux/kmod.h > > > index 15bdeed..b0f1b3c 100644 > > > --- a/include/linux/kmod.h > > > +++ b/include/linux/kmod.h > > > @@ -52,6 +52,7 @@ struct file; > > > #define UMH_WAIT_EXEC1 /* wait for the exec, but not the > > > process */ > > > #define UMH_WAIT_PROC2 /* wait for the process to complete */ > > > #define UMH_KILLABLE 4 /* wait for EXEC/PROC killable */ > > > +#define UMH_USE_NS 8 /* exec using caller's init namespace */ > > > > > > struct subprocess_info { > > > struct work_struct work; > > > @@ -69,6 +70,21 @@ struct subprocess_info { > > > extern int > > > call_usermodehelper(char *path, char **argv, char **envp, int flags); > > > > > > +#if !defined(CONFIG_PROC_FS) || !defined(CONFIG_NAMESPACES) > > > +inline struct task_struct *umh_get_init_task(void) > > > +{ > > > + return ERR_PTR(-ENOTSUP); > > > +} > > > + > > > +inline int umh_enter_ns(struct task_struct *tsk, struct cred *new) > > > +{ > > > + return -ENOTSUP; > > > +} > > > +#else > > > +struct task_struct *umh_get_init_pid(void); > > > +int umh_enter_ns(struct task_struct *tsk, struct cred *new); > > > +#endif > > > + > > > extern struct subprocess_info * > > > call_usermodehelper_setup(char *path, char **argv, char **envp, gfp_t > > > gfp_mask, > > > int (*init)(struct subprocess_info *info, struct cred > > > *new), > > > diff --git a/kernel/kmod.c b/kernel/kmod.c > > > index 14c0188..4c649d6 100644 > > > --- a/kernel/kmod.c > > > +++ b/kernel/kmod.c > > > @@ -582,6 +582,98 @@ unlock: > > > } > > > EXPORT_SYMBOL(call_usermodehelper_exec); > > > > > > +#if defined(CONFIG_PROC_FS) && defined(CONFIG_NAMESPACES) > > > +#define NS_PATH_MAX 35 > > > +#define NS_PATH_FMT "%lu/ns/%s" > > > + > > > +/* Note namespace name order is significant */ > > > +static const char *ns_names[] = { "user", "ipc", "uts", "net", "pid", > > > "mnt", NULL }; > > > + > > > +struct task_struct *umh_get_init_pid(void) > > > > nit: we're not getting a pid here but a task_struct pointer. Maybe this > > should be called umh_get_init_task? > > Ha, yep. > > > > > > +{ > > > + struct task_struct *tsk; > > > + > > > + rcu_read_lock(); > > > + tsk = find_task_by_vpid(1); > > > + if (tsk) > > > + get_task_struct(tsk); > > > + rcu_read_unlock(); > > > > I'm not terribly familiar with the task_struct lifetime rules... > > > > I assume that you can be assured that tsk won't go away while you hold > > the rcu_read_lock, but is doing a get_task_struct while holding it > > sufficient to pin it after you drop the lock? > > > > IOW, could the refcount on the task_struct do a 0->1 transition here and > > end up being freed anyway after you've grabbed a reference? > > Good point, I thought getting a reference under he read lock would be > enough but maybe I need more checks as I do with dentrys. I'll check > that. > It looks like the rcu_read_lock is mostly there to protect the pid_hash actually, and get_pid_task seems to do something very similar here. So, I think you're probably fine to do what you're doing in this patch. That said, the "What is struct pid?" comments in include/linux/pid.h are interesting. I wonder if my comments on your original patch were actually unfounded. If you hold a reference to a pid_t, that might be enough to ensure that it doesn't get reused, but I'm not sure at that point if it could end up being detached from the task. I suspect that pinning the actual task like you're doing here is probably the right thing to do, but I'd certainly value input from someone who understands the task/pid interaction better than I do. -- Jeff Layton -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger
[PATCH] usb: phy: am335x-control: check return value of bus_find_device
This fixes a potential null pointer dereference. Signed-off-by: David Dueck --- drivers/usb/phy/phy-am335x-control.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/phy/phy-am335x-control.c b/drivers/usb/phy/phy-am335x-control.c index 403fab7..7b3035f 100644 --- a/drivers/usb/phy/phy-am335x-control.c +++ b/drivers/usb/phy/phy-am335x-control.c @@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device *dev) return NULL; dev = bus_find_device(&platform_bus_type, NULL, node, match); + if (!dev) + return NULL; + ctrl_usb = dev_get_drvdata(dev); if (!ctrl_usb) return NULL; -- 2.2.2 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] CRIS: enable GPIOLIB
Enable GPIOLIB on CRIS so that we can use the generic GPIO APIs. Signed-off-by: Rabin Vincent --- arch/cris/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 52731e2..8474c66 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -52,6 +52,7 @@ config CRIS select CLONE_BACKWARDS2 select OLD_SIGSUSPEND select OLD_SIGACTION + select ARCH_REQUIRE_GPIOLIB config HZ int -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/4] CRIS: add device tree support
Add support for booting CRIS with a built-in device tree. Signed-off-by: Rabin Vincent --- arch/cris/Kconfig | 6 ++ arch/cris/Makefile| 4 arch/cris/boot/dts/Makefile | 6 ++ arch/cris/kernel/Makefile | 1 + arch/cris/kernel/devicetree.c | 14 ++ arch/cris/kernel/setup.c | 13 + 6 files changed, 44 insertions(+) create mode 100644 arch/cris/boot/dts/Makefile create mode 100644 arch/cris/kernel/devicetree.c diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index 8474c66..cbbc2dc 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -53,11 +53,17 @@ config CRIS select OLD_SIGSUSPEND select OLD_SIGACTION select ARCH_REQUIRE_GPIOLIB + select OF + select OF_EARLY_FLATTREE config HZ int default 100 +config BUILTIN_DTB + string "DTB to build into the kernel image" + depends on OF + source "init/Kconfig" source "kernel/Kconfig.freezer" diff --git a/arch/cris/Makefile b/arch/cris/Makefile index 39dc7d0..4a5404b 100644 --- a/arch/cris/Makefile +++ b/arch/cris/Makefile @@ -40,6 +40,10 @@ else MACH := endif +ifneq ($(CONFIG_BUILTIN_DTB),"") +core-$(CONFIG_OF) += arch/cris/boot/dts/ +endif + LD = $(CROSS_COMPILE)ld -mcrislinux OBJCOPYFLAGS := -O binary -R .note -R .comment -S diff --git a/arch/cris/boot/dts/Makefile b/arch/cris/boot/dts/Makefile new file mode 100644 index 000..faf69fb --- /dev/null +++ b/arch/cris/boot/dts/Makefile @@ -0,0 +1,6 @@ +BUILTIN_DTB := $(patsubst "%",%,$(CONFIG_BUILTIN_DTB)).dtb.o +ifneq ($(CONFIG_BUILTIN_DTB),"") +obj-$(CONFIG_OF) += $(BUILTIN_DTB) +endif + +clean-files := *.dtb.S diff --git a/arch/cris/kernel/Makefile b/arch/cris/kernel/Makefile index b45640b..edef71f 100644 --- a/arch/cris/kernel/Makefile +++ b/arch/cris/kernel/Makefile @@ -7,6 +7,7 @@ CPPFLAGS_vmlinux.lds := -DDRAM_VIRTUAL_BASE=0x$(CONFIG_ETRAX_DRAM_VIRTUAL_BASE) extra-y:= vmlinux.lds obj-y := process.o traps.o irq.o ptrace.o setup.o time.o sys_cris.o +obj-y += devicetree.o obj-$(CONFIG_MODULES)+= crisksyms.o obj-$(CONFIG_MODULES) += module.o diff --git a/arch/cris/kernel/devicetree.c b/arch/cris/kernel/devicetree.c new file mode 100644 index 000..53ff8d7 --- /dev/null +++ b/arch/cris/kernel/devicetree.c @@ -0,0 +1,14 @@ +#include +#include +#include + +void __init early_init_dt_add_memory_arch(u64 base, u64 size) +{ + pr_err("%s(%llx, %llx)\n", + __func__, base, size); +} + +void * __init early_init_dt_alloc_memory_arch(u64 size, u64 align) +{ + return alloc_bootmem_align(size, align); +} diff --git a/arch/cris/kernel/setup.c b/arch/cris/kernel/setup.c index 905b70e..f11538e 100644 --- a/arch/cris/kernel/setup.c +++ b/arch/cris/kernel/setup.c @@ -19,6 +19,9 @@ #include #include #include +#include +#include +#include #include #include @@ -64,6 +67,8 @@ void __init setup_arch(char **cmdline_p) unsigned long start_pfn, max_pfn; unsigned long memory_start; + early_init_dt_scan(__dtb_start); + /* register an initial console printing routine for printk's */ init_etrax_debug(); @@ -141,6 +146,8 @@ void __init setup_arch(char **cmdline_p) reserve_bootmem(PFN_PHYS(start_pfn), bootmap_size, BOOTMEM_DEFAULT); + unflatten_and_copy_device_tree(); + /* paging_init() sets up the MMU and marks all pages as reserved */ paging_init(); @@ -204,3 +211,9 @@ static int __init topology_init(void) subsys_initcall(topology_init); +static int __init cris_of_init(void) +{ + of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL); + return 0; +} +core_initcall(cris_of_init); -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 4/4] CRIS: add Axis 88 board device tree
Add a minimal device tree for the ETRAX FS SoC and the Axis 88 developer board. Signed-off-by: Rabin Vincent --- arch/cris/boot/dts/dev88.dts| 18 ++ arch/cris/boot/dts/etraxfs.dtsi | 38 ++ 2 files changed, 56 insertions(+) create mode 100644 arch/cris/boot/dts/dev88.dts create mode 100644 arch/cris/boot/dts/etraxfs.dtsi diff --git a/arch/cris/boot/dts/dev88.dts b/arch/cris/boot/dts/dev88.dts new file mode 100644 index 000..4fa5a3f --- /dev/null +++ b/arch/cris/boot/dts/dev88.dts @@ -0,0 +1,18 @@ +/dts-v1/; + +/include/ "etraxfs.dtsi" + +/ { + model = "Axis 88 Developer Board"; + compatible = "axis,dev88"; + + aliases { + serial0 = &uart0; + }; + + soc { + uart0: serial@b0026 { + status = "okay"; + }; + }; +}; diff --git a/arch/cris/boot/dts/etraxfs.dtsi b/arch/cris/boot/dts/etraxfs.dtsi new file mode 100644 index 000..909bced --- /dev/null +++ b/arch/cris/boot/dts/etraxfs.dtsi @@ -0,0 +1,38 @@ +/ { + #address-cells = <1>; + #size-cells = <1>; + interrupt-parent = <&intc>; + + cpus { + #address-cells = <1>; + #size-cells = <0>; + + cpu@0 { + device_type = "cpu"; + model = "axis,crisv32"; + reg = <0>; + }; + }; + + soc { + compatible = "simple-bus"; + model = "etraxfs"; + #address-cells = <1>; + #size-cells = <1>; + ranges; + + intc: interrupt-controller { + compatible = "axis,crisv32-intc"; + reg = <0xb001c000 0x1000>; + interrupt-controller; + #interrupt-cells = <1>; + }; + + serial@b0026 { + compatible = "axis,etraxfs-uart"; + reg = <0xb0026000 0x1000>; + interrupts = <68>; + status = "disabled"; + }; + }; +}; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 3/4] CRIS: document CRISv32 intc bindings
Add the DT bindings documentation for the CRISV32 interrupt controller. Signed-off-by: Rabin Vincent --- .../interrupt-controller/axis,crisv32-intc.txt | 18 ++ 1 file changed, 18 insertions(+) create mode 100644 Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt diff --git a/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt b/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt new file mode 100644 index 000..3726f14 --- /dev/null +++ b/Documentation/devicetree/bindings/interrupt-controller/axis,crisv32-intc.txt @@ -0,0 +1,18 @@ +Axis CRISv32 interrupt controller + +Required properties: +- compatible: Compatible property value should be "axis,cris32-intc" + +- reg: Physical base address of the controller and length of memory mapped + region. + +- interrupt-controller : Identifies the node as an interrupt controller + +Example: + +interrupt-controller { + compatible = "axis,crisv32-intc"; + interrupt-controller; + reg = <0xb001c000 0x1000>; + #interrupt-cells = <1>; +}; -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 2/4] CRISv32: add irq domains support
Add support for IRQ domains to the CRISv32 interrupt controller. Signed-off-by: Rabin Vincent --- arch/cris/Kconfig | 1 + arch/cris/arch-v32/kernel/irq.c | 28 +--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/arch/cris/Kconfig b/arch/cris/Kconfig index cbbc2dc..66f71df 100644 --- a/arch/cris/Kconfig +++ b/arch/cris/Kconfig @@ -55,6 +55,7 @@ config CRIS select ARCH_REQUIRE_GPIOLIB select OF select OF_EARLY_FLATTREE + select IRQ_DOMAIN if ETRAX_ARCH_V32 config HZ int diff --git a/arch/cris/arch-v32/kernel/irq.c b/arch/cris/arch-v32/kernel/irq.c index 25437ae..bc871d2 100644 --- a/arch/cris/arch-v32/kernel/irq.c +++ b/arch/cris/arch-v32/kernel/irq.c @@ -10,6 +10,8 @@ #include #include #include +#include +#include #include #include #include @@ -431,6 +433,19 @@ crisv32_do_multiple(struct pt_regs* regs) irq_exit(); } +static int crisv32_irq_map(struct irq_domain *h, unsigned int virq, + irq_hw_number_t hw_irq_num) +{ + irq_set_chip_and_handler(virq, &crisv32_irq_type, handle_simple_irq); + + return 0; +} + +static struct irq_domain_ops crisv32_irq_ops = { + .map= crisv32_irq_map, + .xlate = irq_domain_xlate_onecell, +}; + /* * This is called by start_kernel. It fixes the IRQ masks and setup the * interrupt vector table to point to bad_interrupt pointers. @@ -441,6 +456,8 @@ init_IRQ(void) int i; int j; reg_intr_vect_rw_mask vect_mask = {0}; + struct device_node *np; + struct irq_domain *domain; /* Clear all interrupts masks. */ for (i = 0; i < NBR_REGS; i++) @@ -449,10 +466,15 @@ init_IRQ(void) for (i = 0; i < 256; i++) etrax_irv->v[i] = weird_irq; - /* Point all IRQ's to bad handlers. */ + np = of_find_compatible_node(NULL, NULL, "axis,crisv32-intc"); + domain = irq_domain_add_legacy(np, NR_IRQS - FIRST_IRQ, + FIRST_IRQ, FIRST_IRQ, + &crisv32_irq_ops, NULL); + BUG_ON(!domain); + irq_set_default_host(domain); + of_node_put(np); + for (i = FIRST_IRQ, j = 0; j < NR_IRQS; i++, j++) { - irq_set_chip_and_handler(j, &crisv32_irq_type, -handle_simple_irq); set_exception_vector(i, interrupt[j]); } -- 2.1.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] lib/int_sqrt.c: Optimize square root function
Dear Mr. linus, Thanks for quick replies. Yes performance numbers are not conclusive enough. So its better to discard this patch as of now. I will try to explore more in this area. Thanks & regards Anshul Garg On Fri, Feb 6, 2015 at 1:07 AM, Linus Torvalds wrote: > On Thu, Feb 5, 2015 at 10:43 AM, Anshul Garg wrote: >> >> NOTE :: >> I have not used gcc optimizations while compilation. >> With O2 level optimization proposed solution is taking more time. > > The thing is, the kernel is compiled with -O2, so that's what matters. > > Also, for very tight loops like this, the major costs tend to be very > subtle microarchitectural details, particularly branch prediction. > Which in turn end up sometimes depending on just exactly where the > branches were placed, and even whether two conditional branches were > in the same 8-byte aligned region etc things (because the branch > prediction might be done ignoring the low bits of the EIP etc). So not > only does the exact microarchitecture matter, things that don't *seem* > like they should matter can change behavior a lot. > > My point is really that the performance numbers are very ambiguous. > The patch may well help in some situations, but hurt in others. > > Linus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v2] i2c: axxia: fixup return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. The return variable is renamed to reflect its use and the type adjusted to unsigned long. Signed-off-by: Nicholas Mc Guire --- v2: variable renamed rather than just changing the type as suggested by Wolfram Sang . Further the two separate patches were merged as the changed are conceptually identical. Patch was only compile tested with axm55xx_defconfig (implies CONFIG_I2C_AXXIA=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-axxia.c | 16 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c index 768a598..7e45d05 100644 --- a/drivers/i2c/busses/i2c-axxia.c +++ b/drivers/i2c/busses/i2c-axxia.c @@ -334,7 +334,7 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) u32 int_mask = MST_STATUS_ERR | MST_STATUS_SNS; u32 rx_xfer, tx_xfer; u32 addr_1, addr_2; - int ret; + unsigned long timeout; if (msg->len > 255) { dev_warn(idev->dev, "unsupported length %u\n", msg->len); @@ -388,15 +388,15 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) i2c_int_enable(idev, int_mask); - ret = wait_for_completion_timeout(&idev->msg_complete, - I2C_XFER_TIMEOUT); + timeout = wait_for_completion_timeout(&idev->msg_complete, + I2C_XFER_TIMEOUT); i2c_int_disable(idev, int_mask); if (readl(idev->base + MST_COMMAND) & CMD_BUSY) dev_warn(idev->dev, "busy after xfer\n"); - if (ret == 0) + if (timeout == 0) idev->msg_err = -ETIMEDOUT; if (unlikely(idev->msg_err) && idev->msg_err != -ENXIO) @@ -408,17 +408,17 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev *idev, struct i2c_msg *msg) static int axxia_i2c_stop(struct axxia_i2c_dev *idev) { u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC; - int ret; + unsigned long timeout; reinit_completion(&idev->msg_complete); /* Issue stop */ writel(0xb, idev->base + MST_COMMAND); i2c_int_enable(idev, int_mask); - ret = wait_for_completion_timeout(&idev->msg_complete, - I2C_STOP_TIMEOUT); + timeout = wait_for_completion_timeout(&idev->msg_complete, + I2C_STOP_TIMEOUT); i2c_int_disable(idev, int_mask); - if (ret == 0) + if (timeout == 0) return -ETIMEDOUT; if (readl(idev->base + MST_COMMAND) & CMD_BUSY) -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i2c: axxia: match return type of wait_for_completion_timeout
On Sun, 08 Feb 2015, Wolfram Sang wrote: > On Sun, Feb 08, 2015 at 05:31:25AM -0500, Nicholas Mc Guire wrote: > > return type of wait_for_completion_timeout is unsigned long not int. as ret > > is only used for wait_for_completion_timeout here the type is simply changed > > unsigned long. > > > > Signed-off-by: Nicholas Mc Guire > > --- > > > > Patch was only compile tested with axm55xx_defconfig > > (implies CONFIG_I2C_AXXIA=y) > > > > Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) > > > > drivers/i2c/busses/i2c-axxia.c |2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/drivers/i2c/busses/i2c-axxia.c b/drivers/i2c/busses/i2c-axxia.c > > index 1decc88..9434824 100644 > > --- a/drivers/i2c/busses/i2c-axxia.c > > +++ b/drivers/i2c/busses/i2c-axxia.c > > @@ -408,7 +408,7 @@ static int axxia_i2c_xfer_msg(struct axxia_i2c_dev > > *idev, struct i2c_msg *msg) > > static int axxia_i2c_stop(struct axxia_i2c_dev *idev) > > { > > u32 int_mask = MST_STATUS_ERR | MST_STATUS_SCC; > > - int ret; > > + unsigned long ret; > > 'ret' being an int is kind of an idiom, so I'd rather see the variable > renamed, too, like the other patches do. > thanks - was not renaming variables - only if a new one was introduced I gave it a name that was related to the timeout use. Will consider that for some of the other cleanups then as well. > Also, please combine the two axxia patches into one. > done and resent. thx! hofrat -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: gadget: fix sparse warnings
Hi Felipe, On Thursday 05 February 2015 12:08:09 Felipe Balbi wrote: > On Thu, Feb 05, 2015 at 05:02:46PM +0200, Laurent Pinchart wrote: > > Hi Prabhakar, > > > > Thank you for the patch. > > > > On Thursday 05 February 2015 13:02:18 Lad Prabhakar wrote: > > > From: "Lad, Prabhakar" > > > > > > this patch fixes following sparse warnings: > > > > > > uvc_video.c:283:5: warning: symbol 'uvcg_video_pump' was not declared. > > > Should it be static? uvc_video.c:342:5: warning: symbol > > > 'uvcg_video_enable' > > > was not declared. Should it be static? uvc_video.c:381:5: warning: > > > symbol > > > 'uvcg_video_init' was not declared. Should it be static? > > > > > > Signed-off-by: Lad, Prabhakar > > > > Acked-by: Laurent Pinchart > > > > Felipe, could you please take this in your tree ? > > my tree is closed for v3.20. I'll pick it up once -rc1 is out That's good, I was targeting v3.21 too. How do you usually ensure that patches don't get lost, do you apply them to a n+1 branch straight away (which is what I was asking in my previous mail), rely on patchwork or some similar tool, or expect developers to ping you again when -rc1 is out ? -- Regards, Laurent Pinchart -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH v5 1/3] irqchip: vf610-mscm-ir: add support for MSCM interrupt router
On 2015-02-07 11:56, Paul Bolle wrote: > On Fri, 2015-02-06 at 20:51 +0100, Stefan Agner wrote: >> This adds support for Vybrid's interrupt router. On VF6xx models, >> almost all peripherals can be used by either of the two CPU's, >> the Cortex-A5 or the Cortex-M4. The interrupt router routes the >> peripheral interrupts to the configured CPU. >> >> This IRQ chip driver configures the interrupt router to route >> the requested interrupt to the CPU the kernel is running on. >> The driver makes use of the irqdomain hierarchy support. The >> parent is given by the device tree. This should be one of the >> two possible parents either ARM GIC or the ARM NVIC interrupt >> controller. The latter is currently not yet supported. >> >> Note that there is no resource control mechnism implemented to >> avoid concurrent access of the same peripheral. The user needs >> to make sure to use device trees which assign the peripherals >> orthogonally. However, this driver warns the user in case the >> interrupt is already configured for the other CPU. This provides >> a poor man's resource controller. >> >> Acked-by: Marc Zyngier >> Signed-off-by: Stefan Agner >> --- >> arch/arm/mach-imx/Kconfig | 1 + >> drivers/irqchip/Kconfig | 11 ++ >> drivers/irqchip/Makefile| 1 + >> drivers/irqchip/irq-vf610-mscm-ir.c | 206 >> >> 4 files changed, 219 insertions(+) >> create mode 100644 drivers/irqchip/irq-vf610-mscm-ir.c >> >> diff --git a/arch/arm/mach-imx/Kconfig b/arch/arm/mach-imx/Kconfig >> index e8627e0..bf91a59 100644 >> --- a/arch/arm/mach-imx/Kconfig >> +++ b/arch/arm/mach-imx/Kconfig >> @@ -631,6 +631,7 @@ config SOC_IMX6SX >> >> config SOC_VF610 >> bool "Vybrid Family VF610 support" >> +select VF610_MSCM_IR >> select ARM_GIC >> select PINCTRL_VF610 >> select PL310_ERRATA_769419 if CACHE_L2X0 >> diff --git a/drivers/irqchip/Kconfig b/drivers/irqchip/Kconfig >> index cc79d2a..9c13d81 100644 >> --- a/drivers/irqchip/Kconfig >> +++ b/drivers/irqchip/Kconfig >> @@ -136,6 +136,17 @@ config IRQ_CROSSBAR >>a free irq and configures the IP. Thus the peripheral interrupts are >>routed to one of the free irqchip interrupt lines. >> >> +config VF610_MSCM_IR >> +bool >> +help >> + Support for MSCM interrupt router available on Vybrid SoC's. The >> + interrupt router is between the CPU's interrupt controller and the >> + peripheral. The router allows to route the peripheral interrupts to >> + one of the two available CPU's on Vybrid VF6xx SoC's (Cortex-A5 or >> + Cortex-M4). The router will be configured transparently on a IRQ >> + request. >> +select IRQ_DOMAIN_HIERARCHY >> + > > As far as I can tell this new Kconfig symbol operates in lockstep with > SOC_VF610: if SOC_VF610 is set, this will also be set, and if SOC_VF610 > is not set, this won't be set either. Is a separate symbol needed? Theoretically, this could be used by other SoC's. However, afaik the i.MX6 SoloX, which one could see as something like the successor of Vybrid, implements the interrupt routing differently. So I would be fine to just use the SOC_VF610 symbol instead. The only thing which I would rather prefer to keep is the comment what this is all about (the help text). But I guess I could move that as comment into the source file... > > If you decide to keep it, I have two minor nits. > > 1) Make the help text the last option of the Kconfig entry. It's legal > to put Kconfig options in any order that you'd like. But with very few > exceptions, the help text is always the last. Please use that pattern. > > 2) This Kconfig entry has no prompt, so I'm not aware of a way that > people ever can read this help text when running "make *configure". So > this help text is basically a comment. You might as well format it as a > comment then. > >> config KEYSTONE_IRQ >> tristate "Keystone 2 IRQ controller IP" >> depends on ARCH_KEYSTONE -- Stefan -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH v3 1/2] sched/rt: Check to push the task when changing its affinity
We may suffer from extra rt overload rq due to the affinity, so when the affinity of any runnable rt task is changed, we should check to trigger balancing, otherwise it will cause some unnecessary delayed real-time response. Unfortunately, current RT global scheduler doesn't trigger anything. For example: a 2-cpu system with two runnable FIFO tasks(same rt_priority) bound on CPU0, let's name them rt1(running) and rt2(runnable) respectively; CPU1 has no RTs. Then, someone sets the affinity of rt2 to 0x3(i.e. CPU0 and CPU1), but after this, rt2 still can't be scheduled until rt1 enters schedule(), this definitely causes some/big response latency for rt2. So, when doing set_cpus_allowed_rt(), if detecting such cases, check to trigger a push behaviour. Signed-off-by: Xunlei Pang --- v2, v3: Refine according to Steven Rostedt's comments. kernel/sched/rt.c | 78 --- 1 file changed, 68 insertions(+), 10 deletions(-) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index f4d4b07..04c58b7 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1428,10 +1428,9 @@ static struct sched_rt_entity *pick_next_rt_entity(struct rq *rq, return next; } -static struct task_struct *_pick_next_task_rt(struct rq *rq) +static struct task_struct *peek_next_task_rt(struct rq *rq) { struct sched_rt_entity *rt_se; - struct task_struct *p; struct rt_rq *rt_rq = &rq->rt; do { @@ -1440,7 +1439,14 @@ static struct task_struct *_pick_next_task_rt(struct rq *rq) rt_rq = group_rt_rq(rt_se); } while (rt_rq); - p = rt_task_of(rt_se); + return rt_task_of(rt_se); +} + +static inline struct task_struct *_pick_next_task_rt(struct rq *rq) +{ + struct task_struct *p; + + p = peek_next_task_rt(rq); p->se.exec_start = rq_clock_task(rq); return p; @@ -1886,28 +1892,74 @@ static void set_cpus_allowed_rt(struct task_struct *p, const struct cpumask *new_mask) { struct rq *rq; - int weight; + int old_weight, new_weight; + int preempt_push = 0, direct_push = 0; BUG_ON(!rt_task(p)); if (!task_on_rq_queued(p)) return; - weight = cpumask_weight(new_mask); + old_weight = p->nr_cpus_allowed; + new_weight = cpumask_weight(new_mask); + + rq = task_rq(p); + + if (new_weight > 1 && + rt_task(rq->curr) && + !test_tsk_need_resched(rq->curr)) { + /* +* We own p->pi_lock and rq->lock. rq->lock might +* get released when doing direct pushing, however +* p->pi_lock is always held, so it's safe to assign +* the new_mask and new_weight to p below. +*/ + if (!task_running(rq, p)) { + cpumask_copy(&p->cpus_allowed, new_mask); + p->nr_cpus_allowed = new_weight; + direct_push = 1; + } else if (cpumask_test_cpu(task_cpu(p), new_mask)) { + cpumask_copy(&p->cpus_allowed, new_mask); + p->nr_cpus_allowed = new_weight; + if (!cpupri_find(&rq->rd->cpupri, p, NULL)) + goto update; + + /* +* At this point, current task gets migratable most +* likely due to the change of its affinity, let's +* figure out if we can migrate it. +* +* Is there any task with the same priority as that +* of current task? If found one, we should resched. +* NOTE: The target may be unpushable. +*/ + if (p->prio == rq->rt.highest_prio.next) { + /* One target just in pushable_tasks list. */ + requeue_task_rt(rq, p, 0); + preempt_push = 1; + } else if (rq->rt.rt_nr_total > 1) { + struct task_struct *next; + + requeue_task_rt(rq, p, 0); + next = peek_next_task_rt(rq); + if (next != p && next->prio == p->prio) + preempt_push = 1; + } + } + } +update: /* * Only update if the process changes its state from whether it * can migrate or not. */ - if ((p->nr_cpus_allowed > 1) == (weight > 1)) - return; - - rq = task_rq(p); + if ((old_weight > 1) == (new_weight > 1)) + goto out; /* * The process used to be able to migrate OR it can now migrate */ - if (weight <= 1) { +
[PATCH v3 2/2] sched/rt: Add check_preempt_equal_prio() logic in pick_next_task_rt()
check_preempt_curr() doesn't call sched_class::check_preempt_curr when the class of current is a higher level. So if there is a DL task running when doing this for RT, check_preempt_equal_prio() will definitely miss, which may result in some response latency for this RT task if it is pinned and there're some same-priority migratable rt tasks already queued. We should do the similar thing in select_task_rq_rt() when first picking rt tasks after running out of DL tasks. This patch tackles the issue by peeking the next rt task(RT1), and if find RT1 migratable, just requeue it to the tail of the rq using requeue_task_rt(rq, p, 0). In this way: - If there do have another rt task(RT2) with the same priority as RT1, RT2 will finally be picked as the running task. While RT1 will be pushed onto another cpu via RT1's post_schedule(), as RT1 is migratable. The difference from check_preempt_equal_prio() here is that we just don't care whether RT2 is migratable. - Otherwise, if there's no rt task with the same priority as RT1, RT1 will still be picked as the running task after the requeuing. Signed-off-by: Xunlei Pang --- kernel/sched/rt.c | 16 1 file changed, 16 insertions(+) diff --git a/kernel/sched/rt.c b/kernel/sched/rt.c index 04c58b7..26114f5 100644 --- a/kernel/sched/rt.c +++ b/kernel/sched/rt.c @@ -1482,6 +1482,22 @@ pick_next_task_rt(struct rq *rq, struct task_struct *prev) put_prev_task(rq, prev); +#ifdef CONFIG_SMP + /* +* If there's a running higher class task, check_preempt_curr() +* doesn't invoke check_preempt_equal_prio() for rt tasks, so +* we can do the similar thing here. +*/ + if (rq->rt.rt_nr_total > 1 && + (prev->sched_class == &dl_sched_class || +prev->sched_class == &stop_sched_class)) { + p = peek_next_task_rt(rq); + if (p->nr_cpus_allowed != 1 && + cpupri_find(&rq->rd->cpupri, p, NULL)) + requeue_task_rt(rq, p, 0); + } +#endif + p = _pick_next_task_rt(rq); /* The running task is never eligible for pushing */ -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 3/3] dm ioctl: Delete an unnecessary check before the function call "dm_table_destroy"
> FYI, I did stage your other patch for 3.20, see: > https://git.kernel.org/cgit/linux/kernel/git/device-mapper/linux-dm.git/commit/?h=dm-for-3.20&id=d0ce7e911c97c7c6df1081dcedfefced82a0c6bf Thanks for your acceptance of the suggested clean-up around vfree() function calls at least. Additional source code places can also be reconsidered at other times, can't they? Regards, Markus -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] usb: phy: am335x-control: check return value of bus_find_device
On 02/08/2015 04:29 PM, David Dueck wrote: > This fixes a potential null pointer dereference. > > Signed-off-by: David Dueck Acked-by: Sebastian Andrzej Siewior Fixes: d4332013919a ("driver core: dev_get_drvdata: Don't check for NULL dev") Greg, this is a regression since d43320139 ("driver core: dev_get_drvdata: Don't check for NULL dev"). I didn't check for NULL after bus_find_device() because I knew that dev_get_drvdata() will do it. > --- > drivers/usb/phy/phy-am335x-control.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/usb/phy/phy-am335x-control.c > b/drivers/usb/phy/phy-am335x-control.c > index 403fab7..7b3035f 100644 > --- a/drivers/usb/phy/phy-am335x-control.c > +++ b/drivers/usb/phy/phy-am335x-control.c > @@ -126,6 +126,9 @@ struct phy_control *am335x_get_phy_control(struct device > *dev) > return NULL; > > dev = bus_find_device(&platform_bus_type, NULL, node, match); > + if (!dev) > + return NULL; > + > ctrl_usb = dev_get_drvdata(dev) > if (!ctrl_usb) > return NULL; > Sebastian -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] i2c: at91: fixup return type of wait_for_completion_timeout
Return type of wait_for_completion_timeout is unsigned long not int. This patch adds a timeout variable of appropriate type and fixes up the assignment. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with at91_dt_defconfig (implies CONFIG_I2C_AT91=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/i2c/busses/i2c-at91.c |7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/drivers/i2c/busses/i2c-at91.c b/drivers/i2c/busses/i2c-at91.c index 636fd2e..79c6404 100644 --- a/drivers/i2c/busses/i2c-at91.c +++ b/drivers/i2c/busses/i2c-at91.c @@ -381,6 +381,7 @@ static irqreturn_t atmel_twi_interrupt(int irq, void *dev_id) static int at91_do_twi_transfer(struct at91_twi_dev *dev) { int ret; + unsigned long timeout; bool has_unre_flag = dev->pdata->has_unre_flag; dev_dbg(dev->dev, "transfer: %s %d bytes.\n", @@ -436,9 +437,9 @@ static int at91_do_twi_transfer(struct at91_twi_dev *dev) } } - ret = wait_for_completion_timeout(&dev->cmd_complete, -dev->adapter.timeout); - if (ret == 0) { + timeout = wait_for_completion_timeout(&dev->cmd_complete, + dev->adapter.timeout); + if (timeout == 0) { dev_err(dev->dev, "controller timed out\n"); at91_init_twi_bus(dev); ret = -ETIMEDOUT; -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[V3 PATCH 0/2] Introduce ACPI support for ahci_platform driver
This patch series introduce ACPI support for non-PCI AHCI platform driver. Existing ACPI support for AHCI assumes the device controller is a PCI device. Also, since there is no ACPI _HID/_CID for generic AHCI controller, the driver could not use them for matching devices. Therefore, this patch introduces a mechanism for drivers to match devices using ACPI _CLS method. This patch series is rebased from and tested with: http://git.linaro.org/leg/acpi/acpi.git acpi-5.1-v8 This topic was discussed earlier here (as part of introducing support for AMD Seattle SATA controller): http://marc.info/?l=linux-arm-kernel&m=141083492521584&w=2 Changes from V2 (https://lkml.org/lkml/2015/1/5/662) * Update with review comment from Rafael in patch 1/2 * Rebased and tested with acpi-5.1-v8 Changes from V1 (https://lkml.org/lkml/2014/12/19/345) * Rebased to 3.19.0-rc2 * Change from acpi_cls in device_driver to acpi_match_cls (Hanjun comment) * Change the matching logic in acpi_driver_match_device() due to the new special PRP0001 _HID. * Simplify the return type of acpi_match_device_cls() to boolean. Changes from RFC (https://lkml.org/lkml/2014/12/17/446) * Remove #ifdef and make non-ACPI version of the acpi_match_device_cls as inline. (per Arnd) * Simplify logic to retrieve and evaluate _CLS handle. (per Hanjun) Suravee Suthikulpanit (2): ACPI / scan: Add support for ACPI _CLS device matching ata: ahci_platform: Add ACPI _CLS matching drivers/acpi/scan.c | 75 +++-- drivers/ata/Kconfig | 2 +- drivers/ata/ahci_platform.c | 3 ++ include/acpi/acnames.h | 1 + include/linux/acpi.h| 10 ++ include/linux/device.h | 1 + include/linux/mod_devicetable.h | 6 7 files changed, 94 insertions(+), 4 deletions(-) -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[V3 PATCH 1/2] ACPI / scan: Add support for ACPI _CLS device matching
Device drivers typically use ACPI _HIDs/_CIDs listed in struct device_driver acpi_match_table to match devices. However, for generic drivers, we do not want to list _HID for all supported devices, and some device classes do not have _CID (e.g. SATA, USB). Instead, we can leverage ACPI _CLS, which specifies PCI-defined class code (i.e. base-class, subclass and programming interface). This patch adds support for matching ACPI devices using the _CLS method. Signed-off-by: Suravee Suthikulpanit --- drivers/acpi/scan.c | 75 +++-- include/acpi/acnames.h | 1 + include/linux/acpi.h| 10 ++ include/linux/device.h | 1 + include/linux/mod_devicetable.h | 6 5 files changed, 90 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index dc4d896..0579395 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -987,13 +987,82 @@ static bool acpi_of_driver_match_device(struct device *dev, bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { - if (!drv->acpi_match_table) - return acpi_of_driver_match_device(dev, drv); + bool ret = false; - return !!acpi_match_device(drv->acpi_match_table, dev); + if (drv->acpi_match_table) + ret = !!acpi_match_device(drv->acpi_match_table, dev); + + /* Next, try to match with special "PRP0001" _HID */ + if (!ret && drv->of_match_table) + ret = acpi_of_driver_match_device(dev, drv); + + /* Next, try to match with PCI-defined class-code */ + if (!ret && drv->acpi_match_cls) + ret = acpi_match_device_cls(drv->acpi_match_cls, dev); + + return ret; } EXPORT_SYMBOL_GPL(acpi_driver_match_device); +/** + * acpi_match_device_cls - Match a struct device against a ACPI _CLS method + * @dev_cls: A pointer to struct acpi_device_cls object to match against. + * @dev: The ACPI device structure to match. + * + * Check if @dev has a valid ACPI and _CLS handle. If there is a + * struct acpi_device_cls object for that handle, use that object to match + * against the given struct acpi_device_cls object. + * + * Return true on success or false on failure. + */ +bool acpi_match_device_cls(const struct acpi_device_cls *dev_cls, + const struct device *dev) +{ + acpi_status status; + union acpi_object *pkg; + struct acpi_device_cls cls; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer format = { sizeof("NNN"), "NNN" }; + struct acpi_buffer state = { 0, NULL }; + struct acpi_device *adev = ACPI_COMPANION(dev); + + if (!adev || !adev->status.present || !dev_cls) + return false; + + status = acpi_evaluate_object(adev->handle, METHOD_NAME__CLS, + NULL, &buffer); + if (ACPI_FAILURE(status)) + return false; + + /** +* Note: +* ACPIv5.1 defines the package to contain 3 integers for +* Base-Class code, Sub-Class code, and Programming Interface code. +*/ + pkg = buffer.pointer; + if (!pkg || + (pkg->type != ACPI_TYPE_PACKAGE) || + (pkg->package.count != 3)) { + dev_dbg(&adev->dev, "Invalid _CLS data\n"); + goto out; + } + + state.length = sizeof(struct acpi_device_cls); + state.pointer = &cls; + + status = acpi_extract_package(pkg, &format, &state); + if (ACPI_FAILURE(status)) + goto out; + + return (dev_cls->base_class == cls.base_class && + dev_cls->sub_class == cls.sub_class && + dev_cls->prog_interface == cls.prog_interface); +out: + kfree(pkg); + return false; +} +EXPORT_SYMBOL_GPL(acpi_match_device_cls); + static void acpi_free_power_resources_lists(struct acpi_device *device) { int i; diff --git a/include/acpi/acnames.h b/include/acpi/acnames.h index 7461327..22332a6 100644 --- a/include/acpi/acnames.h +++ b/include/acpi/acnames.h @@ -51,6 +51,7 @@ #define METHOD_NAME__BBN"_BBN" #define METHOD_NAME__CBA"_CBA" #define METHOD_NAME__CID"_CID" +#define METHOD_NAME__CLS"_CLS" #define METHOD_NAME__CRS"_CRS" #define METHOD_NAME__DDN"_DDN" #define METHOD_NAME__HID"_HID" diff --git a/include/linux/acpi.h b/include/linux/acpi.h index 536991b..9a01d5d 100644 --- a/include/linux/acpi.h +++ b/include/linux/acpi.h @@ -442,6 +442,10 @@ const struct acpi_device_id *acpi_match_device(const struct acpi_device_id *ids, extern bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv); + +bool acpi_match_device_cls(const struct acpi_device_cls *dev_cls, + const struct device *dev); + int acpi_device_ue
Re: [PATCH v9 2/3] i2c: iproc: Add Broadcom iProc I2C Driver
On Sat, Feb 07, 2015 at 09:25:25PM -0800, Ray Jui wrote: > Add initial support to the Broadcom iProc I2C controller found in the > iProc family of SoCs. > > The iProc I2C controller has separate internal TX and RX FIFOs, each has > a size of 64 bytes. The iProc I2C controller supports two bus speeds > including standard mode (100kHz) and fast mode (400kHz) > > Signed-off-by: Ray Jui > Reviewed-by: Scott Branden > Reviewed-by: Kevin Cernekee Looks good. What kind of tests have you done with exactly this version of the driver (not earlier ones)? signature.asc Description: Digital signature
Re: [V2 PATCH 1/2] ACPI / scan: Add support for ACPI _CLS device matching
Thank you for review comment. I am sending out V3 with your suggestions. Suravee On 01/22/2015 06:40 AM, Rafael J. Wysocki wrote: On Monday, January 05, 2015 03:11:14 PM Suravee Suthikulpanit wrote: Device drivers typically use ACPI _HIDs/_CIDs listed in struct device_driver acpi_match_table to match devices. However, for generic drivers, we do not want to list _HID for all supported devices, and some device classes do not have _CID (e.g. SATA, USB). Instead, we can leverage ACPI _CLS, which specifies PCI-defined class code (i.e. base-class, subclass and programming interface). This patch adds support for matching ACPI devices using the _CLS method. Signed-off-by: Suravee Suthikulpanit --- drivers/acpi/scan.c | 79 +++-- include/acpi/acnames.h | 1 + include/linux/acpi.h| 10 ++ include/linux/device.h | 1 + include/linux/mod_devicetable.h | 6 5 files changed, 94 insertions(+), 3 deletions(-) diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 16914cc..7b25221 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c @@ -987,13 +987,86 @@ static bool acpi_of_driver_match_device(struct device *dev, bool acpi_driver_match_device(struct device *dev, const struct device_driver *drv) { - if (!drv->acpi_match_table) - return acpi_of_driver_match_device(dev, drv); + bool ret = false; - return !!acpi_match_device(drv->acpi_match_table, dev); + if (drv->acpi_match_table) + ret = !!acpi_match_device(drv->acpi_match_table, dev); + + /* Next, try to match with special "PRP0001" _HID */ + if (!ret && drv->of_match_table) + ret = acpi_of_driver_match_device(dev, drv); + + /* Next, try to match with PCI-defined class-code */ + if (!ret && drv->acpi_match_cls) + ret = acpi_match_device_cls(drv->acpi_match_cls, dev); + + return ret; } EXPORT_SYMBOL_GPL(acpi_driver_match_device); +/** + * acpi_match_device_cls - Match a struct device against a ACPI _CLS method + * @dev_cls: A pointer to struct acpi_device_cls object to match against. + * @dev: The ACPI device structure to match. + * + * Check if @dev has a valid ACPI and _CLS handle. If there is a + * struct acpi_device_cls object for that handle, use that object to match + * against the given struct acpi_device_cls object. + * + * Return true on success or false on failure. + */ +bool acpi_match_device_cls(const struct acpi_device_cls *dev_cls, + const struct device *dev) +{ + bool ret = false; + acpi_status status; + union acpi_object *pkg; + struct acpi_device_cls cls; + struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; + struct acpi_buffer format = { sizeof("NNN"), "NNN" }; + struct acpi_buffer state = { 0, NULL }; + struct acpi_device *adev = ACPI_COMPANION(dev); + acpi_handle handle = ACPI_HANDLE(dev); That must be equal to adev->handle, so it is not necessary to use ACPI_HANDLE() here. + + if (!handle || !adev || !adev->status.present || !dev_cls) + return ret; return false; and set 'ret' later. And if you check 'adev', you don't need to check 'handle'. And you can use adev->handle directly below, so the 'handle' variable is not necessary. + + status = acpi_evaluate_object(handle, METHOD_NAME__CLS, NULL, &buffer); + if (ACPI_FAILURE(status)) + return ret; return false; + + /** +* Note: +* ACPIv5.1 defines the package to contain 3 integers for +* Base-Class code, Sub-Class code, and Programming Interface code. +*/ + pkg = buffer.pointer; + if (!pkg || + (pkg->type != ACPI_TYPE_PACKAGE) || + (pkg->package.count != 3)) { + dev_err(&adev->dev, "Invalid _CLS data\n"); dev_dbg() here, please. + goto out; + } + + state.length = sizeof(struct acpi_device_cls); + state.pointer = &cls; + + status = acpi_extract_package(pkg, &format, &state); + if (ACPI_FAILURE(status)) { + ACPI_EXCEPTION((AE_INFO, status, "Invalid data")); I'm not sure how useful that message is going to be to be honest. + goto out; + } + + if ((dev_cls->base_class == cls.base_class) && + (dev_cls->sub_class == cls.sub_class) && + (dev_cls->prog_interface == cls.prog_interface)) + ret = true; ret = dev_cls->base_class == cls.base_class && dev_cls->sub_class == cls.sub_class && dev_cls->prog_interface == cls.prog_interface; +out: + kfree(buffer.pointer); + return ret; +} +EXPORT_SYMBOL_GPL(acpi_match_device_cls); + static void acpi_free_power_resources_lists(struct acpi_device *device) { int i; di
[V3 PATCH 2/2] ata: ahci_platform: Add ACPI _CLS matching
This patch adds ACPI supports for AHCI platform driver, which uses _CLS method to match the device. The following is an example of ASL structure in DSDT for a SATA controller, which contains _CLS package to be matched by the ahci_platform driver: Device (AHC0) // AHCI Controller { Name(_HID, "AMDI0600") Name (_CCA, 1) Name (_CLS, Package (3) { 0x01, // Base Class: Mass Storage 0x06, // Sub-Class: serial ATA 0x01, // Interface: AHCI }) Name (_CRS, ResourceTemplate () { Memory32Fixed (ReadWrite, 0xE030, 0x0001) Interrupt (ResourceConsumer, Level, ActiveHigh, Exclusive,,,) { 387 } }) } Also, since ATA driver should not require PCI support for ATA_ACPI, this patch removes dependency in the driver/ata/Kconfig. Acked-by: Tejun Heo Signed-off-by: Suravee Suthikulpanit --- drivers/ata/Kconfig | 2 +- drivers/ata/ahci_platform.c | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig index 5f60155..50305e3 100644 --- a/drivers/ata/Kconfig +++ b/drivers/ata/Kconfig @@ -48,7 +48,7 @@ config ATA_VERBOSE_ERROR config ATA_ACPI bool "ATA ACPI Support" - depends on ACPI && PCI + depends on ACPI default y help This option adds support for ATA-related ACPI objects. diff --git a/drivers/ata/ahci_platform.c b/drivers/ata/ahci_platform.c index 18d5398..ae66974 100644 --- a/drivers/ata/ahci_platform.c +++ b/drivers/ata/ahci_platform.c @@ -71,12 +71,15 @@ static const struct of_device_id ahci_of_match[] = { }; MODULE_DEVICE_TABLE(of, ahci_of_match); +static const struct acpi_device_cls ahci_cls = {0x01, 0x06, 0x01}; + static struct platform_driver ahci_driver = { .probe = ahci_probe, .remove = ata_platform_remove_one, .driver = { .name = "ahci", .of_match_table = ahci_of_match, + .acpi_match_cls = &ahci_cls, .pm = &ahci_pm_ops, }, }; -- 2.1.0 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Предлагаю высококачественный кофе от швейцарского производителя
Предлагаем высококачественный кофе от швейцарского производителя http://bit.ly/1xqBJAo -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH] mtd: nand: gpmi: fixup return type of wait_for_completion_timeout
return type of wait_for_completion_timeout is unsigned long not int. The return variable is renamed to reflect its use and the type adjusted to unsigned long. Signed-off-by: Nicholas Mc Guire --- Patch was only compile tested with imx_v6_v7_defconfig (implies CONFIG_MTD_NAND_GPMI_NAND=y) Patch is against 3.19.0-rc7 (localversion-next is -next-20150204) drivers/mtd/nand/gpmi-nand/gpmi-nand.c | 12 ++-- 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c index 33f3c3c..6e44d32 100644 --- a/drivers/mtd/nand/gpmi-nand/gpmi-nand.c +++ b/drivers/mtd/nand/gpmi-nand/gpmi-nand.c @@ -446,7 +446,7 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, struct dma_async_tx_descriptor *desc) { struct completion *dma_c = &this->dma_done; - int err; + unsigned long timeout; init_completion(dma_c); @@ -456,8 +456,8 @@ int start_dma_without_bch_irq(struct gpmi_nand_data *this, dma_async_issue_pending(get_dma_chan(this)); /* Wait for the interrupt from the DMA block. */ - err = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); - if (!err) { + timeout = wait_for_completion_timeout(dma_c, msecs_to_jiffies(1000)); + if (!timeout) { dev_err(this->dev, "DMA timeout, last DMA :%d\n", this->last_dma_type); gpmi_dump_info(this); @@ -477,7 +477,7 @@ int start_dma_with_bch_irq(struct gpmi_nand_data *this, struct dma_async_tx_descriptor *desc) { struct completion *bch_c = &this->bch_done; - int err; + unsigned long timeout; /* Prepare to receive an interrupt from the BCH block. */ init_completion(bch_c); @@ -486,8 +486,8 @@ int start_dma_with_bch_irq(struct gpmi_nand_data *this, start_dma_without_bch_irq(this, desc); /* Wait for the interrupt from the BCH block. */ - err = wait_for_completion_timeout(bch_c, msecs_to_jiffies(1000)); - if (!err) { + timeout = wait_for_completion_timeout(bch_c, msecs_to_jiffies(1000)); + if (!timeout) { dev_err(this->dev, "BCH timeout, last DMA :%d\n", this->last_dma_type); gpmi_dump_info(this); -- 1.7.10.4 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] i2c: cadence: match return type of wait_for_completion_timeout
On Sun, 2015-02-08 at 07:55AM -0500, Nicholas Mc Guire wrote: > return type of wait_for_completion_timeout is unsigned long not int. as > ret is only used for wait_for_completion_timeout anyway the type is simply > changed to unsigned long. > > Signed-off-by: Nicholas Mc Guire Reviewed-by: Sören Brinkmann Sören -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH] sb_edac: Fix detection on SNB machines
On Feb 5, 2015 4:37 AM, "Borislav Petkov" wrote: > > On Thu, Feb 05, 2015 at 12:50:35PM +0100, Borislav Petkov wrote: > > From: Borislav Petkov > > > > Commit 50d1bb93672f ("sb_edac: add support for Haswell based systems") > > broke the driver on my SNB box with PCI ID 0x3ca0: > > > > 3f:0e.0 System peripheral: Intel Corporation Xeon E5/Core i7 Processor Home > > Agent (rev 07) > > 00: 86 80 a0 3c 00 00 00 00 07 00 80 08 00 00 80 00 > > ... > > > > because its probe routine gets handed in pdev->device: 0x3ca0 but we're > > matching for 0x3ca8, i.e. PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA and the > > probing fails. > > Or was it Andy who broke it?! > > From looking at > > d0585cd815fa ("sb_edac: Claim a different PCI device") > > static const struct pci_device_id sbridge_pci_tbl[] = { > - {PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA)}, > + {PCI_DEVICE(PCI_VENDOR_ID_INTEL, > PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0)}, > > Yeah, it looks like it: > > We're working with the IMC_TA device for matching but we get handed in > the IMC_HA0 device after this patch which confirms with my observations. > > tztztz, people, can we decide on one PCI device and stick with it? Can you send your CPU model and the full output of lspci -nn. If there isn't an obvious fix, I'd be okay with reverting, too. The i2c stuff is delayed because the outcome of my investigation is that it has real problems, and it'll probably have to wait until later this year, or a scary module param, to deal with it. --Andy > > :-) > > [ Leaving in the rest for Andy. ] > > > Adding 0x3ca0 fixes the issue and driver loads successfully again: > > > > [ 2449.013120] EDAC DEBUG: sbridge_init: > > [ 2449.017029] EDAC sbridge: Seeking for: PCI ID 8086:3ca0 > > [ 2449.022368] EDAC DEBUG: sbridge_get_onedevice: Detected 8086:3ca0 > > [ 2449.028498] EDAC sbridge: Seeking for: PCI ID 8086:3ca0 > > [ 2449.033768] EDAC sbridge: Seeking for: PCI ID 8086:3ca8 > > [ 2449.039028] EDAC DEBUG: sbridge_get_onedevice: Detected 8086:3ca8 > > [ 2449.045155] EDAC sbridge: Seeking for: PCI ID 8086:3ca8 > > ... > > > > Add a debug printk while at it to be able to catch the failure in the > > future and dump driver version on successful load. > > > > Cc: Tony Luck > > Cc: Aristeu Rozanski > > Cc: Mauro Carvalho Chehab > > Signed-off-by: Borislav Petkov > > --- > > drivers/edac/sb_edac.c | 8 ++-- > > 1 file changed, 6 insertions(+), 2 deletions(-) > > > > diff --git a/drivers/edac/sb_edac.c b/drivers/edac/sb_edac.c > > index 63aa6730e89e..2e1c03a64751 100644 > > --- a/drivers/edac/sb_edac.c > > +++ b/drivers/edac/sb_edac.c > > @@ -2448,6 +2448,7 @@ static int sbridge_probe(struct pci_dev *pdev, const > > struct pci_device_id *id) > > type = IVY_BRIDGE; > > break; > > case PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TA: > > + case PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_HA0: > > rc = sbridge_get_all_devices(&num_mc, > > pci_dev_descr_sbridge_table); > > type = SANDY_BRIDGE; > > break; > > @@ -2460,8 +2461,11 @@ static int sbridge_probe(struct pci_dev *pdev, const > > struct pci_device_id *id) > > type = BROADWELL; > > break; > > } > > - if (unlikely(rc < 0)) > > + if (unlikely(rc < 0)) { > > + edac_dbg(0, "couldn't get all devices for 0x%x\n", > > pdev->device); > > goto fail0; > > + } > > + > > mc = 0; > > > > list_for_each_entry(sbridge_dev, &sbridge_edac_list, list) { > > @@ -2474,7 +2478,7 @@ static int sbridge_probe(struct pci_dev *pdev, const > > struct pci_device_id *id) > > goto fail1; > > } > > > > - sbridge_printk(KERN_INFO, "Driver loaded.\n"); > > + sbridge_printk(KERN_INFO, "%s\n", SBRIDGE_REVISION); > > > > mutex_unlock(&sbridge_edac_lock); > > return 0; > > -- > > 2.2.0.33.gc18b867 > > > > > > -- > Regards/Gruss, > Boris. > > ECO tip #101: Trim your mails when you reply. > -- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/