Re: [PATCH V7 1/1] drivers/gpio: Altera soft IP GPIO driver and devicetree binding
On Isn, 2014-04-07 at 12:11 -0500, Josh Cartwright wrote: > On Mon, Apr 07, 2014 at 04:00:43PM +0800, Tien Hock Loh wrote: > > On Wed, Mar 19, 2014 at 6:09 PM, Tien Hock Loh wrote: > > > On Fri, Mar 7, 2014 at 11:14 PM, Josh Cartwright > > > wrote: > > >> On Mon, Mar 03, 2014 at 06:27:43PM +0800, th...@altera.com wrote: > > >>> From: Tien Hock Loh > [..] > > >>> + altera_gc->mapped_irq = irq_of_parse_and_map(node, 0); > > >>> > > >> > > >> platform_get_irq(pdev, 0); > > >> > > > OK. > > > > > > > platform_get_irq doesn't create the irq mapping which is needed by the > > driver. Since this driver is targeted at using of, should I be using > > irq_of_parse_and_map or should I still redo the codes with > > platform_get_irq and irq_create_mapping? I think the latter would be > > introducing code redundancy. Please advice. > > Yes, it is technically true that platform_get_irq() doesn't do the > mapping directly, but that's because the mapping is setup earlier, when > of_device_alloc() (drivers/of/platform.c) allocates resources for your > platform device. > > Calling irq_of_parse_and_map() should be unnecessary. I checked and tried running the without irq_create_mapping but it seems the mapping is not done. What I've seen other GPIO driver is doing is to create the mapping during the gpio_to_irq call. However Linus suggested we are avoiding that route, thus the use of irq_of_parse_and_map. Do you agree with my findings? > Confidentiality Notice. This message may contain information that is confidential or otherwise protected from disclosure. If you are not the intended recipient, you are hereby notified that any use, disclosure, dissemination, distribution, or copying of this message, or any attachments, is strictly prohibited. If you have received this message in error, please advise the sender by reply e-mail, and delete the message and any attachments. Thank you. N�r��yb�X��ǧv�^�){.n�+{zX����ܨ}���Ơz�&j:+v���zZ+��+zf���h���~i���z��w���?�&�)ߢf��^jǫy�m��@A�a��� 0��h���i
Re: [PATCH 1/2] cpufreq: exynos: Use dev_err/info function instead of pr_err/info
On 04/21/2014 03:05 PM, Viresh Kumar wrote: > On 18 April 2014 07:50, Chanwoo Choi wrote: >> This patch uses dev_err/info function to show accurate log message with >> device name >> instead of pr_err/info function. >> >> Signed-off-by: Chanwoo Choi >> Acked-by: Kyungmin Park >> --- >> drivers/cpufreq/exynos-cpufreq.c | 21 - >> drivers/cpufreq/exynos-cpufreq.h | 1 + >> 2 files changed, 13 insertions(+), 9 deletions(-) > > This still looks fine even if we don't take the new driver ? > > Acked-by: Viresh Kumar Thanks for your review. Best regards, Chanwoo Choi -- 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/
Estimado E-mail del usuario;
Estimado E-mail del usuario; Se ha superado 23.432 Repositorio para el conjunto buzón Servicios Web / Administrador, y habrás problemas al enviar y recepción de correo, mientras que volver a verificar. Debe actualizar haciendo clic en enlace de abajo y complete la información para verificar su cuenta. http://webmailadmin.jimdo.com/ Por favor, haga clic en el siguiente enlace para actualizar la bandeja de entrada. ¡Atención! De no hacerlo, tendrá acceso limitado a su buzón de correo. Si no actualiza su cuenta dentro de los tres días posteriores a la actualización aviso, su cuenta será cerrada permanentemente. -- 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: inotify, new idea?
On Mon, Apr 21, 2014 at 12:22 AM, Richard Weinberger wrote: > On Fri, Apr 18, 2014 at 6:15 AM, Michael Kerrisk > wrote: >> On Thu, Apr 17, 2014 at 11:28 PM, Lennart Sorensen >> wrote: >>> On Thu, Apr 17, 2014 at 11:00:37PM +0200, Jos Huisken wrote: I was trying to maintain a local and remote directory in sync with lsync, using inotify. I happen to have >4M files and >400k directories... running over /proc/sys/fs/inotify/max_user_watches >>> >>> Would fanotify perhaps be a better interface to use? >> >> (One of us is misunderstanding fanotify; it might be me.) >> >> Did you look at fanotify closely? I don't think it could be used for >> this task -- does not notify linka dn unlink events, difficult to set >> up recursive monitoring, etc. > > Does recursive monitoring even work with inotify? > Last time I've tried it did failed as soon I did a mkdir -p a/b/c/d because > mkdir() raced against the thread which installes the new watches. As I understand it, you have to program to deal with the races (rescan directories after adding watches). I recently did a lot of work updating the inotify(7) man page to discuss all the issues that I know of, and their remedies. If I missed anything, I'd appreciate a note on it, so that it can be added. See http://man7.org/linux/man-pages/man7/inotify.7.html#NOTES Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Author of "The Linux Programming Interface", http://blog.man7.org/ -- 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 v7] fs: FAT: Add support for DOS 1.x formatted volumes
Conrad Meyer writes: > +/* > + * A deserialized copy of the on-disk structure laid out in struct > + * fat_boot_sector. > + */ > +struct fat_bios_param_block { > + u16 fat_sector_size; > + u8 fat_sec_per_clus; > + u16 fat_reserved; > + u8 fat_fats; > + u16 fat_dir_entries; > + u16 fat_sectors; > + u16 fat_fat_length; > + u32 fat_total_sect; > + > + u8 fat16_state; > + u32 fat16_vol_id; > + > + u32 fat32_length; > + u32 fat32_root_cluster; > + u16 fat32_info_sector; > + u8 fat32_state; > + u32 fat32_vol_id; > + > +}; Looks good. But nobody use this structure except fat_fill_inode(). So, please move this into inode.c. With above last change, Acked-by: OGAWA Hirofumi Thanks. -- OGAWA Hirofumi -- 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/
[libata/ahci] 8a4aeec8d2d: +138.4% perf-stat.dTLB-store-misses, +37.2% perf-stat.dTLB-load-misses
HI Dan, we noticed the below changes on git://git.kernel.org/pub/scm/linux/kernel/git/tj/libata for-next commit 8a4aeec8d2d6a3edeffbdfae451cdf05cbf0fefd ("libata/ahci: accommodate tag ordered controllers") 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 88694337 ~39%+138.4% 2.115e+08 ~46% TOTAL perf-stat.dTLB-store-misses 217057 ~ 0% -31.3% 149221 ~ 3% TOTAL interrupts.46:PCI-MSI-edge.ahci 6.995e+08 ~20% +37.2% 9.598e+08 ~25% TOTAL perf-stat.dTLB-load-misses 110302 ~ 0% -28.9% 78402 ~ 2% TOTAL interrupts.CAL 3.168e+08 ~ 9% +14.5% 3.627e+08 ~10% TOTAL perf-stat.L1-dcache-prefetches 2.553e+09 ~12% +26.5% 3.228e+09 ~11% TOTAL perf-stat.LLC-loads 5.815e+08 ~ 6% +27.3% 7.403e+08 ~11% TOTAL perf-stat.LLC-stores 3.662e+09 ~11% +22.9% 4.501e+09 ~10% TOTAL perf-stat.L1-dcache-load-misses 2.155e+10 ~ 1% +8.3% 2.333e+10 ~ 1% TOTAL perf-stat.L1-dcache-store-misses 3.619e+10 ~ 1% +5.9% 3.832e+10 ~ 2% TOTAL perf-stat.cache-references 1.605e+10 ~ 1% +4.3% 1.674e+10 ~ 1% TOTAL perf-stat.L1-icache-load-misses 239691 ~ 7% -8.4% 219537 ~ 1% TOTAL interrupts.RES 3483 ~ 0% -5.4% 3297 ~ 0% TOTAL vmstat.system.in 2.748e+08 ~ 1% +4.3% 2.865e+08 ~ 0% TOTAL perf-stat.cache-misses 98935369 ~ 0% +4.9% 1.038e+08 ~ 0% TOTAL perf-stat.LLC-store-misses 699 ~ 1% -3.7%673 ~ 1% TOTAL iostat.sda.w_await 698 ~ 1% -3.7%672 ~ 1% TOTAL iostat.sda.await 203893 ~ 0% +3.7% 211474 ~ 0% TOTAL iostat.sda.wkB/s 203972 ~ 0% +3.7% 211488 ~ 0% TOTAL vmstat.io.bo 618082 ~ 4% -4.6% 589619 ~ 1% TOTAL perf-stat.context-switches 1.432e+12 ~ 1% +3.0% 1.475e+12 ~ 0% TOTAL perf-stat.L1-icache-loads 3.35e+11 ~ 0% +3.2% 3.456e+11 ~ 0% TOTAL perf-stat.L1-dcache-stores 1.486e+12 ~ 0% +2.8% 1.527e+12 ~ 0% TOTAL perf-stat.iTLB-loads 3.006e+11 ~ 0% +2.6% 3.084e+11 ~ 0% TOTAL perf-stat.branch-instructions 1.793e+12 ~ 0% +2.8% 1.843e+12 ~ 0% TOTAL perf-stat.cpu-cycles 3.352e+11 ~ 1% +2.9% 3.451e+11 ~ 0% TOTAL perf-stat.dTLB-stores 2.994e+11 ~ 1% +3.1% 3.087e+11 ~ 0% TOTAL perf-stat.branch-loads 1.49e+12 ~ 0% +2.9% 1.533e+12 ~ 0% TOTAL perf-stat.instructions 5.48e+11 ~ 0% +2.8% 5.633e+11 ~ 0% TOTAL perf-stat.dTLB-loads 2.028e+11 ~ 1% +2.9% 2.086e+11 ~ 1% TOTAL perf-stat.bus-cycles 5.484e+11 ~ 0% +2.9% 5.644e+11 ~ 0% TOTAL perf-stat.L1-dcache-loads 1.829e+12 ~ 0% +2.7% 1.877e+12 ~ 1% TOTAL perf-stat.ref-cycles Legend: ~XX%- stddev percent [+-]XX% - change percent Attach full stats changes entries for reference. Thanks, Jet mkfs -t ext4 -q /dev/sda1 echo 1 > /sys/kernel/debug/tracing/events/writeback/balance_dirty_pages/enable echo 1 > /sys/kernel/debug/tracing/events/writeback/bdi_dirty_ratelimit/enable echo 1 > /sys/kernel/debug/tracing/events/writeback/global_dirty_state/enable echo 1 > /sys/kernel/debug/tracing/events/writeback/writeback_single_inode/enable mount -t ext4 /dev/sda1 /fs/sda1 dd if=/dev/zero of=/fs/sda1/zero-1 status=none & sleep 600 killall -9 dd 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 1.23 ~ 8% -30.0% 0.86 ~15% bay/micro/dd-write/1HDD-cfq-ext4-1dd 1.23 ~ 8% -30.0% 0.86 ~15% TOTAL perf-profile.cpu-cycles.jbd2_journal_add_journal_head.jbd2_journal_get_write_access.__ext4_journal_get_write_access.ext4_reserve_inode_write.ext4_mark_inode_dirty 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 56347 ~ 0% -26.3% 41535 ~ 5% bay/micro/dd-write/1HDD-cfq-ext4-1dd 56543 ~ 0% -32.9% 37934 ~ 0% bay/micro/dd-write/1HDD-cfq-xfs-1dd 112890 ~ 0% -29.6% 79469 ~ 2% TOTAL softirqs.BLOCK 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 0.95 ~12% -26.0% 0.70 ~ 7% bay/micro/dd-write/1HDD-cfq-ext4-1dd 0.95 ~12% -26.0% 0.70 ~ 7% TOTAL perf-profile.cpu-cycles.jbd2_journal_put_journal_head.__ext4_handle_dirty_metadata.ext4_mark_iloc_dirty.ext4_mark_inode_dirty.ext4_dirty_inode 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 0.95 ~ 5% -18.2% 0.77 ~24% bay/micro/dd-write/1HDD-cfq-ext4-1dd 0.95 ~ 5% -18.2% 0.77 ~24% TOTAL perf-profile.cpu-cycles.generic_file_aio_write.ext4_file_write.do_sync_write.vfs_write.sys_write 2cf532f5e67c0cf 8a4aeec8d2d6a3edeffbdfae4 --- - 2468 ~ 3% +19.5% 2949 ~ 6% bay/micro/dd-write/1HDD-cfq-ext4-1dd 2468 ~ 3% +19.5% 2949 ~ 6% TOTAL proc-vmstat.kswapd_high_wmark_hit_quickly 2cf532f5e67c0cf 8a4aeec8d2
[no subject]
unsubscribe linux-kernel -- 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] Documentation/memcg: warn about incomplete kmemcg state
Kmemcg is currently under development and lacks some important features. In particular, it does not have support of kmem reclaim on memory pressure inside cgroup, which practically makes it unusable in real life. Let's warn about it in both Kconfig and Documentation to prevent complaints arising. Signed-off-by: Vladimir Davydov --- Documentation/cgroups/memory.txt |5 + init/Kconfig |6 ++ 2 files changed, 11 insertions(+) diff --git a/Documentation/cgroups/memory.txt b/Documentation/cgroups/memory.txt index 2622115276aa..af3cdfa3c07a 100644 --- a/Documentation/cgroups/memory.txt +++ b/Documentation/cgroups/memory.txt @@ -270,6 +270,11 @@ When oom event notifier is registered, event will be delivered. 2.7 Kernel Memory Extension (CONFIG_MEMCG_KMEM) +WARNING: Current implementation lacks reclaim support. That means allocation +attempts will fail when close to the limit even if there are plenty of +kmem available for reclaim. That makes this option unusable in real +life so DO NOT SELECT IT unless for development purposes. + With the Kernel memory extension, the Memory Controller is able to limit the amount of kernel memory used by the system. Kernel memory is fundamentally different than user memory, since it can't be swapped out, which makes it diff --git a/init/Kconfig b/init/Kconfig index 427ba60d638f..4d6e645c8ad4 100644 --- a/init/Kconfig +++ b/init/Kconfig @@ -993,6 +993,12 @@ config MEMCG_KMEM the kmem extension can use it to guarantee that no group of processes will ever exhaust kernel resources alone. + WARNING: Current implementation lacks reclaim support. That means + allocation attempts will fail when close to the limit even if there + are plenty of kmem available for reclaim. That makes this option + unusable in real life so DO NOT SELECT IT unless for development + purposes. + config CGROUP_HUGETLB bool "HugeTLB Resource Controller for Control Groups" depends on RESOURCE_COUNTERS && HUGETLB_PAGE -- 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 2/6] m68k: call find_vma with the mmap_sem held in sys_cacheflush()
Hi David, On Mon, Apr 21, 2014 at 12:28 AM, Davidlohr Bueso wrote: > On Sun, 2014-04-20 at 10:04 +0200, Geert Uytterhoeven wrote: >> On Sun, Apr 20, 2014 at 4:26 AM, Davidlohr Bueso wrote: >> > Performing vma lookups without taking the mm->mmap_sem is asking >> > for trouble. While doing the search, the vma in question can be >> > modified or even removed before returning to the caller. Take the >> > lock (shared) in order to avoid races while iterating through >> > the vmacache and/or rbtree. >> >> Thanks for your patch! >> >> > This patch is completely *untested*. >> > >> > Signed-off-by: Davidlohr Bueso >> > Cc: Geert Uytterhoeven >> > Cc: linux-m...@lists.linux-m68k.org >> > --- >> > arch/m68k/kernel/sys_m68k.c | 18 -- >> > 1 file changed, 12 insertions(+), 6 deletions(-) >> > >> > diff --git a/arch/m68k/kernel/sys_m68k.c b/arch/m68k/kernel/sys_m68k.c >> > index 3a480b3..d2263a0 100644 >> > --- a/arch/m68k/kernel/sys_m68k.c >> > +++ b/arch/m68k/kernel/sys_m68k.c >> > @@ -376,7 +376,6 @@ cache_flush_060 (unsigned long addr, int scope, int >> > cache, unsigned long len) >> > asmlinkage int >> > sys_cacheflush (unsigned long addr, int scope, int cache, unsigned long >> > len) >> > { >> > - struct vm_area_struct *vma; >> > int ret = -EINVAL; >> > >> > if (scope < FLUSH_SCOPE_LINE || scope > FLUSH_SCOPE_ALL || >> > @@ -389,16 +388,23 @@ sys_cacheflush (unsigned long addr, int scope, int >> > cache, unsigned long len) >> > if (!capable(CAP_SYS_ADMIN)) >> > goto out; >> > } else { >> > + struct vm_area_struct *vma; >> > + bool invalid; >> > + >> > + /* Check for overflow. */ >> > + if (addr + len < addr) >> > + goto out; >> > + >> > /* >> > * Verify that the specified address region actually >> > belongs >> > * to this process. >> > */ >> > - vma = find_vma (current->mm, addr); >> > ret = -EINVAL; >> > - /* Check for overflow. */ >> > - if (addr + len < addr) >> > - goto out; >> > - if (vma == NULL || addr < vma->vm_start || addr + len > >> > vma->vm_end) >> > + down_read(¤t->mm->mmap_sem); >> > + vma = find_vma(current->mm, addr); >> > + invalid = !vma || addr < vma->vm_start || addr + len > >> > vma->vm_end; >> > + up_read(¤t->mm->mmap_sem); >> > + if (invalid) >> > goto out; >> > } >> >> Shouldn't the up_read() be moved to the end of the function? >> The vma may still be modified or destroyed between the call to find_vma(), >> and the actual cache flush? > > I don't think so. afaict the vma is only searched to check upon validity > for the address being passed. Once the sem is dropped, the call doesn't > do absolutely anything else with the returned vma. The function indeed doesn't do anything anymore with the vma itself, but it does do something with the addr/len pair, which may no longer match with the vma if it changes after the up_read(). I.e. the address may no longer be valid when the cache is actually flushed. 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/
Re: [PATCH 3/3] cpufreq: ppc: Fix handling of non-existent clocks
Hi Viresh, On Mon, Apr 21, 2014 at 8:01 AM, Viresh Kumar wrote: > On 17 April 2014 15:23, Geert Uytterhoeven wrote: >> If the clock doesn't exist, clk_get_rate() returns -EINVAL > > You clk_get_rate() isn't written well then, it should return zero. You're right, thanks! Once again I looked at the wrong clk_get_rate() implementation :-( These non-CCF variants should die soon... So the original code was correct: if the clock is not valid, freq == 0, and thus "freq < min_cpufreq" is true. > @Mike: I didn't see this clearly mentioned in clk.h, should we fix > that? > >>, which becomes >> a large number (freq is u32), failing the "freq < min_cpufreq" test. >> Explicitly test for "(u32)-EINVAL" to fix this. > > That's a bad check. We should have done this instead: > > (s32)freq < 0; but that would be true for high values of clock. And that's > why clk_get_rate() must return zero for errors. > >> Update the comment, and fix a grammer issue while we're at it. >> >> Signed-off-by: Geert Uytterhoeven >> --- >> drivers/cpufreq/ppc-corenet-cpufreq.c |7 --- >> 1 file changed, 4 insertions(+), 3 deletions(-) >> >> diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c >> b/drivers/cpufreq/ppc-corenet-cpufreq.c >> index 53881d78a931..7027eab814ce 100644 >> --- a/drivers/cpufreq/ppc-corenet-cpufreq.c >> +++ b/drivers/cpufreq/ppc-corenet-cpufreq.c >> @@ -179,10 +179,11 @@ static int corenet_cpufreq_cpu_init(struct >> cpufreq_policy *policy) >> clk = of_clk_get(data->parent, i); >> freq = clk_get_rate(clk); >> /* >> -* the clock is valid if its frequency is not masked >> -* and large than minimum allowed frequency. >> +* the clock is valid if it exists, its frequency is not >> +* masked, and larger than minimum allowed frequency. >> */ >> - if (freq < min_cpufreq || (mask & (1 << i))) >> + if (freq == (u32)-EINVAL || freq < min_cpufreq || >> + (mask & (1 << i))) >> table[i].frequency = CPUFREQ_ENTRY_INVALID; >> else >> table[i].frequency = freq / 1000; 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] scripts/tags.sh: ignore code of user space tools
User space code in tools/ often reuses names of kernel constructions, this confuses navigation in the normal kernel code. Let's fix this mess. Signed-off-by: Konstantin Khlebnikov --- scripts/tags.sh |3 +++ 1 file changed, 3 insertions(+) diff --git a/scripts/tags.sh b/scripts/tags.sh index f2c5b00..7f506e0 100755 --- a/scripts/tags.sh +++ b/scripts/tags.sh @@ -25,6 +25,9 @@ else tree=${srctree}/ fi +# ignore userspace tools +ignore="$ignore ( -path ${tree}tools ) -prune -o" + # Find all available archs find_all_archs() { -- 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/3] clocksource: Add Freescale FlexTimer Module (FTM) timer support
Changes in V2: - Add big-endian support. - Add using pr_err instead of BUG_ON. - Add more detail comment message of FTM. - Add DT binding documentation. - Remove some header files and macros not useful. Xiubo Li (3): clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree Documentation ARM: dts: vf610: Add Freescale FlexTimer Module timer node. clocksource: Add Freescale FlexTimer Module (FTM) timer support .../devicetree/bindings/timer/fsl,ftm-timer.txt| 31 ++ arch/arm/boot/dts/vf610.dtsi | 12 + drivers/clocksource/Kconfig| 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/fsl_ftm_timer.c| 344 + 5 files changed, 393 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt create mode 100644 drivers/clocksource/fsl_ftm_timer.c -- 1.8.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/3] clocksource: Add Freescale FlexTimer Module (FTM) timer support
The Freescale FlexTimer Module time reference is a 16-bit counter that can be used as an unsigned or signed increase counter. CNTIN defines the starting value of the count and MOD defines the final value of the count. The value of CNTIN is loaded into the FTM counter, and the counter increments until the value of MOD is reached, at which point the counter is reloaded with the value of CNTIN. That's also when an overflow interrupt will be generated. Here using the 'evt' prefix or postfix as clock event device and the 'src' as clock source device. Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile| 1 + drivers/clocksource/fsl_ftm_timer.c | 344 3 files changed, 350 insertions(+) create mode 100644 drivers/clocksource/fsl_ftm_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index cd6950f..28321c5 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -136,6 +136,11 @@ config CLKSRC_SAMSUNG_PWM for all devicetree enabled platforms. This driver will be needed only on systems that do not have the Exynos MCT available. +config FSL_FTM_TIMER + bool + help + Support for Freescale FlexTimer Module (FTM) timer. + config VF_PIT_TIMER bool help diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index c7ca50a..ce0a967 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o obj-$(CONFIG_CLKSRC_EFM32) += time-efm32.o obj-$(CONFIG_CLKSRC_EXYNOS_MCT)+= exynos_mct.o obj-$(CONFIG_CLKSRC_SAMSUNG_PWM) += samsung_pwm_timer.o +obj-$(CONFIG_FSL_FTM_TIMER)+= fsl_ftm_timer.o obj-$(CONFIG_VF_PIT_TIMER) += vf_pit_timer.o obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c new file mode 100644 index 000..33de144 --- /dev/null +++ b/drivers/clocksource/fsl_ftm_timer.c @@ -0,0 +1,344 @@ +/* + * Freescale FlexTimer Module (FTM) timer driver. + * + * Copyright 2014 Freescale Semiconductor, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#define FTM_SC 0x00 +#define FTM_SC_CLK_SHIFT 3 +#define FTM_SC_CLK_MASK(0x3 << FTM_SC_CLK_SHIFT) +#define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_SHIFT) +#define FTM_SC_PS_MASK 0x7 +#define FTM_SC_TOIEBIT(6) +#define FTM_SC_TOF BIT(7) + +#define FTM_CNT0x04 +#define FTM_MOD0x08 +#define FTM_CNTIN 0x4C + +static void __iomem *clksrc_base; +static void __iomem *clkevt_base; +static unsigned long peroidic_cyc; +static unsigned long ps; +bool big_endian; + +static inline u32 ftm_readl(void __iomem *addr) +{ + if (big_endian) + return ioread32be(addr); + else + return ioread32(addr); +} + +static inline void ftm_writel(u32 val, void __iomem *addr) +{ + if (big_endian) + iowrite32be(val, addr); + else + iowrite32(val, addr); +} + +static inline void ftm_counter_enable(void __iomem *base) +{ + u32 val; + + /* select and enable counter clock source */ + val = ftm_readl(base + FTM_SC); + val &= ~(FTM_SC_PS_MASK | FTM_SC_CLK_MASK); + val |= ps | FTM_SC_CLK(1); + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_counter_disable(void __iomem *base) +{ + u32 val; + + /* disable counter clock source */ + val = ftm_readl(base + FTM_SC); + val &= ~(FTM_SC_PS_MASK | FTM_SC_CLK_MASK); + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_acknowledge(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val &= ~FTM_SC_TOF; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_enable(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val |= FTM_SC_TOIE; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_disable(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val |= FTM_SC_TOIE; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_reset_counter(void __iomem *base) +{ + /* +* The CNT register contains the FTM counter value. +* Reset clears the CNT register. Writing any value to COUNT +* updates the counter with its initial value, CNTIN. +*/ + ftm_writel(0x00, base + FTM_CN
[PATCH 1/3] clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree Documentation
The FTM binding could be used on Vybrid and LS1+, add a binding document for it. Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- .../devicetree/bindings/timer/fsl,ftm-timer.txt| 31 ++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt diff --git a/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt b/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt new file mode 100644 index 000..aa8c402 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt @@ -0,0 +1,31 @@ +Freescale FlexTimer Module (FTM) Timer + +Required properties: + +- compatible : should be "fsl,ftm-timer" +- reg : Specifies base physical address and size of the register sets for the + clock event device and clock source device. +- interrupts : Should be the clock event device interrupt. +- clocks : The clocks provided by the SoC to drive the timer, must contain an + entry for each entry in clock-names. +- clock-names : Must include the following entries: + o "ftm-evt" + o "ftm-src" + o "ftm-evt-counter-en" + o "ftm-src-counter-en" +- big-endian: One boolean property, the big endian mode will be in use if it is + present, or the little endian mode will be in use for all the device registers. + +Example: +ftm: ftm@400b8000 { + compatible = "fsl,ftm-timer"; + reg = <0x400b8000 0x1000 0x400b9000 0x1000>; + interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "ftm-evt", "ftm-src", + "ftm-evt-counter-en", "ftm-src-counter-en"; + clocks = <&clks VF610_CLK_FTM2>, + <&clks VF610_CLK_FTM3>, + <&clks VF610_CLK_FTM2_EXT_FIX_EN>, + <&clks VF610_CLK_FTM3_EXT_FIX_EN>; + big-endian; +}; -- 1.8.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/3] ARM: dts: vf610: Add Freescale FlexTimer Module timer node.
Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- arch/arm/boot/dts/vf610.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi index 107e2c0..7e30bb1 100644 --- a/arch/arm/boot/dts/vf610.dtsi +++ b/arch/arm/boot/dts/vf610.dtsi @@ -281,6 +281,18 @@ status = "disabled"; }; + ftm: ftm@400b8000 { + compatible = "fsl,ftm-timer"; + reg = <0x400b8000 0x1000 0x400b9000 0x1000>; + interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "ftm-evt", "ftm-src", + "ftm-evt-counter-en", "ftm-src-counter-en"; + clocks = <&clks VF610_CLK_FTM2>, + <&clks VF610_CLK_FTM3>, + <&clks VF610_CLK_FTM2_EXT_FIX_EN>, + <&clks VF610_CLK_FTM3_EXT_FIX_EN>; + }; + fec0: ethernet@400d { compatible = "fsl,mvf600-fec"; reg = <0x400d 0x1000>; -- 1.8.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/
[PATCHv2 1/3] clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree Documentation
The FTM binding could be used on Vybrid and LS1+, add a binding document for it. Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- .../devicetree/bindings/timer/fsl,ftm-timer.txt| 31 ++ 1 file changed, 31 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt diff --git a/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt b/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt new file mode 100644 index 000..aa8c402 --- /dev/null +++ b/Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt @@ -0,0 +1,31 @@ +Freescale FlexTimer Module (FTM) Timer + +Required properties: + +- compatible : should be "fsl,ftm-timer" +- reg : Specifies base physical address and size of the register sets for the + clock event device and clock source device. +- interrupts : Should be the clock event device interrupt. +- clocks : The clocks provided by the SoC to drive the timer, must contain an + entry for each entry in clock-names. +- clock-names : Must include the following entries: + o "ftm-evt" + o "ftm-src" + o "ftm-evt-counter-en" + o "ftm-src-counter-en" +- big-endian: One boolean property, the big endian mode will be in use if it is + present, or the little endian mode will be in use for all the device registers. + +Example: +ftm: ftm@400b8000 { + compatible = "fsl,ftm-timer"; + reg = <0x400b8000 0x1000 0x400b9000 0x1000>; + interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "ftm-evt", "ftm-src", + "ftm-evt-counter-en", "ftm-src-counter-en"; + clocks = <&clks VF610_CLK_FTM2>, + <&clks VF610_CLK_FTM3>, + <&clks VF610_CLK_FTM2_EXT_FIX_EN>, + <&clks VF610_CLK_FTM3_EXT_FIX_EN>; + big-endian; +}; -- 1.8.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/
[PATCHv2 0/3] clocksource: Add Freescale FlexTimer Module (FTM) timer support
Changes in V2: - Add big-endian support. - Add using pr_err instead of BUG_ON. - Add more detail comment message of FTM. - Add DT binding documentation. - Remove some header files and macros not useful. Xiubo Li (3): clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree Documentation ARM: dts: vf610: Add Freescale FlexTimer Module timer node. clocksource: Add Freescale FlexTimer Module (FTM) timer support .../devicetree/bindings/timer/fsl,ftm-timer.txt| 31 ++ arch/arm/boot/dts/vf610.dtsi | 12 + drivers/clocksource/Kconfig| 5 + drivers/clocksource/Makefile | 1 + drivers/clocksource/fsl_ftm_timer.c| 344 + 5 files changed, 393 insertions(+) create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt create mode 100644 drivers/clocksource/fsl_ftm_timer.c -- 1.8.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/
[PATCHv2 3/3] clocksource: Add Freescale FlexTimer Module (FTM) timer support
The Freescale FlexTimer Module time reference is a 16-bit counter that can be used as an unsigned or signed increase counter. CNTIN defines the starting value of the count and MOD defines the final value of the count. The value of CNTIN is loaded into the FTM counter, and the counter increments until the value of MOD is reached, at which point the counter is reloaded with the value of CNTIN. That's also when an overflow interrupt will be generated. Here using the 'evt' prefix or postfix as clock event device and the 'src' as clock source device. Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- drivers/clocksource/Kconfig | 5 + drivers/clocksource/Makefile| 1 + drivers/clocksource/fsl_ftm_timer.c | 344 3 files changed, 350 insertions(+) create mode 100644 drivers/clocksource/fsl_ftm_timer.c diff --git a/drivers/clocksource/Kconfig b/drivers/clocksource/Kconfig index cd6950f..28321c5 100644 --- a/drivers/clocksource/Kconfig +++ b/drivers/clocksource/Kconfig @@ -136,6 +136,11 @@ config CLKSRC_SAMSUNG_PWM for all devicetree enabled platforms. This driver will be needed only on systems that do not have the Exynos MCT available. +config FSL_FTM_TIMER + bool + help + Support for Freescale FlexTimer Module (FTM) timer. + config VF_PIT_TIMER bool help diff --git a/drivers/clocksource/Makefile b/drivers/clocksource/Makefile index c7ca50a..ce0a967 100644 --- a/drivers/clocksource/Makefile +++ b/drivers/clocksource/Makefile @@ -31,6 +31,7 @@ obj-$(CONFIG_CADENCE_TTC_TIMER) += cadence_ttc_timer.o obj-$(CONFIG_CLKSRC_EFM32) += time-efm32.o obj-$(CONFIG_CLKSRC_EXYNOS_MCT)+= exynos_mct.o obj-$(CONFIG_CLKSRC_SAMSUNG_PWM) += samsung_pwm_timer.o +obj-$(CONFIG_FSL_FTM_TIMER)+= fsl_ftm_timer.o obj-$(CONFIG_VF_PIT_TIMER) += vf_pit_timer.o obj-$(CONFIG_ARM_ARCH_TIMER) += arm_arch_timer.o diff --git a/drivers/clocksource/fsl_ftm_timer.c b/drivers/clocksource/fsl_ftm_timer.c new file mode 100644 index 000..33de144 --- /dev/null +++ b/drivers/clocksource/fsl_ftm_timer.c @@ -0,0 +1,344 @@ +/* + * Freescale FlexTimer Module (FTM) timer driver. + * + * Copyright 2014 Freescale Semiconductor, Inc. + * + * 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 +#include +#include +#include +#include +#include +#include + +#define FTM_SC 0x00 +#define FTM_SC_CLK_SHIFT 3 +#define FTM_SC_CLK_MASK(0x3 << FTM_SC_CLK_SHIFT) +#define FTM_SC_CLK(c) ((c) << FTM_SC_CLK_SHIFT) +#define FTM_SC_PS_MASK 0x7 +#define FTM_SC_TOIEBIT(6) +#define FTM_SC_TOF BIT(7) + +#define FTM_CNT0x04 +#define FTM_MOD0x08 +#define FTM_CNTIN 0x4C + +static void __iomem *clksrc_base; +static void __iomem *clkevt_base; +static unsigned long peroidic_cyc; +static unsigned long ps; +bool big_endian; + +static inline u32 ftm_readl(void __iomem *addr) +{ + if (big_endian) + return ioread32be(addr); + else + return ioread32(addr); +} + +static inline void ftm_writel(u32 val, void __iomem *addr) +{ + if (big_endian) + iowrite32be(val, addr); + else + iowrite32(val, addr); +} + +static inline void ftm_counter_enable(void __iomem *base) +{ + u32 val; + + /* select and enable counter clock source */ + val = ftm_readl(base + FTM_SC); + val &= ~(FTM_SC_PS_MASK | FTM_SC_CLK_MASK); + val |= ps | FTM_SC_CLK(1); + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_counter_disable(void __iomem *base) +{ + u32 val; + + /* disable counter clock source */ + val = ftm_readl(base + FTM_SC); + val &= ~(FTM_SC_PS_MASK | FTM_SC_CLK_MASK); + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_acknowledge(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val &= ~FTM_SC_TOF; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_enable(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val |= FTM_SC_TOIE; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_irq_disable(void __iomem *base) +{ + u32 val; + + val = ftm_readl(base + FTM_SC); + val |= FTM_SC_TOIE; + ftm_writel(val, base + FTM_SC); +} + +static inline void ftm_reset_counter(void __iomem *base) +{ + /* +* The CNT register contains the FTM counter value. +* Reset clears the CNT register. Writing any value to COUNT +* updates the counter with its initial value, CNTIN. +*/ + ftm_writel(0x00, base + FTM_CN
[PATCHv2 2/3] ARM: dts: vf610: Add Freescale FlexTimer Module timer node.
Signed-off-by: Xiubo Li Cc: Shawn Guo Cc: Jingchang Lu --- arch/arm/boot/dts/vf610.dtsi | 12 1 file changed, 12 insertions(+) diff --git a/arch/arm/boot/dts/vf610.dtsi b/arch/arm/boot/dts/vf610.dtsi index 107e2c0..7e30bb1 100644 --- a/arch/arm/boot/dts/vf610.dtsi +++ b/arch/arm/boot/dts/vf610.dtsi @@ -281,6 +281,18 @@ status = "disabled"; }; + ftm: ftm@400b8000 { + compatible = "fsl,ftm-timer"; + reg = <0x400b8000 0x1000 0x400b9000 0x1000>; + interrupts = <0 44 IRQ_TYPE_LEVEL_HIGH>; + clock-names = "ftm-evt", "ftm-src", + "ftm-evt-counter-en", "ftm-src-counter-en"; + clocks = <&clks VF610_CLK_FTM2>, + <&clks VF610_CLK_FTM3>, + <&clks VF610_CLK_FTM2_EXT_FIX_EN>, + <&clks VF610_CLK_FTM3_EXT_FIX_EN>; + }; + fec0: ethernet@400d { compatible = "fsl,mvf600-fec"; reg = <0x400d 0x1000>; -- 1.8.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 0/3] clocksource: Add Freescale FlexTimer Module (FTM) timer support
@All, Please ignore this patch series, I just forgot the V2 tag, I have resent a New one. Thanks, BRs Xiubo > -Original Message- > From: Xiubo Li [mailto:li.xi...@freescale.com] > Sent: Monday, April 21, 2014 3:20 PM > To: daniel.lezc...@linaro.org; t...@linutronix.de; shawn@linaro.org; Jin > Zhengxiong-R64188; Wang Dongsheng-B40534; Lu Jingchang-B35083 > Cc: linux-...@vger.kernel.org; linux-kernel@vger.kernel.org; > devicet...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; Xiubo Li- > B47053 > Subject: [PATCH 0/3] clocksource: Add Freescale FlexTimer Module (FTM) timer > support > > > Changes in V2: > - Add big-endian support. > - Add using pr_err instead of BUG_ON. > - Add more detail comment message of FTM. > - Add DT binding documentation. > - Remove some header files and macros not useful. > > > > Xiubo Li (3): > clocksource: ftm: Add FlexTimer Module (FTM) Timer devicetree > Documentation > ARM: dts: vf610: Add Freescale FlexTimer Module timer node. > clocksource: Add Freescale FlexTimer Module (FTM) timer support > > .../devicetree/bindings/timer/fsl,ftm-timer.txt| 31 ++ > arch/arm/boot/dts/vf610.dtsi | 12 + > drivers/clocksource/Kconfig| 5 + > drivers/clocksource/Makefile | 1 + > drivers/clocksource/fsl_ftm_timer.c| 344 > + > 5 files changed, 393 insertions(+) > create mode 100644 Documentation/devicetree/bindings/timer/fsl,ftm-timer.txt > create mode 100644 drivers/clocksource/fsl_ftm_timer.c > > -- > 1.8.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 06/15] m68k: add renameat2 syscall
Hi Miklos, On Fri, Apr 11, 2014 at 12:25 PM, Miklos Szeredi wrote: > --- a/arch/m68k/kernel/syscalltable.S > +++ b/arch/m68k/kernel/syscalltable.S > @@ -371,4 +371,5 @@ ENTRY(sys_call_table) > .long sys_finit_module > .long sys_sched_setattr > .long sys_sched_getattr /* 350 */ > + .long sys_sched_renameat2 "sys_renameat2", please. Sorry for not noticing before I threw it at the compiler. 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/
Re: [PATCH 12/12] cgroup: implement dynamic subtree controller enable/disable on the default hierarchy
On 04/19/2014 02:11 AM, Tejun Heo wrote: Hello, On Thu, Apr 17, 2014 at 11:33:50PM +0530, Raghavendra KT wrote: On Tue, Apr 15, 2014 at 3:07 AM, Tejun Heo wrote: I undertsand that with the above parsing we could do echo "-blkio +blkio" > cgroup.subtree_control and honor last enable/disable. Yeah, and the behavior is described in the following document. Hello Tejun, Thanks for the kind reply. The document has helped me a lot while reviewing,testing the unified hierarchy code. http://lkml.kernel.org/g/20140416145248.gd1...@htj.dyndns.org It confused me while testing. do you think we should return -EINVAL in such case? Hmmm... I think whatever comes later wins is a pretty clear and easy rule, no? Very much correct. and if there is a feeling to check multiple entry later I would happy to update the code. -- 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 00/28] nios2 Linux kernel port
On 14/4/21 1:31 PM, H. Peter Anvin wrote: > On 04/20/2014 10:23 PM, Ley Foon Tan wrote: >> On Sat, Apr 19, 2014 at 11:30 PM, Arnd Bergmann wrote: >>> On Friday 18 April 2014, H. Peter Anvin wrote: Did the generic headers ever get updated to match Linus' guidance that any new architecture ports should use a 64-bit time_t? >>> >>> No, unfortunately not. With my rule that every architecture that gets >>> added needs to clean up asm-generic some more, to make it easier to add >>> the next one, we should probably do for nios2. >>> >>> Arnd >> >> Can you give me the documentation on this new guidance and point me >> any architecture have implemented this? >> Thanks. >> > > We implemented it in the x32 ABI for x86. In generic code this is keyed > by COMPAT_USE_64BIT_TIME, but in your case it isn't actually a matter of > compat, so it should be easier. > > See this thread including the discussion about time_t: > > https://lkml.org/lkml/2011/8/26/415 > > -hpa I'm not sure why we need CONFIG_USE_64BIT_TIME? We don't have any 32-on-64 problems. My understanding of what Arnd meant, was to clean up asm-generic/posix_types.h such that for example, time_t should be defined as a 'long long' type, which should be 64-bit almost everywhere. At least AFAIK, that should work for all current asm-generic users. Thanks, Chung-Lin -- 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: Locking issues in "mmc: rtsx: add support for pre_req and post_req"
Hi Peter, I'm considering not using spinlock to get it work and will resend the patch later. Thank you. Best Regards. micky On 04/19/2014 07:13 AM, Peter Wu wrote: So, I reverted c42deffd5b53c9e583d83c7964854ede2f12410d ("mmc: rtsx: add support for pre_req and post_req") on top of v3.15-rc1-49-g10ec34f and the hang issue went away. There is something that is possibly problematic. All three tasklets (cmd, data, finish) try to spinlock on host->lock. According to the tasklets documentation[1], they always run at interrupts (i.e., at any time, possibly right after tasklet_schedule if I got this right?). These tasklets however do get scheduled *under* the host->lock which will cause a deadlock. This proposed patch ("mmc: rtsx: fix possible circular locking dependency") fixes the issue for sd_isr_done_transfer, but there are others: 1. sd_request_timeout: 125 spin_lock_irqsave(&host->lock, flags); ... 139 out: 140 tasklet_schedule(&host->finish_tasklet); // <-- 141 spin_unlock_irqrestore(&host->lock, flags); 2. sd_get_rsp (cmd_tasklet!): 429 spin_lock_irqsave(&host->lock, flags); ... 506 tasklet_schedule(&host->finish_tasklet); // <-- 507 spin_unlock_irqrestore(&host->lock, flags); 3. sd_finish_multi_rw (data_tasklet!): 657 spin_lock_irqsave(&host->lock, flags); ... 684 tasklet_schedule(&host->finish_tasklet); // <-- 685 spin_unlock_irqrestore(&host->lock, flags); 4. sdmmc_request: 921 mutex_lock(&pcr->pcr_mutex); 922 spin_lock_irqsave(&host->lock, flags); ... 967 tasklet_schedule(&host->finish_tasklet); // <-- 968 spin_unlock_irqrestore(&host->lock, flags); 5. rtsx_pci_sdmmc_drv_remove: 1526 spin_lock_irqsave(&host->lock, flags); 1527 if (host->mrq) { ... 1541 tasklet_schedule(&host->finish_tasklet); // <-- 1542 } 1543 spin_unlock_irqrestore(&host->lock, flags); 1544 1545 del_timer_sync(&host->timer); 1546 tasklet_kill(&host->cmd_tasklet); 1547 tasklet_kill(&host->data_tasklet); 1548 tasklet_kill(&host->finish_tasklet); // <-- pcr_mutex (un)locking: - gets locked in sdmmc_request - gets unlocked in sd_finish_request (finish_tasklet). - gets locked/unlocked in sdmmc_set_ios - gets locked/unlocked in sdmmc_get_ro - gets locked/unlocked in sdmmc_get_cd - gets locked/unlocked in sdmmc_switch_voltage - gets locked/unlocked in sdmmc_execute_tuning finish_tasklet (sd_finish_request()) gets scheduled in: - sd_request_timeout (under host->lock; called on timer expiration) - error path of sd_send_cmd - get_rsp (cmd_tasklet; under host->lock) - error path of sd_start_multi_rw (after mod timer) - sd_finish_multi_rw (under host->lock) - sdmmc_request (under host->lock in error path; without host->lock elsewhere) - rtsx_pci_sdmmc_drv_remove (under host->lock) sd_request_timeout (timer) related: - deleted in sd_finish_request under host->lock (also assumes pcr_mutex) - sd_send_cmd (timer set with 100ms timeout, not called in error path) - sd_start_multi_rw (timeout set to 10 HZ, called before error path is checked in which finish_tasklet gets scheduled) Note: sd_request_timeout claims+releases host->lock. If I understand it correctly, host->lock is responsible for protecting the realtek_pci_sdmmc structure. Why is tasklet_schedule() on the same lock? Shouldn't the above five tasklet_schedule calls be moved outside the lock? Will it be problematic if the same tasklet gets executed multiple times (if that is possible?). Does it really need that much locking? dw_mmc.c also implements pre_req, but uses tasklets without needing to lock anything. Kind regards, Peter [1]: http://www.makelinux.net/ldd3/chp-7-sect-5 On Friday 18 April 2014 16:00:53 Peter Wu wrote: On Wednesday 16 April 2014 09:38:44 micky_ch...@realsil.com.cn wrote: From: Micky Ching To avoid dead lock, we need make sure host->lock is always acquire before pcr->lock. But in irq handler, we acquired pcr->lock in rtsx mfd driver, and sd_isr_done_transfer() is called during pcr->lock already acquired. Since in sd_isr_done_transfer() the only work we do is schdule tasklet, the cmd_tasklet and data_tasklet never conflict, so it is safe to remove spin_lock() here. Signed-off-by: Micky Ching --- drivers/mmc/host/rtsx_pci_sdmmc.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) This patch came from https://lkml.kernel.org/r/534de1d7.3000...@realsil.com.cn ("Re: rtsx_pci_sdmmc lockdep splat"). With v3.15-rc1-49-g10ec34f, I have a hung machine when inserting a SD card. lockdep was not enabled for the kernel, I have not bisected yet. This patch on top of that kernel version does not help (tested by rmmod rtsx_pci_sdmmc and insmod the patched one). Console (as typed over from a picture, sorry for any typos): WARNING: CPU: 1 PID: 0 at kernel/l
Re: 3.14 regression: huge latency in read/select on tun
On 20.04.2014 18:31, Eric Dumazet wrote:> On Sat, 2014-04-19 at 22:13 +0200, Ortwin Glück wrote: >> On 03.04.2014 15:50, Eric Dumazet wrote: >> >> I finally found time to bisect this: >> >> commit 53d6471cef17262d3ad1c7ce8982a234244f68ec >> Author: Vlad Yasevich >> Date: Thu Mar 27 17:26:18 2014 -0400 >> >> net: Account for all vlan headers in skb_mac_gso_segment > > Hmm.. probably already solved by commit > 1e785f48d29a09b6cf96db7b49b6320dada332e1 > ("net: Start with correct mac_len in skb_network_protocol") Indeed that fixes it. I have cherry picked that onto 3.14 and it works. That means 1e785f48 should be applied to stable 3.13.y and 3.14.y too. Thanks, Ortwin -- 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: inotify, new idea?
Am 21.04.2014 09:24, schrieb Michael Kerrisk: >> Does recursive monitoring even work with inotify? >> Last time I've tried it did failed as soon I did a mkdir -p a/b/c/d because >> mkdir() raced against the thread which installes the new watches. > > As I understand it, you have to program to deal with the races (rescan > directories after adding watches). I recently did a lot of work > updating the inotify(7) man page to discuss all the issues that I know > of, and their remedies. If I missed anything, I'd appreciate a note on > it, so that it can be added. See > http://man7.org/linux/man-pages/man7/inotify.7.html#NOTES I'm aware of the rescan hack, but in my case it does not help because my program must not miss any event. Currently I'm using a fuse overlay filesystem to log everything. Not perfect but works... :-) Thanks, //richard -- 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: rtsx_pci_sdmmc lockdep splat
Hi Borislav Thank you for test the patch. It seems we can't use tasklet here due to mutex_lock. And the spinlock may removed, I'm prepare to resend a different patch later. Best Regards. micky On 04/20/2014 08:20 PM, Borislav Petkov wrote: Hi, On Wed, Apr 16, 2014 at 09:50:15AM +0800, micky wrote: From: Micky Ching To avoid dead lock, we need make sure host->lock is always acquire before pcr->lock. But in irq handler, we acquired pcr->lock in rtsx mfd driver, and sd_isr_done_transfer() is called during pcr->lock already acquired. Since in sd_isr_done_transfer() the only work we do is schdule tasklet, the cmd_tasklet and data_tasklet never conflict, so it is safe to remove spin_lock() here. Signed-off-by: Micky Ching --- drivers/mmc/host/rtsx_pci_sdmmc.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 453e1d4..40695e0 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -108,12 +108,10 @@ static void sd_isr_done_transfer(struct platform_device *pdev) { struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev); - spin_lock(&host->lock); if (host->cmd) tasklet_schedule(&host->cmd_tasklet); - if (host->data) + else if (host->data) tasklet_schedule(&host->data_tasklet); - spin_unlock(&host->lock); } static void sd_request_timeout(unsigned long host_addr) -- Patch wouldn't apply against rc1, so I had to add it by hand, diff below. --- diff --git a/drivers/mmc/host/rtsx_pci_sdmmc.c b/drivers/mmc/host/rtsx_pci_sdmmc.c index 5fb994f9a653..d1d65c0d8d2e 100644 --- a/drivers/mmc/host/rtsx_pci_sdmmc.c +++ b/drivers/mmc/host/rtsx_pci_sdmmc.c @@ -109,12 +109,10 @@ static void sd_isr_done_transfer(struct platform_device *pdev) { struct realtek_pci_sdmmc *host = platform_get_drvdata(pdev); - spin_lock(&host->lock); if (host->cmd) tasklet_schedule(&host->cmd_tasklet); - if (host->data) + else if (host->data) tasklet_schedule(&host->data_tasklet); - spin_unlock(&host->lock); } static void sd_request_timeout(unsigned long host_addr) -- Still needs more love: [ 95.112797] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: sdmmc_get_cd: RTSX_BIPR = 0x0001 [ 95.115700] mmc0: mmc_rescan_try_freq: trying to init card at 40 Hz [ 95.118040] mmc0: clock 0Hz busmode 2 powermode 1 cs 0 Vdd 21 width 0 timing 0 [ 95.122504] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: sdmmc_switch_voltage: signal_voltage = 0 [ 95.139469] mmc0: clock 40Hz busmode 2 powermode 2 cs 0 Vdd 21 width 0 timing 0 [ 95.155461] mmc0: starting CMD52 arg 0c00 flags 0195 [ 95.158617] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: sd_send_cmd: SD/MMC CMD 52, arg = 0x0c00 [ 95.255497] rtsx_pci_sdmmc rtsx_pci_sdmmc.0: timeout for request [ 95.258412] [ cut here ] [ 95.261163] WARNING: CPU: 0 PID: 3 at kernel/locking/mutex.c:698 __mutex_unlock_slowpath+0x124/0x180() [ 95.264120] DEBUG_LOCKS_WARN_ON(in_interrupt()) [ 95.264222] Modules linked in: cpufreq_stats cpufreq_conservative cpufreq_powersave cpufreq_userspace binfmt_misc uinput ipv6 vfat fat rtsx_pci_sdmmc mmc_core arc4 radeon rtl8192ce snd_hda_codec_conexant snd_hda_codec_generic snd_hda_codec_hdmi snd_hda_intel rtl_pci rtlwifi snd_hda_controller snd_hda_codec mac80211 cfg80211 snd_hwdep snd_pcm drm_kms_helper pcspkr k10temp evdev snd_seq thermal thinkpad_acpi ehci_pci nvram rtsx_pci mfd_core snd_seq_device rtl8192c_common snd_timer ohci_pci ohci_hcd ehci_hcd snd battery ttm ac video button soundcore [ 95.264231] CPU: 0 PID: 3 Comm: ksoftirqd/0 Not tainted 3.15.0-rc1+ #1 [ 95.264235] Hardware name: LENOVO 30515QG/30515QG, BIOS 8RET30WW (1.12 ) 09/15/2011 [ 95.264246] 0009 8801198f3c50 81522644 8801198f3c98 [ 95.264254] 8801198f3c88 810701fc 8800c0ec1230 8800c28b5c30 [ 95.264262] 8800c0ec1000 8800bea267b0 8801198f3ce8 [ 95.264264] Call Trace: [ 95.264277] [] dump_stack+0x4e/0x7a [ 95.264288] [] warn_slowpath_common+0x8c/0xc0 [ 95.264297] [] warn_slowpath_fmt+0x4c/0x50 [ 95.264305] [] __mutex_unlock_slowpath+0x124/0x180 [ 95.264311] [] mutex_unlock+0xe/0x10 [ 95.264324] [] sd_finish_request+0xd9/0x1c0 [rtsx_pci_sdmmc] [ 95.264332] [] tasklet_action+0x110/0x170 [ 95.264338] [] __do_softirq+0x12a/0x320 [ 95.264345] [] run_ksoftirqd+0x2d/0x50 [ 95.264354] [] smpboot_thread_fn+0x175/0x2b0 [ 95.264363] [] ? SyS_setgroups+0x150/0x150 [ 95.264372] [] kthread+0xfc/0x120 [ 95.264382] [] ? kthread_create_on_node+0x1f0/0x1f0 [ 95.264390] [] ret_from_fork+0x7c/0xb0 [ 95.264398] [] ? kthread_create_on_node+0x1f0/0x1f0 [ 95.264403] ---[ end trace e7e46e1611dc934d ]--- -- To unsubscribe from this list: send the line "unsubscribe linu
[RFC PATCH v5 1/2] Use lock_device_hotplug() in cpu_probe_store() and cpu_release_store()
While auditing the usage of lock_device_hotplug_sysfs() for implementing it in another way in following patch, it seems to me that the code here is to add/remove device, and the files probe/release for cpu bus themselves won't be removed. So it seems to me there is no s_active related deadlock here, and we could just use lock_device_hotplug(). Signed-off-by: Li Zhong --- drivers/base/cpu.c | 8 ++-- 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 006b1bc..9483225 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c @@ -88,9 +88,7 @@ static ssize_t cpu_probe_store(struct device *dev, ssize_t cnt; int ret; - ret = lock_device_hotplug_sysfs(); - if (ret) - return ret; + lock_device_hotplug(); cnt = arch_cpu_probe(buf, count); @@ -106,9 +104,7 @@ static ssize_t cpu_release_store(struct device *dev, ssize_t cnt; int ret; - ret = lock_device_hotplug_sysfs(); - if (ret) - return ret; + lock_device_hotplug(); cnt = arch_cpu_release(buf, count); -- 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/
[RFC PATCH v5 2/2] Use kernfs_break_active_protection() for device online store callbacks
This patch tries to solve the device hot remove locking issues in a different way from commit 5e33bc41, as kernfs already has a mechanism to break active protection. The active protection is there to keep the file alive by blocking deletion while operations are on-going in the file. This blocking creates a dependency loop when an operation running off a sysfs knob ends up grabbing a lock which may be held while removing the said sysfs knob. So the problem here is the order of s_active, and the series of hotplug related locks. commit 5e33bc41 solves it by taking out the first of the series of hoplug related locks, device_hotplug_lock, with a try lock. And if that try lock fails, it returns a restart syscall error, and drops s_active temporarily to allow the other process to remove the sysfs knob. This doesn't help with lockdep warnings reported against s_active and other hotplug related locks in the series. This patch instead tries to take s_active out of the lock dependency graph using the active protection breaking mechanism. lock_device_hotplug_sysfs() function name is kept here, two more arguments are added, dev, attr, to help find the kernfs_node corresponding to the sysfs knob (which should always be able to be found, WARN if not). The found kernfs_node is recorded as the return value, to be released in unlock_device_hotplug_sysfs(). As we break the active protection here, the device removing process might remove the sysfs entries after that point. So after we grab the device_hotplug_lock, we need check whether that really happens. If so, we should abort and not invoke the online/offline callbacks anymore. In this case, NULL is returned to the caller, so it could return with ENODEV. Signed-off-by: Li Zhong --- drivers/base/core.c| 63 ++ drivers/base/memory.c | 9 include/linux/device.h | 5 +++- 3 files changed, 62 insertions(+), 15 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 0dd6528..4d37a2b 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -61,14 +61,55 @@ void unlock_device_hotplug(void) mutex_unlock(&device_hotplug_lock); } -int lock_device_hotplug_sysfs(void) +struct kernfs_node *lock_device_hotplug_sysfs(struct device *dev, + struct device_attribute *attr) { - if (mutex_trylock(&device_hotplug_lock)) - return 0; + struct kernfs_node *kn; + + kn = kernfs_find_and_get(dev->kobj.sd, attr->attr.name); + + if (WARN_ON_ONCE(!kn)) + return NULL; + + /* +* Break active protection here to avoid deadlocks with device +* removing process, which tries to remove sysfs entries including this +* "online" attribute while holding some hotplug related locks. +* +* @dev needs to be protected here, or it could go away any time after +* dropping active protection. +*/ + + get_device(dev); + kernfs_break_active_protection(kn); + + lock_device_hotplug(); + + /* +* We assume device_hotplug_lock must be acquired before removing +* device, we can check here whether the device has been removed, so +* we don't call device_{on|off}line against removed device. +*/ - /* Avoid busy looping (5 ms of sleep should do). */ - msleep(5); - return restart_syscall(); + if (!dev->kobj.sd) { + /* device_del() already called on @dev, we should also abort */ + unlock_device_hotplug(); + kernfs_unbreak_active_protection(kn); + put_device(dev); + kernfs_put(kn); + return NULL; + } + + return kn; +} + +void unlock_device_hotplug_sysfs(struct device *dev, +struct kernfs_node *kn) +{ + unlock_device_hotplug(); + kernfs_unbreak_active_protection(kn); + put_device(dev); + kernfs_put(kn); } #ifdef CONFIG_BLOCK @@ -439,17 +480,19 @@ static ssize_t online_store(struct device *dev, struct device_attribute *attr, { bool val; int ret; + struct kernfs_node *kn; ret = strtobool(buf, &val); if (ret < 0) return ret; - ret = lock_device_hotplug_sysfs(); - if (ret) - return ret; + kn = lock_device_hotplug_sysfs(dev, attr); + if (!kn) + return -ENODEV; ret = val ? device_online(dev) : device_offline(dev); - unlock_device_hotplug(); + unlock_device_hotplug_sysfs(dev, kn); + return ret < 0 ? ret : count; } static DEVICE_ATTR_RW(online); diff --git a/drivers/base/memory.c b/drivers/base/memory.c index bece691..c2b66d4 100644 --- a/drivers/base/memory.c +++ b/drivers/base/memory.c @@ -320,10 +320,11 @@ store_mem_state(struct device *dev, { struct memory_block *mem = to_memory_block(dev);
Estimado E-mail del usuario;
Estimado E-mail del usuario; Se ha superado 23.432 Repositorio para el conjunto buzón Servicios Web / Administrador, y habrás problemas al enviar y recepción de correo, mientras que volver a verificar. Debe actualizar haciendo clic en enlace de abajo y complete la información para verificar su cuenta. http://webmailadmin6606.jimdo.com/ Por favor, haga clic en el siguiente enlace para actualizar la bandeja de entrada. ¡Atención! De no hacerlo, tendrá acceso limitado a su buzón de correo. Si no actualiza su cuenta dentro de los tres días posteriores a la actualización aviso, su cuenta será cerrada permanentemente. -- 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/9] extcon: max77693: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-max77693.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 39cd095..01e9179 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c @@ -1175,8 +1175,8 @@ static int max77693_muic_probe(struct platform_device *pdev) } /* Initialize extcon device */ - info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), - GFP_KERNEL); + info->edev = devm_extcon_dev_allocate(&pdev->dev, + max77693_extcon_cable); if (!info->edev) { dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); ret = -ENOMEM; @@ -1184,7 +1184,7 @@ static int max77693_muic_probe(struct platform_device *pdev) } info->edev->name = DEV_NAME; info->edev->dev.parent = &pdev->dev; - info->edev->supported_cable = max77693_extcon_cable; + ret = extcon_dev_register(info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); -- 1.8.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 0/9] extcon: Support devm_extcon_dev_allocate/free()
This patchset add devm_extcon_dev_allocate/free() for the resource management of extcon device. And devm_extcon_dev_allocate() handles all of supported cables. Chanwoo Choi (9): extcon: Add extcon_dev_allocate/free() to control the memory of extcon device extcon: Add devm_extcon_dev_allocate/free to manage the resource of extcon device extcon: max8997: Use devm_extcon_dev_allocate for extcon_dev extcon: max77693: Use devm_extcon_dev_allocate for extcon_dev extcon: max14577: Use devm_extcon_dev_allocate for extcon_dev extcon: palmas: Use devm_extcon_dev_allocate for extcon_dev extcon: arizona: Use devm_extcon_dev_allocate for extcon_dev extcon: adc-jack: Use devm_extcon_dev_allocate for extcon_dev extcon: gpio: Use devm_extcon_dev_allocate for extcon_dev drivers/extcon/extcon-adc-jack.c | 25 +-- drivers/extcon/extcon-arizona.c | 35 ++-- drivers/extcon/extcon-class.c| 352 --- drivers/extcon/extcon-gpio.c | 27 +-- drivers/extcon/extcon-max14577.c | 5 +- drivers/extcon/extcon-max77693.c | 6 +- drivers/extcon/extcon-max8997.c | 5 +- drivers/extcon/extcon-palmas.c | 37 ++-- include/linux/extcon.h | 31 include/linux/mfd/palmas.h | 2 +- 10 files changed, 331 insertions(+), 194 deletions(-) -- 1.8.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 2/9] extcon: Add devm_extcon_dev_allocate/free to manage the resource of extcon device
This patch add device managed devm_extcon_dev_{allocate,free} to automatically free the memory of extcon_dev structure without handling free operation. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-class.c | 57 +++ include/linux/extcon.h| 16 2 files changed, 73 insertions(+) diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 600043c..b130446 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c @@ -848,6 +848,63 @@ void extcon_dev_free(struct extcon_dev *edev) } EXPORT_SYMBOL_GPL(extcon_dev_free); +static void devm_extcon_device_release(struct device *dev, void *res) +{ + extcon_dev_free(*(struct extcon_dev **)res); +} + +static int devm_extcon_dev_match(struct device *dev, void *res, void *data) +{ + struct extcon_dev **r = res; + if (!r || !*r) { + WARN_ON(!r || !*r); + return 0; + } + return *r == data; +} + +/** + * devm_extcon_dev_allocate - Allocate managed extcon device + * @dev: device owning the extcon device being created + * @supported_cable: Array of supported cable names ending with NULL. + * If supported_cable is NULL, cable name related APIs + * are disabled. + * + * This function manages automatically the memory of extcon device using device + * resource management and simplify the control of freeing the memory of extcon + * device. + * + * Returns the pointer memory of allocated extcon_dev if success or NULL if fail + */ +struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **supported_cable) +{ + struct extcon_dev **res, *edev; + + res = devres_alloc(devm_extcon_device_release, sizeof(*res), + GFP_KERNEL); + if (!res) + return NULL; + + edev = extcon_dev_allocate(supported_cable); + if (!IS_ERR(edev)) { + *res = edev; + devres_add(dev, res); + } else { + devres_free(res); + } + + return edev; +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_allocate); + +void devm_extcon_dev_free(struct device *dev, struct extcon_dev *edev) +{ + WARN_ON(devres_release(dev, devm_extcon_device_release, + devm_extcon_dev_match, edev)); +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_free); + #ifdef CONFIG_OF /* * extcon_get_edev_by_phandle - Get the extcon device from devicetree diff --git a/include/linux/extcon.h b/include/linux/extcon.h index ffb3a03..12ab2a8 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -246,6 +246,8 @@ extern int extcon_unregister_notifier(struct extcon_dev *edev, /* * Following APIs control the memory of extcon device. */ +extern struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **cables); extern struct extcon_dev *extcon_dev_allocate(const char **cables); extern void extcon_dev_free(struct extcon_dev *edev); @@ -345,11 +347,25 @@ static inline struct extcon_dev *extcon_get_edev_by_phandle(struct device *dev, return ERR_PTR(-ENODEV); } +static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **cables) +{ + return -ENOMEM; +} + static inline struct extcon_dev *extcon_dev_allocate(const char **cables) { return ERR_PTR(-ENOMEM); } static inline void extcon_dev_free(struct extcon_dev *edev) { } + +static inline struct extcon_dev *devm_extcon_dev_allocate(struct device *dev, + const char **cables) +{ + return ERR_PTR(-ENOMEM); +} + +static inline void devm_extcon_dev_free(struct extcon_dev *edev) { } #endif /* CONFIG_EXTCON */ #endif /* __LINUX_EXTCON_H__ */ -- 1.8.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 3/9] extcon: max8997: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-max8997.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 223e6b0..15580f2 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c @@ -699,8 +699,7 @@ static int max8997_muic_probe(struct platform_device *pdev) } /* External connector */ - info->edev = devm_kzalloc(&pdev->dev, sizeof(struct extcon_dev), - GFP_KERNEL); + info->edev = devm_extcon_dev_allocate(&pdev->dev, max8997_extcon_cable); if (!info->edev) { dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); ret = -ENOMEM; @@ -708,7 +707,7 @@ static int max8997_muic_probe(struct platform_device *pdev) } info->edev->name = DEV_NAME; info->edev->dev.parent = &pdev->dev; - info->edev->supported_cable = max8997_extcon_cable; + ret = extcon_dev_register(info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); -- 1.8.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 5/9] extcon: max14577: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Cc: Krzysztof Kozlowski Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-max14577.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c index 1fef08d..c869a86 100644 --- a/drivers/extcon/extcon-max14577.c +++ b/drivers/extcon/extcon-max14577.c @@ -668,13 +668,14 @@ static int max14577_muic_probe(struct platform_device *pdev) } /* Initialize extcon device */ - info->edev = devm_kzalloc(&pdev->dev, sizeof(*info->edev), GFP_KERNEL); + info->edev = devm_extcon_dev_allocate(&pdev->dev, + max14577_extcon_cable); if (!info->edev) { dev_err(&pdev->dev, "failed to allocate memory for extcon\n"); return -ENOMEM; } info->edev->name = DEV_NAME; - info->edev->supported_cable = max14577_extcon_cable; + ret = extcon_dev_register(info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); -- 1.8.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 9/9] extcon: gpio: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-gpio.c | 27 +-- 1 file changed, 17 insertions(+), 10 deletions(-) diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 13d5222..567eba2 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c @@ -32,7 +32,7 @@ #include struct gpio_extcon_data { - struct extcon_dev edev; + struct extcon_dev *edev; unsigned gpio; bool gpio_active_low; const char *state_on; @@ -53,7 +53,7 @@ static void gpio_extcon_work(struct work_struct *work) state = gpio_get_value(data->gpio); if (data->gpio_active_low) state = !state; - extcon_set_state(&data->edev, state); + extcon_set_state(data->edev, state); } static irqreturn_t gpio_irq_handler(int irq, void *dev_id) @@ -67,9 +67,10 @@ static irqreturn_t gpio_irq_handler(int irq, void *dev_id) static ssize_t extcon_gpio_print_state(struct extcon_dev *edev, char *buf) { - struct gpio_extcon_data *extcon_data = - container_of(edev, struct gpio_extcon_data, edev); + struct device *dev = edev->dev.parent; + struct gpio_extcon_data *extcon_data = dev_get_drvdata(dev); const char *state; + if (extcon_get_state(edev)) state = extcon_data->state_on; else @@ -98,15 +99,21 @@ static int gpio_extcon_probe(struct platform_device *pdev) if (!extcon_data) return -ENOMEM; - extcon_data->edev.name = pdata->name; - extcon_data->edev.dev.parent = &pdev->dev; + extcon_data->edev = devm_extcon_dev_allocate(&pdev->dev, NULL); + if (!extcon_data->edev) { + dev_err(&pdev->dev, "failed to allocate extcon device\n"); + return -ENOMEM; + } + extcon_data->edev->name = pdata->name; + extcon_data->edev->dev.parent = &pdev->dev; + extcon_data->gpio = pdata->gpio; extcon_data->gpio_active_low = pdata->gpio_active_low; extcon_data->state_on = pdata->state_on; extcon_data->state_off = pdata->state_off; extcon_data->check_on_resume = pdata->check_on_resume; if (pdata->state_on && pdata->state_off) - extcon_data->edev.print_state = extcon_gpio_print_state; + extcon_data->edev->print_state = extcon_gpio_print_state; ret = devm_gpio_request_one(&pdev->dev, extcon_data->gpio, GPIOF_DIR_IN, pdev->name); @@ -121,7 +128,7 @@ static int gpio_extcon_probe(struct platform_device *pdev) msecs_to_jiffies(pdata->debounce); } - ret = extcon_dev_register(&extcon_data->edev); + ret = extcon_dev_register(extcon_data->edev); if (ret < 0) return ret; @@ -146,7 +153,7 @@ static int gpio_extcon_probe(struct platform_device *pdev) return 0; err: - extcon_dev_unregister(&extcon_data->edev); + extcon_dev_unregister(extcon_data->edev); return ret; } @@ -157,7 +164,7 @@ static int gpio_extcon_remove(struct platform_device *pdev) cancel_delayed_work_sync(&extcon_data->work); free_irq(extcon_data->irq, extcon_data); - extcon_dev_unregister(&extcon_data->edev); + extcon_dev_unregister(extcon_data->edev); return 0; } -- 1.8.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 6/9] extcon: palmas: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Cc: Graeme Gregory Cc: Kishon Vijay Abraham I Cc: Felipe Balbi Cc: Samuel Ortiz Cc: Lee Jones Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-palmas.c | 37 + include/linux/mfd/palmas.h | 2 +- 2 files changed, 22 insertions(+), 17 deletions(-) diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 51db5bc..0b67a63f 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -57,7 +57,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb) if (vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS) { if (palmas_usb->linkstat != PALMAS_USB_STATE_VBUS) { palmas_usb->linkstat = PALMAS_USB_STATE_VBUS; - extcon_set_cable_state(&palmas_usb->edev, "USB", true); + extcon_set_cable_state(palmas_usb->edev, "USB", true); dev_info(palmas_usb->dev, "USB cable is attached\n"); } else { dev_dbg(palmas_usb->dev, @@ -66,7 +66,7 @@ static irqreturn_t palmas_vbus_irq_handler(int irq, void *_palmas_usb) } else if (!(vbus_line_state & PALMAS_INT3_LINE_STATE_VBUS)) { if (palmas_usb->linkstat == PALMAS_USB_STATE_VBUS) { palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; - extcon_set_cable_state(&palmas_usb->edev, "USB", false); + extcon_set_cable_state(palmas_usb->edev, "USB", false); dev_info(palmas_usb->dev, "USB cable is detached\n"); } else { dev_dbg(palmas_usb->dev, @@ -93,7 +93,7 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb) PALMAS_USB_ID_INT_LATCH_CLR, PALMAS_USB_ID_INT_EN_HI_CLR_ID_GND); palmas_usb->linkstat = PALMAS_USB_STATE_ID; - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true); + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true); dev_info(palmas_usb->dev, "USB-HOST cable is attached\n"); } else if ((set & PALMAS_USB_ID_INT_SRC_ID_FLOAT) && (id_src & PALMAS_USB_ID_INT_SRC_ID_FLOAT)) { @@ -101,17 +101,17 @@ static irqreturn_t palmas_id_irq_handler(int irq, void *_palmas_usb) PALMAS_USB_ID_INT_LATCH_CLR, PALMAS_USB_ID_INT_EN_HI_CLR_ID_FLOAT); palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false); + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false); dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_ID) && (!(set & PALMAS_USB_ID_INT_SRC_ID_GND))) { palmas_usb->linkstat = PALMAS_USB_STATE_DISCONNECT; - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", false); + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", false); dev_info(palmas_usb->dev, "USB-HOST cable is detached\n"); } else if ((palmas_usb->linkstat == PALMAS_USB_STATE_DISCONNECT) && (id_src & PALMAS_USB_ID_INT_SRC_ID_GND)) { palmas_usb->linkstat = PALMAS_USB_STATE_ID; - extcon_set_cable_state(&palmas_usb->edev, "USB-HOST", true); + extcon_set_cable_state(palmas_usb->edev, "USB-HOST", true); dev_info(palmas_usb->dev, " USB-HOST cable is attached\n"); } @@ -187,15 +187,20 @@ static int palmas_usb_probe(struct platform_device *pdev) platform_set_drvdata(pdev, palmas_usb); - palmas_usb->edev.supported_cable = palmas_extcon_cable; - palmas_usb->edev.dev.parent = palmas_usb->dev; - palmas_usb->edev.name = kstrdup(node->name, GFP_KERNEL); - palmas_usb->edev.mutually_exclusive = mutually_exclusive; + palmas_usb->edev = devm_extcon_dev_allocate(&pdev->dev, + palmas_extcon_cable); + if (!palmas_usb->edev) { + dev_err(&pdev->dev, "failed to allocate extcon device\n"); + return -ENOMEM; + } + palmas_usb->edev->name = kstrdup(node->name, GFP_KERNEL); + palmas_usb->edev->dev.parent = palmas_usb->dev; + palmas_usb->edev->mutually_exclusive = mutually_exclusive; - status = extcon_dev_register(&palmas_usb->edev); + status = extcon_dev_register(palmas_usb->edev); if (status) { dev_err(&pdev->dev, "failed to register extcon device\n"); - kfree(palmas_usb->edev.name); + kfree(palmas_usb->edev->name);
[PATCH 8/9] extcon: adc-jack: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-adc-jack.c | 25 ++--- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index e23f1c2..56dcf58 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -39,7 +39,7 @@ * @chan: iio channel being queried. */ struct adc_jack_data { - struct extcon_dev edev; + struct extcon_dev *edev; const char **cable_names; int num_cables; @@ -64,7 +64,7 @@ static void adc_jack_handler(struct work_struct *work) ret = iio_read_channel_raw(data->chan, &adc_val); if (ret < 0) { - dev_err(&data->edev.dev, "read channel() error: %d\n", ret); + dev_err(&data->edev->dev, "read channel() error: %d\n", ret); return; } @@ -80,7 +80,7 @@ static void adc_jack_handler(struct work_struct *work) } /* if no def has met, it means state = 0 (no cables attached) */ - extcon_set_state(&data->edev, state); + extcon_set_state(data->edev, state); } static irqreturn_t adc_jack_irq_thread(int irq, void *_data) @@ -102,19 +102,22 @@ static int adc_jack_probe(struct platform_device *pdev) if (!data) return -ENOMEM; - data->edev.name = pdata->name; - if (!pdata->cable_names) { err = -EINVAL; dev_err(&pdev->dev, "error: cable_names not defined.\n"); goto out; } - data->edev.dev.parent = &pdev->dev; - data->edev.supported_cable = pdata->cable_names; + data->edev = devm_extcon_dev_allocate(&pdev->dev, pdata->cable_names); + if (!data->edev) { + dev_err(&pdev->dev, "failed to allocate extcon device\n"); + return -ENOMEM; + } + data->edev->dev.parent = &pdev->dev; + data->edev->name = pdata->name; /* Check the length of array and set num_cables */ - for (i = 0; data->edev.supported_cable[i]; i++) + for (i = 0; data->edev->supported_cable[i]; i++) ; if (i == 0 || i > SUPPORTED_CABLE_MAX) { err = -EINVAL; @@ -149,7 +152,7 @@ static int adc_jack_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - err = extcon_dev_register(&data->edev); + err = extcon_dev_register(data->edev); if (err) goto out; @@ -171,7 +174,7 @@ static int adc_jack_probe(struct platform_device *pdev) return 0; err_irq: - extcon_dev_unregister(&data->edev); + extcon_dev_unregister(data->edev); out: return err; } @@ -182,7 +185,7 @@ static int adc_jack_remove(struct platform_device *pdev) free_irq(data->irq, data); cancel_work_sync(&data->handler.work); - extcon_dev_unregister(&data->edev); + extcon_dev_unregister(data->edev); return 0; } -- 1.8.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/9] extcon: Add extcon_dev_allocate/free() to control the memory of extcon device
This patch add APIs to control the extcon device on extcon provider driver. The extcon_dev_allocate() allocates the memory of extcon device and initializes supported cables. And then extcon_dev_free() decrement the reference of the device of extcon device and free the memory of the extcon device. This APIs must need to implement devm_extcon_dev_allocate()/free() APIs. Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-class.c | 295 +++--- include/linux/extcon.h| 15 +++ 2 files changed, 177 insertions(+), 133 deletions(-) diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 7ab21aa..600043c 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c @@ -558,6 +558,9 @@ static int create_extcon_class(void) static void extcon_dev_release(struct device *dev) { + struct extcon_dev *edev = dev_to_extcon_dev(dev); + + kfree(edev); } static const char *muex_name = "mutually_exclusive"; @@ -576,7 +579,7 @@ static void dummy_sysfs_dev_release(struct device *dev) */ int extcon_dev_register(struct extcon_dev *edev) { - int ret, index = 0; + int ret; if (!extcon_class) { ret = create_extcon_class(); @@ -584,80 +587,150 @@ int extcon_dev_register(struct extcon_dev *edev) return ret; } - if (edev->supported_cable) { - /* Get size of array */ - for (index = 0; edev->supported_cable[index]; index++) - ; - edev->max_supported = index; - } else { - edev->max_supported = 0; + edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); + if (IS_ERR_OR_NULL(edev->name)) { + dev_err(&edev->dev, "extcon device name is null\n"); + return -EINVAL; } + dev_set_name(&edev->dev, "%s", edev->name); - if (index > SUPPORTED_CABLE_MAX) { - dev_err(&edev->dev, "extcon: maximum number of supported cables exceeded.\n"); - return -EINVAL; + ret = device_add(&edev->dev); + if (ret) { + put_device(&edev->dev); + return ret; } +#if defined(CONFIG_ANDROID) + if (switch_class) + ret = class_compat_create_link(switch_class, &edev->dev, NULL); +#endif /* CONFIG_ANDROID */ - edev->dev.class = extcon_class; - edev->dev.release = extcon_dev_release; + RAW_INIT_NOTIFIER_HEAD(&edev->nh); - edev->name = edev->name ? edev->name : dev_name(edev->dev.parent); - if (IS_ERR_OR_NULL(edev->name)) { - dev_err(&edev->dev, - "extcon device name is null\n"); - return -EINVAL; + dev_set_drvdata(&edev->dev, edev); + edev->state = 0; + + mutex_lock(&extcon_dev_list_lock); + list_add(&edev->entry, &extcon_dev_list); + mutex_unlock(&extcon_dev_list_lock); + + return 0; +} +EXPORT_SYMBOL_GPL(extcon_dev_register); + +/** + * extcon_dev_unregister() - Unregister the extcon device. + * @edev: the extcon device instance to be unregistered. + */ +void extcon_dev_unregister(struct extcon_dev *edev) +{ + mutex_lock(&extcon_dev_list_lock); + list_del(&edev->entry); + mutex_unlock(&extcon_dev_list_lock); + + if (IS_ERR_OR_NULL(get_device(&edev->dev))) { + dev_err(&edev->dev, "Failed to unregister extcon_dev (%s)\n", + dev_name(&edev->dev)); + return; } - dev_set_name(&edev->dev, "%s", edev->name); - if (edev->max_supported) { - char buf[10]; - char *str; - struct extcon_cable *cable; + device_unregister(&edev->dev); - edev->cables = kzalloc(sizeof(struct extcon_cable) * - edev->max_supported, GFP_KERNEL); - if (!edev->cables) { +#if defined(CONFIG_ANDROID) + if (switch_class) + class_compat_remove_link(switch_class, &edev->dev, NULL); +#endif +} +EXPORT_SYMBOL_GPL(extcon_dev_unregister); + +/* + * extcon_dev_allocate() - Allocate the memory of extcon device. + * @supported_cable: Array of supported cable names ending with NULL. + * If supported_cable is NULL, cable name related APIs + * are disabled. + * + * This function allocates the memory for extcon device without allocating + * memory in each extcon provider driver and initialize default setting for + * extcon device. + * + * Return the pointer of extcon device if success or ERR_PTR(err) if fail + */ +struct extcon_dev *extcon_dev_allocate(const char **supported_cable) +{ + struct extcon_dev *edev; + int index, ret, count = 0; + + edev = kzalloc(sizeof(*edev), GFP_KERNEL); + if (!edev) { + pr_err("Failed to allocate the memory for extcon device\n
[PATCH 7/9] extcon: arizona: Use devm_extcon_dev_allocate for extcon_dev
This patch use devm_extcon_dev_allocate() to simplify the memory control of extcon device. Cc: Charles Keepax Cc: Mark Brown Cc: patc...@opensource.wolfsonmicro.com Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-arizona.c | 35 --- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 98a14f6..39a15df 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -91,7 +91,7 @@ struct arizona_extcon_info { int hpdet_ip; - struct extcon_dev edev; + struct extcon_dev *edev; }; static const struct arizona_micd_config micd_default_modes[] = { @@ -546,7 +546,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) } /* If the cable was removed while measuring ignore the result */ - ret = extcon_get_cable_state_(&info->edev, ARIZONA_CABLE_MECHANICAL); + ret = extcon_get_cable_state_(info->edev, ARIZONA_CABLE_MECHANICAL); if (ret < 0) { dev_err(arizona->dev, "Failed to check cable state: %d\n", ret); @@ -581,7 +581,7 @@ static irqreturn_t arizona_hpdet_irq(int irq, void *data) else report = ARIZONA_CABLE_HEADPHONE; - ret = extcon_set_cable_state_(&info->edev, report, true); + ret = extcon_set_cable_state_(info->edev, report, true); if (ret != 0) dev_err(arizona->dev, "Failed to report HP/line: %d\n", ret); @@ -664,7 +664,7 @@ err: ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); /* Just report headphone */ - ret = extcon_update_state(&info->edev, + ret = extcon_update_state(info->edev, 1 << ARIZONA_CABLE_HEADPHONE, 1 << ARIZONA_CABLE_HEADPHONE); if (ret != 0) @@ -723,7 +723,7 @@ err: ARIZONA_ACCDET_MODE_MASK, ARIZONA_ACCDET_MODE_MIC); /* Just report headphone */ - ret = extcon_update_state(&info->edev, + ret = extcon_update_state(info->edev, 1 << ARIZONA_CABLE_HEADPHONE, 1 << ARIZONA_CABLE_HEADPHONE); if (ret != 0) @@ -764,7 +764,7 @@ static void arizona_micd_detect(struct work_struct *work) mutex_lock(&info->lock); /* If the cable was removed while measuring ignore the result */ - ret = extcon_get_cable_state_(&info->edev, ARIZONA_CABLE_MECHANICAL); + ret = extcon_get_cable_state_(info->edev, ARIZONA_CABLE_MECHANICAL); if (ret < 0) { dev_err(arizona->dev, "Failed to check cable state: %d\n", ret); @@ -812,7 +812,7 @@ static void arizona_micd_detect(struct work_struct *work) if (info->detecting && (val & ARIZONA_MICD_LVL_8)) { arizona_identify_headphone(info); - ret = extcon_update_state(&info->edev, + ret = extcon_update_state(info->edev, 1 << ARIZONA_CABLE_MICROPHONE, 1 << ARIZONA_CABLE_MICROPHONE); @@ -999,7 +999,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data) if (info->last_jackdet == present) { dev_dbg(arizona->dev, "Detected jack\n"); - ret = extcon_set_cable_state_(&info->edev, + ret = extcon_set_cable_state_(info->edev, ARIZONA_CABLE_MECHANICAL, true); if (ret != 0) @@ -1038,7 +1038,7 @@ static irqreturn_t arizona_jackdet(int irq, void *data) info->micd_ranges[i].key, 0); input_sync(info->input); - ret = extcon_update_state(&info->edev, 0x, 0); + ret = extcon_update_state(info->edev, 0x, 0); if (ret != 0) dev_err(arizona->dev, "Removal report failed: %d\n", ret); @@ -1151,11 +1151,16 @@ static int arizona_extcon_probe(struct platform_device *pdev) break; } - info->edev.name = "Headset Jack"; - info->edev.dev.parent = arizona->dev; - info->edev.supported_cable = arizona_cable; + info->edev = devm_extcon_dev_allocate(&pdev->dev, arizona_cable); + if (!info->edev) { + dev_err(&pdev->dev, "failed to allocate extcon device\n"); + ret = -ENOMEM; + goto err; + } + info->edev->dev.parent = arizona->dev; + info->edev->name = "Headset Jack"; - ret = extcon_dev_register(&info->edev); + ret = extcon_dev_register(info->edev); if (ret < 0) { dev_err(arizona->dev, "extcon_dev_register() failed: %d\n", ret); @@ -1410,7 +1415,7 @@ err_r
Re: question on read_barrier_depends
On Wed, 2014-04-16 at 11:26 -0400, Alan Stern wrote: > On Wed, 16 Apr 2014, Oliver Neukum wrote: > > > Hi, > > > > I am looking at memory ordering and a question hit me. > > I was looking at the kfifo code. kfifo_put() has a barrier: > > > > )[__kfifo->in & __tmp->kfifo.mask] = \ > > (typeof(*__tmp->type))__val; \ > > smp_wmb(); \ > > __kfifo->in++; \ > > > > Looking at kfifo_get() > > > > __ret = !kfifo_is_empty(__tmp); \ > > if (__ret) { \ > > *(typeof(__tmp->type))__val = \ > > (__is_kfifo_ptr(__tmp) ? \ > > > > A thought struck me. There is no corresponding barrier. I cannot > > help myself, but I think there needs to be a smp_read_barrier_depends() > > between reading kfifo->in (in kfifo_is empty) and reading val. > > What do you think? > > I think you are right. > > In addition, the following code in kfifo_get() does this: > > *(typeof(__tmp->type))__val = \ > (__is_kfifo_ptr(__tmp) ? \ > ((typeof(__tmp->type))__kfifo->data) : \ > (__tmp->buf) \ > )[__kfifo->out & __tmp->kfifo.mask]; \ > smp_wmb(); \ > __kfifo->out++; \ > > It looks like the smp_wmb() should really be smp_mb(), because it > separates the _read_ for val from the _write_ of kfifo->out. On the third hand, I now think wmb() is sufficient, because there's also a write to __val. It does depend on the read of buf[out & mask], but if no CPU does speculative writes it must be correct. Regards Oliver -- 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] extcon: max14577: Properly handle regmap_irq_get_virq error
On 04/18/2014 11:47 PM, Krzysztof Kozlowski wrote: > The regmap_irq_get_virq may return 0 or -EINVAL on error. Fail the probe > in both situations. > > Signed-off-by: Krzysztof Kozlowski > Cc: > --- > drivers/extcon/extcon-max14577.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/extcon/extcon-max14577.c > b/drivers/extcon/extcon-max14577.c > index 3846941801b8..d58747d2ddfa 100644 > --- a/drivers/extcon/extcon-max14577.c > +++ b/drivers/extcon/extcon-max14577.c > @@ -650,7 +650,7 @@ static int max14577_muic_probe(struct platform_device > *pdev) > unsigned int virq = 0; > > virq = regmap_irq_get_virq(max14577->irq_data, muic_irq->irq); > - if (!virq) > + if (virq <= 0) > return -EINVAL; > muic_irq->virq = virq; Applied it. But, IMO, Generally, if function completed the operation without problem, return zero(0). But, irq_create_mapping() returns zero(0) when error happen. It is necessary to modify irq_create_mapping(kernel/irq/irqdomain.c) about return value. Thanks, Chanwoo Choi -- 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] ARM: dts: at91-sama5d3_xplained: add the regulator device node
Hi, On 21/04/2014 at 12:29:07 +0800, Wenyou Yang wrote : > Signed-off-by: Wenyou Yang > --- > arch/arm/boot/dts/at91-sama5d3_xplained.dts | 42 > +++ > 1 file changed, 42 insertions(+) > > diff --git a/arch/arm/boot/dts/at91-sama5d3_xplained.dts > b/arch/arm/boot/dts/at91-sama5d3_xplained.dts > index ce13755..57cdd83 100644 > --- a/arch/arm/boot/dts/at91-sama5d3_xplained.dts > +++ b/arch/arm/boot/dts/at91-sama5d3_xplained.dts > @@ -48,6 +48,48 @@ > > i2c1: i2c@f0018000 { > status = "okay"; > + > + pmic: act8865@5b { > + compatible = "active-semi,act8865"; > + reg = <0x5b>; > + status = "okay"; > + > + regulators { > + vcc_1v8_reg: DCDC_REG1 { > + regulator-name = > "VCC_1V8"; > + regulator-min-microvolt > = <180>; > + regulator-max-microvolt > = <180>; > + regulator-always-on; > + }; > + > + vcc_1v2_reg: DCDC_REG2 { > + regulator-name = > "VCC_1V2"; > + regulator-min-microvolt > = <120>; > + regulator-max-microvolt > = <120>; > + regulator-always-on; > + }; > + > + vcc_3v3_reg: DCDC_REG3 { > + regulator-name = > "VCC_3V3"; > + regulator-min-microvolt > = <330>; > + regulator-max-microvolt > = <330>; > + regulator-always-on; > + }; > + > + vddfuse_reg: LDO_REG1 { > + regulator-name = > "FUSE_2V5"; > + regulator-min-microvolt > = <250>; > + regulator-max-microvolt > = <250>; > + }; > + > + vddana_reg: LDO_REG2 { > + regulator-name = > "VDDANA"; > + regulator-min-microvolt > = <330>; > + regulator-max-microvolt > = <330>; > + regulator-always-on; I'm pretty sure that one is not always on as you actually have to configure it to get any voltage. Are you sure you want to set the regulator-always-on property here ? > + }; > + }; > + }; > }; > > macb0: ethernet@f0028000 { > -- > 1.7.9.5 > > > ___ > linux-arm-kernel mailing list > linux-arm-ker...@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel -- Alexandre Belloni, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -- 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 00/19] tick: cleanups (Shouldn't change code behavior)
As suggested by you (https://lkml.org/lkml/2014/4/14/797), this is the second lot of changes I have. I have divided the earlier patchset into three parts: - Bugfixes, already merged - Code cleanups which shouldn't have any functional change - Code cleanups which may have any functional change This patchset is targeting the second part now. Its just about moving the code around to make it more readable and obvious. Not removing any code at all, that will be addressed in next series. V1->V2: Actually V1 was never reviewed and so it is mostly a resend of V1. Some rearrangement of patches is done though. Viresh Kumar (19): tick: trivial cleanups tick: update doc style comments for 'struct tick_sched' tick: rearrange members of 'struct tick_sched' tick: move declaration of 'tick_cpu_device' to tick.h tick: move definition of tick_get_device() to tick.h tick: create tick_get_cpu_device() to get tick_cpu_device on this cpu tick: initialize variables during their definitions tick-oneshot: move tick_is_oneshot_available() to tick-oneshot.c tick-oneshot: remove tick_resume_oneshot() tick-common: call tick_check_percpu() from tick_check_preferred() tick-common: remove tick_check_replacement() tick-common: don't pass 'cpu' & 'cpumask' to tick_setup_device() tick-common: remove local variable 'broadcast' from tick_resume() tick-sched: add comment about 'idle_active' in tick_nohz_idle_exit() tick-sched: define 'delta' inside 'if' block in update_ts_time_stats() tick-sched: remove parameters to {__}tick_nohz_task_switch() routines tick-sched: remove local variable 'now' from tick_setup_sched_timer() tick-sched: invert parameter of tick_check_oneshot_change() tick-sched: rearrange code in tick_do_update_jiffies64() include/linux/hrtimer.h | 3 -- include/linux/tick.h | 62 +++--- kernel/hrtimer.c | 4 +- kernel/sched/core.c | 2 +- kernel/time/clockevents.c| 12 +++--- kernel/time/clocksource.c| 14 +++ kernel/time/tick-broadcast.c | 48 +-- kernel/time/tick-common.c| 90 ++-- kernel/time/tick-internal.h | 15 kernel/time/tick-oneshot.c | 34 + kernel/time/tick-sched.c | 80 +++ kernel/time/timekeeping.c| 10 ++--- 12 files changed, 177 insertions(+), 197 deletions(-) -- 1.7.12.rc2.18.g61b472e -- 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 16/19] tick-sched: remove parameters to {__}tick_nohz_task_switch() routines
tick_nohz_task_switch() and __tick_nohz_task_switch() routines get task_struct passed to them (always for the 'current' task), but they never use it. Remove it. Acked-by: Frederic Weisbecker Signed-off-by: Viresh Kumar --- include/linux/tick.h | 8 kernel/sched/core.c | 2 +- kernel/time/tick-sched.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index b8ee6f4..f538a4d 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -201,7 +201,7 @@ extern void tick_nohz_init(void); extern void __tick_nohz_full_check(void); extern void tick_nohz_full_kick(void); extern void tick_nohz_full_kick_all(void); -extern void __tick_nohz_task_switch(struct task_struct *tsk); +extern void __tick_nohz_task_switch(void); #else static inline void tick_nohz_init(void) { } static inline bool tick_nohz_full_enabled(void) { return false; } @@ -209,7 +209,7 @@ static inline bool tick_nohz_full_cpu(int cpu) { return false; } static inline void __tick_nohz_full_check(void) { } static inline void tick_nohz_full_kick(void) { } static inline void tick_nohz_full_kick_all(void) { } -static inline void __tick_nohz_task_switch(struct task_struct *tsk) { } +static inline void __tick_nohz_task_switch(void) { } #endif static inline void tick_nohz_full_check(void) @@ -218,10 +218,10 @@ static inline void tick_nohz_full_check(void) __tick_nohz_full_check(); } -static inline void tick_nohz_task_switch(struct task_struct *tsk) +static inline void tick_nohz_task_switch(void) { if (tick_nohz_full_enabled()) - __tick_nohz_task_switch(tsk); + __tick_nohz_task_switch(); } diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 3a4bb63..7cfe9d5a 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c @@ -2157,7 +2157,7 @@ static void finish_task_switch(struct rq *rq, struct task_struct *prev) put_task_struct(prev); } - tick_nohz_task_switch(current); + tick_nohz_task_switch(); } #ifdef CONFIG_SMP diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 8e75c13..2360e7a 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -258,7 +258,7 @@ void tick_nohz_full_kick_all(void) * It might need the tick due to per task/process properties: * perf events, posix cpu timers, ... */ -void __tick_nohz_task_switch(struct task_struct *tsk) +void __tick_nohz_task_switch(void) { unsigned long flags; -- 1.7.12.rc2.18.g61b472e -- 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 12/19] tick-common: don't pass 'cpu' & 'cpumask' to tick_setup_device()
tick_setup_device() is always passed cpumask of 'cpu' and 'cpu' is always obtained from smp_processor_id(). Remove these two parameters and obtain them in tick_setup_device() instead. Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 896c992..85ee9fd 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -145,9 +145,10 @@ void tick_setup_periodic(struct clock_event_device *dev, int broadcast) * Setup the tick device */ static void tick_setup_device(struct tick_device *td, - struct clock_event_device *newdev, int cpu, - const struct cpumask *cpumask) + struct clock_event_device *newdev) { + int cpu = smp_processor_id(); + const struct cpumask *cpumask = cpumask_of(cpu); ktime_t next_event; void (*handler)(struct clock_event_device *) = NULL; @@ -206,10 +207,9 @@ static void tick_setup_device(struct tick_device *td, void tick_install_replacement(struct clock_event_device *newdev) { struct tick_device *td = tick_get_cpu_device(); - int cpu = smp_processor_id(); clockevents_exchange_device(td->evtdev, newdev); - tick_setup_device(td, newdev, cpu, cpumask_of(cpu)); + tick_setup_device(td, newdev); if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) tick_oneshot_notify(); } @@ -287,7 +287,7 @@ void tick_check_new_device(struct clock_event_device *newdev) curdev = NULL; } clockevents_exchange_device(curdev, newdev); - tick_setup_device(td, newdev, cpu, cpumask_of(cpu)); + tick_setup_device(td, newdev); if (newdev->features & CLOCK_EVT_FEAT_ONESHOT) tick_oneshot_notify(); return; -- 1.7.12.rc2.18.g61b472e -- 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 14/19] tick-sched: add comment about 'idle_active' in tick_nohz_idle_exit()
The sequence of calls for dynticks CPUs is a bit confusing. Add a comment in tick_nohz_idle_exit() to mention it clearly. All information required is in commit and this conversation with Frederic. https://lkml.org/lkml/2014/4/10/355 Suggested-by: Frederic Weisbecker Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 16 1 file changed, 16 insertions(+) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 71f64ee..c3aed50 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -922,6 +922,22 @@ void tick_nohz_idle_exit(void) ts->inidle = 0; + /* +* Can idle_active be false here? +* Ideally this would be the sequence of calls: +* - tick_nohz_idle_enter(), i.e. idle_active = true; +* - local_irq_disable() +* - IDLE +* - wake up due to IPI or other interrupt +* - local_irq_enable() +* - tick_nohz_irq_enter(), i.e. idle_active = false; +* - tick_nohz_irq_exit(), i.e. idle_active = true; This is not called +* in case of IPI's as need_resched() will prevent that in +* tick_irq_exit(), as we don't need to account any more for idle time +* or try to enter dyntics mode (We are going to exit idle state). +* +* - tick_nohz_idle_exit() +*/ if (ts->idle_active || ts->tick_stopped) now = ktime_get(); -- 1.7.12.rc2.18.g61b472e -- 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 06/19] tick: create tick_get_cpu_device() to get tick_cpu_device on this cpu
We are using &__get_cpu_var(tick_cpu_device) at several places and would be better if we create tick_get_cpu_device() and use it instead. This also converts tick_get_device(smp_processor_id()) to use tick_get_cpu_device(). Signed-off-by: Viresh Kumar --- include/linux/tick.h | 5 + kernel/hrtimer.c | 2 +- kernel/time/tick-broadcast.c | 8 kernel/time/tick-common.c| 10 +- kernel/time/tick-oneshot.c | 8 kernel/time/tick-sched.c | 2 +- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 45e1331..98065e5 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -92,6 +92,11 @@ static inline struct tick_device *tick_get_device(int cpu) return &per_cpu(tick_cpu_device, cpu); } +static inline struct tick_device *tick_get_cpu_device(void) +{ + return &__get_cpu_var(tick_cpu_device); +} + # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); extern int tick_program_event(ktime_t expires, int force); diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index d55092c..393f422 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1403,7 +1403,7 @@ static void __hrtimer_peek_ahead_timers(void) if (!hrtimer_hres_active()) return; - td = &__get_cpu_var(tick_cpu_device); + td = tick_get_cpu_device(); if (td && td->evtdev) hrtimer_interrupt(td->evtdev); } diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 6289680..bf289cd 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -235,7 +235,7 @@ int tick_device_uses_broadcast(struct clock_event_device *dev, int cpu) #ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST int tick_receive_broadcast(void) { - struct tick_device *td = this_cpu_ptr(&tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *evt = td->evtdev; if (!evt) @@ -337,7 +337,7 @@ static void tick_do_broadcast_on_off(unsigned long *reason) raw_spin_lock_irqsave(&tick_broadcast_lock, flags); cpu = smp_processor_id(); - td = tick_get_device(cpu); + td = tick_get_cpu_device(); dev = td->evtdev; bc = tick_broadcast_device.evtdev; @@ -550,7 +550,7 @@ int tick_resume_broadcast_oneshot(struct clock_event_device *bc) void tick_check_oneshot_broadcast_this_cpu(void) { if (cpumask_test_cpu(smp_processor_id(), tick_broadcast_oneshot_mask)) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); /* * We might be in the middle of switching over from @@ -700,7 +700,7 @@ int tick_broadcast_oneshot_control(unsigned long reason) * idle code, so we can't be moved away. */ cpu = smp_processor_id(); - td = tick_get_device(cpu); + td = tick_get_cpu_device(); dev = td->evtdev; if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 3f3aa86..1e2c96e 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -58,7 +58,7 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; */ int tick_is_oneshot_available(void) { - struct clock_event_device *dev = __this_cpu_read(tick_cpu_device.evtdev); + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) return 0; @@ -219,7 +219,7 @@ static void tick_setup_device(struct tick_device *td, void tick_install_replacement(struct clock_event_device *newdev) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int cpu = smp_processor_id(); clockevents_exchange_device(td->evtdev, newdev); @@ -291,7 +291,7 @@ void tick_check_new_device(struct clock_event_device *newdev) if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - td = tick_get_device(cpu); + td = tick_get_cpu_device(); curdev = td->evtdev; /* cpu local device ? */ @@ -369,14 +369,14 @@ void tick_shutdown(unsigned int *cpup) void tick_suspend(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); clockevents_shutdown(td->evtdev); } void tick_resume(void) { - struct tick_device *td = &__get_cpu_var(tick_cpu_device); + struct tick_device *td = tick_get_cpu_device(); int broadcast = tick_resume_broadcast(); clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 5fe86a7..7089dea 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/
[PATCH V2 19/19] tick-sched: rearrange code in tick_do_update_jiffies64()
The last two lines of tick_do_update_jiffies64() are only executed when 'delta.tv64 >= tick_period.tv64'. Move them to the 'if' block to make it more clear. Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 77084fa..0647589 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -84,12 +84,12 @@ static void tick_do_update_jiffies64(ktime_t now) /* Keep the tick_next_period variable up to date */ tick_next_period = ktime_add(last_jiffies_update, tick_period); + + write_sequnlock(&jiffies_lock); + update_wall_time(); } else { write_sequnlock(&jiffies_lock); - return; } - write_sequnlock(&jiffies_lock); - update_wall_time(); } /* -- 1.7.12.rc2.18.g61b472e -- 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 17/19] tick-sched: remove local variable 'now' from tick_setup_sched_timer()
Local variable 'now' is used at only one place and so can be replaced by ktime_get() instead. Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 2360e7a..4a94412 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1120,7 +1120,6 @@ early_param("skew_tick", skew_tick); void tick_setup_sched_timer(void) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); - ktime_t now = ktime_get(); /* * Emulate tick processing via per-CPU hrtimers: @@ -1140,13 +1139,12 @@ void tick_setup_sched_timer(void) } for (;;) { - hrtimer_forward(&ts->sched_timer, now, tick_period); + hrtimer_forward(&ts->sched_timer, ktime_get(), tick_period); hrtimer_start_expires(&ts->sched_timer, HRTIMER_MODE_ABS_PINNED); /* Check, if the timer was already in the past */ if (hrtimer_active(&ts->sched_timer)) break; - now = ktime_get(); } #ifdef CONFIG_NO_HZ_COMMON -- 1.7.12.rc2.18.g61b472e -- 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 18/19] tick-sched: invert parameter of tick_check_oneshot_change()
There is only one caller of tick_check_oneshot_change(), i.e. hrtimer_run_pending(). hrtimer_run_pending() calls this routine after doing a logical NOT (!) of its parameter and then tick_check_oneshot_change() also uses its parameter after doing logical NOT (!) of it. It would be more efficient and readable if we can just invert the meaning of this parameter. It is called hres_enabled instead of allow_nohz now. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 6 +++--- kernel/hrtimer.c | 2 +- kernel/time/tick-sched.c | 10 +- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index f538a4d..1065a51 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -120,7 +120,7 @@ extern struct cpumask *tick_get_broadcast_oneshot_mask(void); # ifdef CONFIG_TICK_ONESHOT extern void tick_clock_notify(void); -extern int tick_check_oneshot_change(int allow_nohz); +extern int tick_check_oneshot_change(int hres_enabled); extern struct tick_sched *tick_get_tick_sched(int cpu); extern void tick_irq_enter(void); extern int tick_oneshot_mode_active(void); @@ -129,7 +129,7 @@ extern int tick_oneshot_mode_active(void); # endif # else static inline void tick_clock_notify(void) { } -static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } +static inline int tick_check_oneshot_change(int hres_enabled) { return 0; } static inline void tick_irq_enter(void) { } static inline int tick_oneshot_mode_active(void) { return 0; } # endif @@ -138,7 +138,7 @@ static inline int tick_oneshot_mode_active(void) { return 0; } static inline void tick_init(void) { } static inline void tick_cancel_sched_timer(int cpu) { } static inline void tick_clock_notify(void) { } -static inline int tick_check_oneshot_change(int allow_nohz) { return 0; } +static inline int tick_check_oneshot_change(int hres_enabled) { return 0; } static inline void tick_irq_enter(void) { } static inline int tick_oneshot_mode_active(void) { return 0; } #endif /* !CONFIG_GENERIC_CLOCKEVENTS */ diff --git a/kernel/hrtimer.c b/kernel/hrtimer.c index 393f422..bfa7811 100644 --- a/kernel/hrtimer.c +++ b/kernel/hrtimer.c @@ -1457,7 +1457,7 @@ void hrtimer_run_pending(void) * check bit in the tick_oneshot code, otherwise we might * deadlock vs. xtime_lock. */ - if (tick_check_oneshot_change(!hrtimer_is_hres_enabled())) + if (tick_check_oneshot_change(hrtimer_is_hres_enabled())) hrtimer_switch_to_hres(); } diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 4a94412..77084fa 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -1195,11 +1195,11 @@ void tick_oneshot_notify(void) * Check, if a change happened, which makes oneshot possible. * * Called cyclic from the hrtimer softirq (driven by the timer - * softirq) allow_nohz signals, that we can switch into low-res nohz - * mode, because high resolution timers are disabled (either compile - * or runtime). + * softirq). If hres_enabled is non zero, it means we can't switch into low-res + * nohz mode, because high resolution timers are enabled(either compile or + * runtime). */ -int tick_check_oneshot_change(int allow_nohz) +int tick_check_oneshot_change(int hres_enabled) { struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); @@ -1212,7 +1212,7 @@ int tick_check_oneshot_change(int allow_nohz) if (!timekeeping_valid_for_hres() || !tick_is_oneshot_available()) return 0; - if (!allow_nohz) + if (hres_enabled) return 1; tick_nohz_switch_to_nohz(); -- 1.7.12.rc2.18.g61b472e -- 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 13/19] tick-common: remove local variable 'broadcast' from tick_resume()
'broadcast' is used just once and we can use tick_resume_broadcast() directly instead. Also it changes the code a bit to get rid of extra indentation level which was forcing us to break function calls into two lines. Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 15 +++ 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 85ee9fd..2dc6822 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -350,17 +350,16 @@ void tick_resume(void) { struct tick_device *td = tick_get_cpu_device(); struct clock_event_device *dev = td->evtdev; - int broadcast = tick_resume_broadcast(); clockevents_set_mode(dev, CLOCK_EVT_MODE_RESUME); - if (!broadcast) { - if (td->mode == TICKDEV_MODE_PERIODIC) - tick_setup_periodic(dev, 0); - else - tick_setup_oneshot(dev, dev->event_handler, - ktime_get()); - } + if (tick_resume_broadcast()) + return; + + if (td->mode == TICKDEV_MODE_PERIODIC) + tick_setup_periodic(dev, 0); + else + tick_setup_oneshot(dev, dev->event_handler, ktime_get()); } /** -- 1.7.12.rc2.18.g61b472e -- 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 15/19] tick-sched: define 'delta' inside 'if' block in update_ts_time_stats()
'delta' is used only inside the 'if' block and must be accessible within that. So, move its definition inside the 'if' block. Signed-off-by: Viresh Kumar --- kernel/time/tick-sched.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index c3aed50..8e75c13 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -412,10 +412,9 @@ static void update_ts_time_stats(int cpu, struct tick_sched *ts, ktime_t now, u64 *last_update_time) { - ktime_t delta; - if (ts->idle_active) { - delta = ktime_sub(now, ts->idle_entrytime); + ktime_t delta = ktime_sub(now, ts->idle_entrytime); + if (nr_iowait_cpu(cpu) > 0) ts->iowait_sleeptime = ktime_add(ts->iowait_sleeptime, delta); -- 1.7.12.rc2.18.g61b472e -- 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 11/19] tick-common: remove tick_check_replacement()
tick_check_replacement() is now nothing more than a dummy wrapper over tick_check_preferred() and can be removed. Signed-off-by: Viresh Kumar --- kernel/time/clockevents.c | 2 +- kernel/time/tick-common.c | 16 +--- kernel/time/tick-internal.h | 2 +- 3 files changed, 7 insertions(+), 13 deletions(-) diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index a3e9333..15ff71d 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -298,7 +298,7 @@ static int clockevents_replace(struct clock_event_device *ced) if (dev == ced || dev->mode != CLOCK_EVT_MODE_UNUSED) continue; - if (!tick_check_replacement(newdev, dev)) + if (!tick_check_preferred(newdev, dev)) continue; if (!try_module_get(dev->owner)) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 9d3106b..896c992 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -230,7 +230,11 @@ static bool tick_check_percpu(struct clock_event_device *curdev, return true; } -static bool tick_check_preferred(struct clock_event_device *curdev, +/* + * Check whether the new device is a better fit than curdev. curdev + * can be NULL ! + */ +bool tick_check_preferred(struct clock_event_device *curdev, struct clock_event_device *newdev) { if (!tick_check_percpu(curdev, newdev, smp_processor_id())) @@ -254,16 +258,6 @@ static bool tick_check_preferred(struct clock_event_device *curdev, } /* - * Check whether the new device is a better fit than curdev. curdev - * can be NULL ! - */ -bool tick_check_replacement(struct clock_event_device *curdev, - struct clock_event_device *newdev) -{ - return tick_check_preferred(curdev, newdev); -} - -/* * Check, if the new registered device should be used. Called with * clockevents_lock held and interrupts disabled. */ diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 65f080a..8c6e85d 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -24,7 +24,7 @@ extern void tick_handover_do_timer(int *cpup); extern void tick_shutdown(unsigned int *cpup); extern void tick_suspend(void); extern void tick_resume(void); -extern bool tick_check_replacement(struct clock_event_device *curdev, +extern bool tick_check_preferred(struct clock_event_device *curdev, struct clock_event_device *newdev); extern void tick_install_replacement(struct clock_event_device *dev); -- 1.7.12.rc2.18.g61b472e -- 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 1/2] PCI: designware: Add ARM64 PCI support
On Monday, April 21, 2014 10:54 AM, Jingoo Han wrote: > On Thursday, April 17, 2014 3:26 AM, Arnd Bergmann wrote: > > On Wednesday 16 April 2014 17:57:24 Liviu Dudau wrote: > > > Jingoo, > > > > > > Thanks for taking a stab at trying to convert a host bridge > > > driver to use the new generic host bridge code. > > > > > > I do however have concerns on the direction you took. You have split > > > your driver in two, depending on whether it was CONFIG_ARM or > > > CONFIG_ARM64, > > > even if (with my series) it should be no reason why the host bridge > > > driver should not work on other architectures as well once they are > > > converted. > > > > Right. > > > > > Also, some of the functions that you use have identical names but > > > different > > > signatures depending on what arch you have selected. This is really bad > > > in my books! [.] > > > What about creating functions that use my series directly if CONFIG_ARM64 > > > is > > > defined (or any CONFIG_ you want to create for your driver that you select > > > from CONFIG_ARM64) and otherwise implement the CONFIG_ARM version? That > > > way your driver will call only one API without any #ifdef and when arm > > > code > > > gets converted you drop your adaptation functions. Or (better yet), have a > > > stab at converting bios32 (Rob Herring has already provided some hints on > > > how to do it for arch/arm). > > To: Liviu Dudau > > Sorry, but I will not implement this. > At first, you had to think the compatibility with ARM32 PCIe. > Why do you want other engineers to take this load? (+cc Rob Herring) Um, I am looking at Rob Herring's patchset for Versatile PCI. [1] Then, do you mean the following? 1. Add Rob Herring's patch converting bios32. [2] 2. Reference Rob Herring's patch in order to know how to handle "of_create_pci_host_bridge()" directly in ARM32. [3] 3. Use of_create_pci_host_bridge() for the designware PCIe driver in ARM32. 4. Also, use of_create_pci_host_bridge() for the designware PCIe driver in "ARM64". [1] http://www.spinics.net/lists/linux-pci/msg30084.html [2] http://www.spinics.net/lists/linux-pci/msg30083.html [3] http://www.spinics.net/lists/linux-pci/msg30086.html Best regards, Jingoo Han > > > > > That would of course be best. > > [.] -- 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 05/19] tick: move definition of tick_get_device() to tick.h
There are multiple users of tick_get_device() which are currently using &per_cpu(tick_cpu_device, cpu) directly. Would be better if we use tick_get_device() consistently. Move definition of tick_get_device() to tick.h and update others to use it. This change reduced size of bzImage for x86 by 96 bytes. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 5 - kernel/time/clockevents.c| 6 +++--- kernel/time/tick-broadcast.c | 12 ++-- kernel/time/tick-common.c| 9 ++--- 4 files changed, 15 insertions(+), 17 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 1a9908a..45e1331 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -87,7 +87,10 @@ extern void __init tick_init(void); extern int tick_is_oneshot_available(void); DECLARE_PER_CPU(struct tick_device, tick_cpu_device); -extern struct tick_device *tick_get_device(int cpu); +static inline struct tick_device *tick_get_device(int cpu) +{ + return &per_cpu(tick_cpu_device, cpu); +} # ifdef CONFIG_HIGH_RES_TIMERS extern int tick_init_highres(void); diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index 2ba812bc..a3e9333 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -326,7 +326,7 @@ static int __clockevents_try_unbind(struct clock_event_device *ced, int cpu) return 0; } - return ced == per_cpu(tick_cpu_device, cpu).evtdev ? -EAGAIN : -EBUSY; + return ced == tick_get_device(cpu)->evtdev ? -EAGAIN : -EBUSY; } /* @@ -675,7 +675,7 @@ static struct device tick_bc_dev = { static struct tick_device *tick_get_tick_dev(struct device *dev) { return dev == &tick_bc_dev ? tick_get_broadcast_device() : - &per_cpu(tick_cpu_device, dev->id); + tick_get_device(dev->id); } static __init int tick_broadcast_init_sysfs(void) @@ -689,7 +689,7 @@ static __init int tick_broadcast_init_sysfs(void) #else static struct tick_device *tick_get_tick_dev(struct device *dev) { - return &per_cpu(tick_cpu_device, dev->id); + return tick_get_device(dev->id); } static inline int tick_broadcast_init_sysfs(void) { return 0; } #endif diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index b1c7b21..6289680 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -262,7 +262,7 @@ static void tick_do_broadcast(struct cpumask *mask) */ if (cpumask_test_cpu(cpu, mask)) { cpumask_clear_cpu(cpu, mask); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); td->evtdev->event_handler(td->evtdev); } @@ -273,7 +273,7 @@ static void tick_do_broadcast(struct cpumask *mask) * one of the first device. This works as long as we have this * misfeature only on x86 (lapic) */ - td = &per_cpu(tick_cpu_device, cpumask_first(mask)); + td = tick_get_device(cpumask_first(mask)); td->evtdev->broadcast(mask); } } @@ -337,7 +337,7 @@ static void tick_do_broadcast_on_off(unsigned long *reason) raw_spin_lock_irqsave(&tick_broadcast_lock, flags); cpu = smp_processor_id(); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); dev = td->evtdev; bc = tick_broadcast_device.evtdev; @@ -581,7 +581,7 @@ again: now = ktime_get(); /* Find all expired events */ for_each_cpu(cpu, tick_broadcast_oneshot_mask) { - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); if (td->evtdev->next_event.tv64 <= now.tv64) { cpumask_set_cpu(cpu, tmpmask); /* @@ -700,7 +700,7 @@ int tick_broadcast_oneshot_control(unsigned long reason) * idle code, so we can't be moved away. */ cpu = smp_processor_id(); - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); dev = td->evtdev; if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) @@ -824,7 +824,7 @@ static void tick_broadcast_init_next_event(struct cpumask *mask, int cpu; for_each_cpu(cpu, mask) { - td = &per_cpu(tick_cpu_device, cpu); + td = tick_get_device(cpu); if (td->evtdev) td->evtdev->next_event = expires; } diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 0a0608e..3f3aa86 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -53,11 +53,6 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; /* * Debugging: see timer_list.c */ -struct tick_device *tick_get_device(int cpu) -{ - return &per_cpu(tick_cpu_device, cpu); -} - /** * tick_is_oneshot_available - check for a oneshot capable event device */ @@ -296,7 +291,7
[PATCH V2 10/19] tick-common: call tick_check_percpu() from tick_check_preferred()
tick_check_percpu() and tick_check_preferred() are called from two places and in exactly same order. So, would make sense to call tick_check_percpu() from tick_check_preferred() instead, so that their caller can just call tick_check_preferred(). Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 10 +++--- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 965e9c3..9d3106b 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -233,6 +233,9 @@ static bool tick_check_percpu(struct clock_event_device *curdev, static bool tick_check_preferred(struct clock_event_device *curdev, struct clock_event_device *newdev) { + if (!tick_check_percpu(curdev, newdev, smp_processor_id())) + return false; + /* Prefer oneshot capable device */ if (!(newdev->features & CLOCK_EVT_FEAT_ONESHOT)) { if (curdev && (curdev->features & CLOCK_EVT_FEAT_ONESHOT)) @@ -257,9 +260,6 @@ static bool tick_check_preferred(struct clock_event_device *curdev, bool tick_check_replacement(struct clock_event_device *curdev, struct clock_event_device *newdev) { - if (!tick_check_percpu(curdev, newdev, smp_processor_id())) - return false; - return tick_check_preferred(curdev, newdev); } @@ -276,10 +276,6 @@ void tick_check_new_device(struct clock_event_device *newdev) if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - /* cpu local device ? */ - if (!tick_check_percpu(curdev, newdev, cpu)) - goto out_bc; - /* Preference decision */ if (!tick_check_preferred(curdev, newdev)) goto out_bc; -- 1.7.12.rc2.18.g61b472e -- 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 04/19] tick: move declaration of 'tick_cpu_device' to tick.h
'tick_cpu_device' isn't local to kernel/time/ directory as it is declared in hrtimer.h as well. Move its declaration to tick.h. Signed-off-by: Viresh Kumar --- include/linux/hrtimer.h | 3 --- include/linux/tick.h| 2 ++ kernel/time/tick-internal.h | 1 - 3 files changed, 2 insertions(+), 4 deletions(-) diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index e7a8d3f..a31f83e 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h @@ -332,9 +332,6 @@ extern ktime_t ktime_get_clocktai(void); extern ktime_t ktime_get_update_offsets(ktime_t *offs_real, ktime_t *offs_boot, ktime_t *offs_tai); -DECLARE_PER_CPU(struct tick_device, tick_cpu_device); - - /* Exported timer functions: */ /* Initialize timers: */ diff --git a/include/linux/tick.h b/include/linux/tick.h index edabc7d..1a9908a 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -85,6 +85,8 @@ struct tick_sched { extern void __init tick_init(void); extern int tick_is_oneshot_available(void); + +DECLARE_PER_CPU(struct tick_device, tick_cpu_device); extern struct tick_device *tick_get_device(int cpu); # ifdef CONFIG_HIGH_RES_TIMERS diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 855c513..57c1a76 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -13,7 +13,6 @@ extern seqlock_t jiffies_lock; #define TICK_DO_TIMER_NONE -1 #define TICK_DO_TIMER_BOOT -2 -DECLARE_PER_CPU(struct tick_device, tick_cpu_device); extern ktime_t tick_next_period; extern ktime_t tick_period; extern int tick_do_timer_cpu __read_mostly; -- 1.7.12.rc2.18.g61b472e -- 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 03/19] tick: rearrange members of 'struct tick_sched'
Rearrange members of 'struct tick_sched' to make it more readable. i.e. By keeping all ktime_t members together, similarly 'unsigned long' and 'int' as well. I couldn't figure out breaking any logical blocks here which we wanted to keep together. Change in footprints of this structure: For x86: size reduced to 232 from 240 bytes For ARM: no change Signed-off-by: Viresh Kumar --- include/linux/tick.h | 34 +- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 8cc804c..edabc7d 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -35,19 +35,17 @@ enum tick_nohz_mode { * struct tick_sched - sched tick emulation and no idle tick control/stats * @sched_timer: hrtimer to schedule the periodic tick in high * resolution mode - * @check_clocks: tracks if clockevent device is recently changed * @nohz_mode: Current NOHZ mode + * @check_clocks: tracks if clockevent device is recently changed + * @idle_jiffies: jiffies at the entry to idle for idle time accounting + * @idle_calls:Total number of idle calls + * @idle_sleeps: Number of idle calls, where the sched tick was stopped + * @last_jiffies: Last updated value of jiffies + * @next_jiffies: Next jiffie for which timer is requested * @last_tick: Store the last tick expiry time when the tick * timer is modified for nohz sleeps. This is necessary * to resume the tick timer operation in the timeline * when the CPU returns from nohz sleep. - * @inidle:CPU is currently executing from within the idle loop - * @tick_stopped: Indicator that the idle tick has been stopped - * @idle_jiffies: jiffies at the entry to idle for idle time accounting - * @idle_calls:Total number of idle calls - * @idle_sleeps: Number of idle calls, where the sched tick was stopped - * @idle_active: similar to inidle, but is reset when we get an interrupt - * while being in idle * @idle_entrytime:Time when the idle call was entered * @idle_waketime: Time when the idle was interrupted * @idle_exittime: Time when the idle state was left @@ -55,31 +53,33 @@ enum tick_nohz_mode { * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, * with IO outstanding * @sleep_length: Duration of the current idle sleep - * @last_jiffies: Last updated value of jiffies - * @next_jiffies: Next jiffie for which timer is requested * @idle_expires: Time when we should come out of idle or next timer event + * @inidle:CPU is currently executing from within the idle loop + * @idle_active: similar to inidle, but is reset when we get an interrupt + * while being in idle + * @tick_stopped: Indicator that the idle tick has been stopped * @do_timer_last: CPU was the last one doing do_timer before going idle */ struct tick_sched { struct hrtimer sched_timer; - unsigned long check_clocks; enum tick_nohz_mode nohz_mode; - ktime_t last_tick; - int inidle; - int tick_stopped; + unsigned long check_clocks; unsigned long idle_jiffies; unsigned long idle_calls; unsigned long idle_sleeps; - int idle_active; + unsigned long last_jiffies; + unsigned long next_jiffies; + ktime_t last_tick; ktime_t idle_entrytime; ktime_t idle_waketime; ktime_t idle_exittime; ktime_t idle_sleeptime; ktime_t iowait_sleeptime; ktime_t sleep_length; - unsigned long last_jiffies; - unsigned long next_jiffies; ktime_t idle_expires; + int inidle; + int idle_active; + int tick_stopped; int do_timer_last; }; -- 1.7.12.rc2.18.g61b472e -- 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 09/19] tick-oneshot: remove tick_resume_oneshot()
tick_resume_oneshot() and tick_setup_oneshot() have almost same implementation. So, we can remove tick_resume_oneshot() and use tick_setup_oneshot() in its place. Signed-off-by: Viresh Kumar --- kernel/time/tick-common.c | 8 +--- kernel/time/tick-internal.h | 5 - kernel/time/tick-oneshot.c | 11 --- 3 files changed, 5 insertions(+), 19 deletions(-) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 64897d3..965e9c3 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -359,15 +359,17 @@ void tick_suspend(void) void tick_resume(void) { struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *dev = td->evtdev; int broadcast = tick_resume_broadcast(); - clockevents_set_mode(td->evtdev, CLOCK_EVT_MODE_RESUME); + clockevents_set_mode(dev, CLOCK_EVT_MODE_RESUME); if (!broadcast) { if (td->mode == TICKDEV_MODE_PERIODIC) - tick_setup_periodic(td->evtdev, 0); + tick_setup_periodic(dev, 0); else - tick_resume_oneshot(); + tick_setup_oneshot(dev, dev->event_handler, + ktime_get()); } } diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 09f4307..65f080a 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -43,7 +43,6 @@ extern int tick_program_event(ktime_t expires, int force); extern void tick_oneshot_notify(void); extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); extern int tick_is_oneshot_available(void); -extern void tick_resume_oneshot(void); # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); extern int tick_broadcast_oneshot_control(unsigned long reason); @@ -74,10 +73,6 @@ void tick_setup_oneshot(struct clock_event_device *newdev, { BUG(); } -static inline void tick_resume_oneshot(void) -{ - BUG(); -} static inline int tick_program_event(ktime_t expires, int force) { return 0; diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index aaf60a9..a07fc3d 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c @@ -32,17 +32,6 @@ int tick_program_event(ktime_t expires, int force) } /** - * tick_resume_onshot - resume oneshot mode - */ -void tick_resume_oneshot(void) -{ - struct clock_event_device *dev = tick_get_cpu_device()->evtdev; - - clockevents_set_mode(dev, CLOCK_EVT_MODE_ONESHOT); - clockevents_program_event(dev, ktime_get(), true); -} - -/** * tick_setup_oneshot - setup the event device for oneshot mode (hres or nohz) */ void tick_setup_oneshot(struct clock_event_device *newdev, -- 1.7.12.rc2.18.g61b472e -- 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 02/19] tick: update doc style comments for 'struct tick_sched'
Some fields of 'struct tick_sched' didn't have a description in the kernel doc style comment present above its declaration. Add them. Signed-off-by: Viresh Kumar --- include/linux/tick.h | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 8c865fb..8cc804c 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -35,14 +35,19 @@ enum tick_nohz_mode { * struct tick_sched - sched tick emulation and no idle tick control/stats * @sched_timer: hrtimer to schedule the periodic tick in high * resolution mode + * @check_clocks: tracks if clockevent device is recently changed + * @nohz_mode: Current NOHZ mode * @last_tick: Store the last tick expiry time when the tick * timer is modified for nohz sleeps. This is necessary * to resume the tick timer operation in the timeline * when the CPU returns from nohz sleep. + * @inidle:CPU is currently executing from within the idle loop * @tick_stopped: Indicator that the idle tick has been stopped * @idle_jiffies: jiffies at the entry to idle for idle time accounting * @idle_calls:Total number of idle calls * @idle_sleeps: Number of idle calls, where the sched tick was stopped + * @idle_active: similar to inidle, but is reset when we get an interrupt + * while being in idle * @idle_entrytime:Time when the idle call was entered * @idle_waketime: Time when the idle was interrupted * @idle_exittime: Time when the idle state was left @@ -50,7 +55,10 @@ enum tick_nohz_mode { * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, * with IO outstanding * @sleep_length: Duration of the current idle sleep - * @do_timer_lst: CPU was the last one doing do_timer before going idle + * @last_jiffies: Last updated value of jiffies + * @next_jiffies: Next jiffie for which timer is requested + * @idle_expires: Time when we should come out of idle or next timer event + * @do_timer_last: CPU was the last one doing do_timer before going idle */ struct tick_sched { struct hrtimer sched_timer; -- 1.7.12.rc2.18.g61b472e -- 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 01/19] tick: trivial cleanups
This does some trivial fixups: - break lines longer than 80 columns - merge few lines together - don't break print messages even if they cross 80 columns - remove extra whitespaces and blank lines - replace printk() with pr_*() Signed-off-by: Viresh Kumar --- include/linux/tick.h | 3 ++- kernel/time/clockevents.c| 4 ++-- kernel/time/clocksource.c| 14 +- kernel/time/tick-broadcast.c | 16 ++-- kernel/time/tick-internal.h | 5 - kernel/time/tick-oneshot.c | 3 +-- kernel/time/tick-sched.c | 29 - kernel/time/timekeeping.c| 10 -- 8 files changed, 40 insertions(+), 44 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index b84773c..8c865fb 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -47,7 +47,8 @@ enum tick_nohz_mode { * @idle_waketime: Time when the idle was interrupted * @idle_exittime: Time when the idle state was left * @idle_sleeptime:Sum of the time slept in idle with sched tick stopped - * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, with IO outstanding + * @iowait_sleeptime: Sum of the time slept in idle with sched tick stopped, + * with IO outstanding * @sleep_length: Duration of the current idle sleep * @do_timer_lst: CPU was the last one doing do_timer before going idle */ diff --git a/kernel/time/clockevents.c b/kernel/time/clockevents.c index ad362c2..2ba812bc 100644 --- a/kernel/time/clockevents.c +++ b/kernel/time/clockevents.c @@ -146,7 +146,7 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev) { /* Nothing to do if we already reached the limit */ if (dev->min_delta_ns >= MIN_DELTA_LIMIT) { - printk(KERN_WARNING "CE: Reprogramming failure. Giving up\n"); + pr_warn("CE: Reprogramming failure. Giving up\n"); dev->next_event.tv64 = KTIME_MAX; return -ETIME; } @@ -159,7 +159,7 @@ static int clockevents_increase_min_delta(struct clock_event_device *dev) if (dev->min_delta_ns > MIN_DELTA_LIMIT) dev->min_delta_ns = MIN_DELTA_LIMIT; - printk(KERN_WARNING "CE: %s increased min_delta_ns to %llu nsec\n", + pr_warn("CE: %s increased min_delta_ns to %llu nsec\n", dev->name ? dev->name : "?", (unsigned long long) dev->min_delta_ns); return 0; diff --git a/kernel/time/clocksource.c b/kernel/time/clocksource.c index ba3e502..6ef39af 100644 --- a/kernel/time/clocksource.c +++ b/kernel/time/clocksource.c @@ -219,8 +219,7 @@ static void __clocksource_unstable(struct clocksource *cs) static void clocksource_unstable(struct clocksource *cs, int64_t delta) { - printk(KERN_WARNING "Clocksource %s unstable (delta = %Ld ns)\n", - cs->name, delta); + pr_warn("Clocksource %s unstable (delta = %Ld ns)\n", cs->name, delta); __clocksource_unstable(cs); } @@ -643,9 +642,8 @@ static void __clocksource_select(bool skipcur) */ if (!(cs->flags & CLOCK_SOURCE_VALID_FOR_HRES) && oneshot) { /* Override clocksource cannot be used. */ - printk(KERN_WARNING "Override clocksource %s is not " - "HRT compatible. Cannot switch while in " - "HRT/NOHZ mode\n", cs->name); + pr_warn("Override clocksource %s is not HRT compatible. Cannot switch while in HRT/NOHZ mode\n", + cs->name); override_name[0] = 0; } else /* Override clocksource can be used. */ @@ -1095,12 +1093,10 @@ __setup("clocksource=", boot_override_clocksource); static int __init boot_override_clock(char* str) { if (!strcmp(str, "pmtmr")) { - printk("Warning: clock=pmtmr is deprecated. " - "Use clocksource=acpi_pm.\n"); + printk("Warning: clock=pmtmr is deprecated. Use clocksource=acpi_pm.\n"); return boot_override_clocksource("acpi_pm"); } - printk("Warning! clock= boot option is deprecated. " - "Use clocksource=xyz\n"); + printk("Warning! clock= boot option is deprecated. Use clocksource=xyz\n"); return boot_override_clocksource(str); } diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index 64c5990..b1c7b21 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -132,7 +132,6 @@ int tick_broadcast_update_freq(struct clock_event_device *dev, u32 freq) return ret; } - static void err_broadcast(const struct cpumask *mask) { pr_crit_once("Failed to broadcast timer tick. Some CPUs may be unresponsive.\n"); @@ -358,8 +357,7 @@ static void tick_do_broadcast_on_off(unsigned long *reason) ca
[PATCH V2 08/19] tick-oneshot: move tick_is_oneshot_available() to tick-oneshot.c
This is tick-oneshot specific routine and hence must be defined in tick-oneshot.c. Also, as it isn't used outside kernel/time/, move its declaration to tick-internal.h. Signed-off-by: Viresh Kumar --- include/linux/tick.h| 1 - kernel/time/tick-common.c | 14 -- kernel/time/tick-internal.h | 2 ++ kernel/time/tick-oneshot.c | 14 ++ 4 files changed, 16 insertions(+), 15 deletions(-) diff --git a/include/linux/tick.h b/include/linux/tick.h index 98065e5..b8ee6f4 100644 --- a/include/linux/tick.h +++ b/include/linux/tick.h @@ -84,7 +84,6 @@ struct tick_sched { }; extern void __init tick_init(void); -extern int tick_is_oneshot_available(void); DECLARE_PER_CPU(struct tick_device, tick_cpu_device); static inline struct tick_device *tick_get_device(int cpu) diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 4d45e08..64897d3 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -53,20 +53,6 @@ int tick_do_timer_cpu __read_mostly = TICK_DO_TIMER_BOOT; /* * Debugging: see timer_list.c */ -/** - * tick_is_oneshot_available - check for a oneshot capable event device - */ -int tick_is_oneshot_available(void) -{ - struct clock_event_device *dev = tick_get_cpu_device()->evtdev; - - if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) - return 0; - if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) - return 1; - return tick_broadcast_oneshot_available(); -} - /* * Periodic tick */ diff --git a/kernel/time/tick-internal.h b/kernel/time/tick-internal.h index 57c1a76..09f4307 100644 --- a/kernel/time/tick-internal.h +++ b/kernel/time/tick-internal.h @@ -42,6 +42,7 @@ extern void tick_setup_oneshot(struct clock_event_device *newdev, extern int tick_program_event(ktime_t expires, int force); extern void tick_oneshot_notify(void); extern int tick_switch_to_oneshot(void (*handler)(struct clock_event_device *)); +extern int tick_is_oneshot_available(void); extern void tick_resume_oneshot(void); # ifdef CONFIG_GENERIC_CLOCKEVENTS_BROADCAST extern void tick_broadcast_setup_oneshot(struct clock_event_device *bc); @@ -96,6 +97,7 @@ static inline int tick_resume_broadcast_oneshot(struct clock_event_device *bc) return 0; } static inline int tick_broadcast_oneshot_active(void) { return 0; } +static inline int tick_is_oneshot_available(void) { return 0; }; static inline bool tick_broadcast_oneshot_available(void) { return false; } #endif /* !TICK_ONESHOT */ diff --git a/kernel/time/tick-oneshot.c b/kernel/time/tick-oneshot.c index 7089dea..aaf60a9 100644 --- a/kernel/time/tick-oneshot.c +++ b/kernel/time/tick-oneshot.c @@ -102,6 +102,20 @@ int tick_oneshot_mode_active(void) return ret; } +/** + * tick_is_oneshot_available - check for a oneshot capable event device + */ +int tick_is_oneshot_available(void) +{ + struct clock_event_device *dev = tick_get_cpu_device()->evtdev; + + if (!dev || !(dev->features & CLOCK_EVT_FEAT_ONESHOT)) + return 0; + if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) + return 1; + return tick_broadcast_oneshot_available(); +} + #ifdef CONFIG_HIGH_RES_TIMERS /** * tick_init_highres - switch to high resolution mode -- 1.7.12.rc2.18.g61b472e -- 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 07/19] tick: initialize variables during their definitions
We don't have to assign values to variables in separate lines when we can do that during their initialization. Move assignments of few variables to their definitions. This makes code smaller and more readable. Signed-off-by: Viresh Kumar --- kernel/time/tick-broadcast.c | 20 ++-- kernel/time/tick-common.c| 10 +++--- kernel/time/tick-sched.c | 6 ++ 3 files changed, 11 insertions(+), 25 deletions(-) diff --git a/kernel/time/tick-broadcast.c b/kernel/time/tick-broadcast.c index bf289cd..7802020 100644 --- a/kernel/time/tick-broadcast.c +++ b/kernel/time/tick-broadcast.c @@ -329,16 +329,12 @@ unlock: */ static void tick_do_broadcast_on_off(unsigned long *reason) { - struct clock_event_device *bc, *dev; - struct tick_device *td; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *bc, *dev = td->evtdev; + int cpu = smp_processor_id(), bc_stopped; unsigned long flags; - int cpu, bc_stopped; raw_spin_lock_irqsave(&tick_broadcast_lock, flags); - - cpu = smp_processor_id(); - td = tick_get_cpu_device(); - dev = td->evtdev; bc = tick_broadcast_device.evtdev; /* @@ -682,11 +678,11 @@ static void broadcast_move_bc(int deadcpu) */ int tick_broadcast_oneshot_control(unsigned long reason) { - struct clock_event_device *bc, *dev; - struct tick_device *td; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *bc, *dev = td->evtdev; + int cpu = smp_processor_id(), ret = 0; unsigned long flags; ktime_t now; - int cpu, ret = 0; /* * Periodic mode does not care about the enter/exit of power @@ -699,10 +695,6 @@ int tick_broadcast_oneshot_control(unsigned long reason) * We are called with preemtion disabled from the depth of the * idle code, so we can't be moved away. */ - cpu = smp_processor_id(); - td = tick_get_cpu_device(); - dev = td->evtdev; - if (!(dev->features & CLOCK_EVT_FEAT_C3STOP)) return 0; diff --git a/kernel/time/tick-common.c b/kernel/time/tick-common.c index 1e2c96e..4d45e08 100644 --- a/kernel/time/tick-common.c +++ b/kernel/time/tick-common.c @@ -283,17 +283,13 @@ bool tick_check_replacement(struct clock_event_device *curdev, */ void tick_check_new_device(struct clock_event_device *newdev) { - struct clock_event_device *curdev; - struct tick_device *td; - int cpu; + struct tick_device *td = tick_get_cpu_device(); + struct clock_event_device *curdev = td->evtdev; + int cpu = smp_processor_id(); - cpu = smp_processor_id(); if (!cpumask_test_cpu(cpu, newdev->cpumask)) goto out_bc; - td = tick_get_cpu_device(); - curdev = td->evtdev; - /* cpu local device ? */ if (!tick_check_percpu(curdev, newdev, cpu)) goto out_bc; diff --git a/kernel/time/tick-sched.c b/kernel/time/tick-sched.c index 5f27c71..71f64ee 100644 --- a/kernel/time/tick-sched.c +++ b/kernel/time/tick-sched.c @@ -277,7 +277,7 @@ out: /* Parse the boot-time nohz CPU list from the kernel parameters. */ static int __init tick_nohz_full_setup(char *str) { - int cpu; + int cpu = smp_processor_id(); alloc_bootmem_cpumask_var(&tick_nohz_full_mask); if (cpulist_parse(str, tick_nohz_full_mask) < 0) { @@ -285,7 +285,6 @@ static int __init tick_nohz_full_setup(char *str) return 1; } - cpu = smp_processor_id(); if (cpumask_test_cpu(cpu, tick_nohz_full_mask)) { pr_warning("NO_HZ: Clearing %d from nohz_full range for timekeeping\n", cpu); @@ -790,7 +789,7 @@ static void __tick_nohz_idle_enter(struct tick_sched *ts) */ void tick_nohz_idle_enter(void) { - struct tick_sched *ts; + struct tick_sched *ts = &__get_cpu_var(tick_cpu_sched); WARN_ON_ONCE(irqs_disabled()); @@ -804,7 +803,6 @@ void tick_nohz_idle_enter(void) local_irq_disable(); - ts = &__get_cpu_var(tick_cpu_sched); ts->inidle = 1; __tick_nohz_idle_enter(ts); -- 1.7.12.rc2.18.g61b472e -- 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] xfs: Fix wrong error codes being returned
xfs_{compat_,}attrmulti_by_handle could return an errno with incorrect sign in some cases. While at it, make sure ENOMEM is returned instead of E2BIG if kmalloc fails. Signed-off-by: Tuomas Tynkkynen --- Compile tested only. For the ERANGE case, I also wonder if it should be assigning to ops[i].am_error instead of error, and/or have a break. fs/xfs/xfs_ioctl.c |5 +++-- fs/xfs/xfs_ioctl32.c |5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/xfs/xfs_ioctl.c b/fs/xfs/xfs_ioctl.c index 0b18776..2d8f4fd 100644 --- a/fs/xfs/xfs_ioctl.c +++ b/fs/xfs/xfs_ioctl.c @@ -543,10 +543,11 @@ xfs_attrmulti_by_handle( ops = memdup_user(am_hreq.ops, size); if (IS_ERR(ops)) { - error = PTR_ERR(ops); + error = -PTR_ERR(ops); goto out_dput; } + error = ENOMEM; attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); if (!attr_name) goto out_kfree_ops; @@ -556,7 +557,7 @@ xfs_attrmulti_by_handle( ops[i].am_error = strncpy_from_user((char *)attr_name, ops[i].am_attrname, MAXNAMELEN); if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) - error = -ERANGE; + error = ERANGE; if (ops[i].am_error < 0) break; diff --git a/fs/xfs/xfs_ioctl32.c b/fs/xfs/xfs_ioctl32.c index a7992f8..944d5ba 100644 --- a/fs/xfs/xfs_ioctl32.c +++ b/fs/xfs/xfs_ioctl32.c @@ -424,10 +424,11 @@ xfs_compat_attrmulti_by_handle( ops = memdup_user(compat_ptr(am_hreq.ops), size); if (IS_ERR(ops)) { - error = PTR_ERR(ops); + error = -PTR_ERR(ops); goto out_dput; } + error = ENOMEM; attr_name = kmalloc(MAXNAMELEN, GFP_KERNEL); if (!attr_name) goto out_kfree_ops; @@ -438,7 +439,7 @@ xfs_compat_attrmulti_by_handle( compat_ptr(ops[i].am_attrname), MAXNAMELEN); if (ops[i].am_error == 0 || ops[i].am_error == MAXNAMELEN) - error = -ERANGE; + error = ERANGE; if (ops[i].am_error < 0) break; -- 1.7.9.5 -- 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/
[PATCHv4 5/8] extcon: max77693: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo Reviewed-by: Krzysztof Kozlowski --- drivers/extcon/extcon-max77693.c |7 ++- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/extcon/extcon-max77693.c b/drivers/extcon/extcon-max77693.c index 39cd095..f0f18e2 100644 --- a/drivers/extcon/extcon-max77693.c +++ b/drivers/extcon/extcon-max77693.c @@ -1185,7 +1185,7 @@ static int max77693_muic_probe(struct platform_device *pdev) info->edev->name = DEV_NAME; info->edev->dev.parent = &pdev->dev; info->edev->supported_cable = max77693_extcon_cable; - ret = extcon_dev_register(info->edev); + ret = devm_extcon_dev_register(&pdev->dev, info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); goto err_irq; @@ -1267,7 +1267,7 @@ static int max77693_muic_probe(struct platform_device *pdev) MAX77693_MUIC_REG_ID, &id); if (ret < 0) { dev_err(&pdev->dev, "failed to read revision number\n"); - goto err_extcon; + goto err_irq; } dev_info(info->dev, "device ID : 0x%x\n", id); @@ -1288,8 +1288,6 @@ static int max77693_muic_probe(struct platform_device *pdev) return ret; -err_extcon: - extcon_dev_unregister(info->edev); err_irq: while (--i >= 0) free_irq(muic_irqs[i].virq, info); @@ -1305,7 +1303,6 @@ static int max77693_muic_remove(struct platform_device *pdev) free_irq(muic_irqs[i].virq, info); cancel_work_sync(&info->irq_work); input_unregister_device(info->dock); - extcon_dev_unregister(info->edev); return 0; } -- 1.7.9.5 -- 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/
[PATCHv4 0/8] Resource-managed extcon device register function
These patches add resource-managed extcon device register functions for developers' convenience and apply them to related device driver files. This work can make the code more tidy since extcon device is automatically unregistered on driver detach so tiresome managing codes could be removed. Changelog v4: * fix the memory leak bug becuase of single pointer * clean up the unnecessary code and make proper indentation v3: * send the right version instead of previous v1 * add the credit for reviewers according to the review rules v2: * modify and clean up all unnecessary code reported by Chanwoo * fix the bug reported by Seung-Woo * add the credit for reviewers v1: * initial version Sangjung Woo (8): extcon: Add resource-managed extcon register function extcon: adc-jack: Use devm_extcon_dev_register() extcon: gpio: Use devm_extcon_dev_register() extcon: max14577: Use devm_extcon_dev_register() extcon: max77693: Use devm_extcon_dev_register() extcon: max8997: Use devm_extcon_dev_register() extcon: palmas: Use devm_extcon_dev_register() extcon: arizona: Use devm_extcon_dev_register() drivers/extcon/extcon-adc-jack.c | 30 ++ drivers/extcon/extcon-arizona.c | 12 +++ drivers/extcon/extcon-class.c| 64 ++ drivers/extcon/extcon-gpio.c | 16 +++--- drivers/extcon/extcon-max14577.c |9 ++ drivers/extcon/extcon-max77693.c |7 ++--- drivers/extcon/extcon-max8997.c |4 +-- drivers/extcon/extcon-palmas.c | 15 +++-- include/linux/extcon.h | 17 ++ 9 files changed, 108 insertions(+), 66 deletions(-) -- 1.7.9.5 -- 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/
[PATCHv4 8/8] extcon: arizona: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo --- drivers/extcon/extcon-arizona.c | 12 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/drivers/extcon/extcon-arizona.c b/drivers/extcon/extcon-arizona.c index 98a14f6..f63fa6f 100644 --- a/drivers/extcon/extcon-arizona.c +++ b/drivers/extcon/extcon-arizona.c @@ -1105,15 +1105,14 @@ static int arizona_extcon_probe(struct platform_device *pdev) info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL); if (!info) { dev_err(&pdev->dev, "Failed to allocate memory\n"); - ret = -ENOMEM; - goto err; + return -ENOMEM; } info->micvdd = devm_regulator_get(arizona->dev, "MICVDD"); if (IS_ERR(info->micvdd)) { ret = PTR_ERR(info->micvdd); dev_err(arizona->dev, "Failed to get MICVDD: %d\n", ret); - goto err; + return ret; } mutex_init(&info->lock); @@ -1155,11 +1154,11 @@ static int arizona_extcon_probe(struct platform_device *pdev) info->edev.dev.parent = arizona->dev; info->edev.supported_cable = arizona_cable; - ret = extcon_dev_register(&info->edev); + ret = devm_extcon_dev_register(&pdev->dev, &info->edev); if (ret < 0) { dev_err(arizona->dev, "extcon_dev_register() failed: %d\n", ret); - goto err; + return ret; } info->input = devm_input_allocate_device(&pdev->dev); @@ -1410,8 +1409,6 @@ err_rise: err_input: err_register: pm_runtime_disable(&pdev->dev); - extcon_dev_unregister(&info->edev); -err: return ret; } @@ -1445,7 +1442,6 @@ static int arizona_extcon_remove(struct platform_device *pdev) regmap_update_bits(arizona->regmap, ARIZONA_JACK_DETECT_ANALOGUE, ARIZONA_JD1_ENA, 0); arizona_clk32k_disable(arizona); - extcon_dev_unregister(&info->edev); return 0; } -- 1.7.9.5 -- 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/
[PATCHv4 4/8] extcon: max14577: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo Reviewed-by: Krzysztof Kozlowski --- drivers/extcon/extcon-max14577.c |9 ++--- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/drivers/extcon/extcon-max14577.c b/drivers/extcon/extcon-max14577.c index 1fef08d..c6166e7 100644 --- a/drivers/extcon/extcon-max14577.c +++ b/drivers/extcon/extcon-max14577.c @@ -675,7 +675,7 @@ static int max14577_muic_probe(struct platform_device *pdev) } info->edev->name = DEV_NAME; info->edev->supported_cable = max14577_extcon_cable; - ret = extcon_dev_register(info->edev); + ret = devm_extcon_dev_register(&pdev->dev, info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); return ret; @@ -694,7 +694,7 @@ static int max14577_muic_probe(struct platform_device *pdev) MAX14577_REG_DEVICEID, &id); if (ret < 0) { dev_err(&pdev->dev, "failed to read revision number\n"); - goto err_extcon; + return ret; } dev_info(info->dev, "device ID : 0x%x\n", id); @@ -714,10 +714,6 @@ static int max14577_muic_probe(struct platform_device *pdev) delay_jiffies); return ret; - -err_extcon: - extcon_dev_unregister(info->edev); - return ret; } static int max14577_muic_remove(struct platform_device *pdev) @@ -725,7 +721,6 @@ static int max14577_muic_remove(struct platform_device *pdev) struct max14577_muic_info *info = platform_get_drvdata(pdev); cancel_work_sync(&info->irq_work); - extcon_dev_unregister(info->edev); return 0; } -- 1.7.9.5 -- 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] arm: oprofile: add ARMv7 cortex-a15 support
ARMv7 cortex-a15 supports Performance Monitor Units, and it could be used by oprofile, add perf_pmu_name pair. Simply tested on hisilicon hip04 soc. Signed-off-by: Kefeng Wang --- arch/arm/oprofile/common.c |1 + 1 file changed, 1 insertion(+) diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c index 99c63d4b..9ede34b 100644 --- a/arch/arm/oprofile/common.c +++ b/arch/arm/oprofile/common.c @@ -39,6 +39,7 @@ static struct op_perf_name { { "v6mpcore", "arm/mpcore"}, { "ARMv7 Cortex-A8","arm/armv7" }, { "ARMv7 Cortex-A9","arm/armv7-ca9" }, + { "ARMv7 Cortex-A15", "arm/armv7-ca15"}, }; char *op_name_from_perf_id(void) -- 1.7.9.5 -- 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/
[PATCHv4 7/8] extcon: palmas: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo --- drivers/extcon/extcon-palmas.c | 15 +-- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/extcon/extcon-palmas.c b/drivers/extcon/extcon-palmas.c index 51db5bc..1a770e0 100644 --- a/drivers/extcon/extcon-palmas.c +++ b/drivers/extcon/extcon-palmas.c @@ -192,7 +192,7 @@ static int palmas_usb_probe(struct platform_device *pdev) palmas_usb->edev.name = kstrdup(node->name, GFP_KERNEL); palmas_usb->edev.mutually_exclusive = mutually_exclusive; - status = extcon_dev_register(&palmas_usb->edev); + status = devm_extcon_dev_register(&pdev->dev, &palmas_usb->edev); if (status) { dev_err(&pdev->dev, "failed to register extcon device\n"); kfree(palmas_usb->edev.name); @@ -209,7 +209,8 @@ static int palmas_usb_probe(struct platform_device *pdev) if (status < 0) { dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", palmas_usb->id_irq, status); - goto fail_extcon; + kfree(palmas_usb->edev.name); + return status; } } @@ -223,26 +224,20 @@ static int palmas_usb_probe(struct platform_device *pdev) if (status < 0) { dev_err(&pdev->dev, "can't get IRQ %d, err %d\n", palmas_usb->vbus_irq, status); - goto fail_extcon; + kfree(palmas_usb->edev.name); + return status; } } palmas_enable_irq(palmas_usb); device_set_wakeup_capable(&pdev->dev, true); return 0; - -fail_extcon: - extcon_dev_unregister(&palmas_usb->edev); - kfree(palmas_usb->edev.name); - - return status; } static int palmas_usb_remove(struct platform_device *pdev) { struct palmas_usb *palmas_usb = platform_get_drvdata(pdev); - extcon_dev_unregister(&palmas_usb->edev); kfree(palmas_usb->edev.name); return 0; -- 1.7.9.5 -- 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/
[PATCHv4 6/8] extcon: max8997: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo Reviewed-by: Krzysztof Kozlowski --- drivers/extcon/extcon-max8997.c |4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/extcon/extcon-max8997.c b/drivers/extcon/extcon-max8997.c index 223e6b0..804a446 100644 --- a/drivers/extcon/extcon-max8997.c +++ b/drivers/extcon/extcon-max8997.c @@ -709,7 +709,7 @@ static int max8997_muic_probe(struct platform_device *pdev) info->edev->name = DEV_NAME; info->edev->dev.parent = &pdev->dev; info->edev->supported_cable = max8997_extcon_cable; - ret = extcon_dev_register(info->edev); + ret = devm_extcon_dev_register(&pdev->dev, info->edev); if (ret) { dev_err(&pdev->dev, "failed to register extcon device\n"); goto err_irq; @@ -790,8 +790,6 @@ static int max8997_muic_remove(struct platform_device *pdev) free_irq(muic_irqs[i].virq, info); cancel_work_sync(&info->irq_work); - extcon_dev_unregister(info->edev); - return 0; } -- 1.7.9.5 -- 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/
[PATCHv4 1/8] extcon: Add resource-managed extcon register function
Add resource-managed extcon device register function for convenience. For example, if a extcon device is attached with new devm_extcon_dev_register(), that extcon device is automatically unregistered on driver detach. Signed-off-by: Sangjung Woo --- drivers/extcon/extcon-class.c | 64 + include/linux/extcon.h| 17 +++ 2 files changed, 81 insertions(+) diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 7ab21aa..645b02b 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c @@ -819,6 +819,70 @@ void extcon_dev_unregister(struct extcon_dev *edev) } EXPORT_SYMBOL_GPL(extcon_dev_unregister); +static void devm_extcon_dev_release(struct device *dev, void *res) +{ + extcon_dev_unregister((struct extcon_dev *)res); +} + +static int devm_extcon_dev_match(struct device *dev, void *res, void *data) +{ + return res == data; +} + +/** + * devm_extcon_dev_register() - Resource-managed extcon_dev_register() + * @dev: device to allocate extcon device + * @edev: the new extcon device to register + * + * Managed extcon_dev_register() function. If extcon device is attached with + * this function, that extcon device is automatically unregistered on driver + * detach. Internally this function calls extcon_dev_register() function. + * To get more information, refer that function. + * + * If extcon device is registered with this function and the device needs to be + * unregistered separately, devm_extcon_dev_unregister() should be used. + * + * RETURNS: + * 0 on success, negative error number on failure. + */ +int devm_extcon_dev_register(struct device *dev, struct extcon_dev *edev) +{ + struct extcon_dev **ptr; + int ret; + + ptr = devres_alloc(devm_extcon_dev_release, sizeof(*ptr), + GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = extcon_dev_register(edev); + if (ret) { + devres_free(ptr); + return ret; + } + + *ptr = edev; + devres_add(dev, ptr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_register); + +/** + * devm_extcon_dev_unregister() - Resource-managed extcon_dev_unregister() + * @dev: device the extcon belongs to + * @edev: the extcon device to unregister + * + * Unregister extcon device that is registered with devm_extcon_dev_register() + * function. + */ +void devm_extcon_dev_unregister(struct device *dev, struct extcon_dev *edev) +{ + WARN_ON(devres_release(dev, devm_extcon_dev_release, + devm_extcon_dev_match, edev)); +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_unregister); + #ifdef CONFIG_OF /* * extcon_get_edev_by_phandle - Get the extcon device from devicetree diff --git a/include/linux/extcon.h b/include/linux/extcon.h index f488145..6a17f69 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -188,6 +188,14 @@ extern void extcon_dev_unregister(struct extcon_dev *edev); extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); /* + * Resource-managed extcon device register function. + */ +extern int devm_extcon_dev_register(struct device *dev, + struct extcon_dev *edev); +extern void devm_extcon_dev_unregister(struct device *dev, + struct extcon_dev *edev); + +/* * get/set/update_state access the 32b encoded state value, which represents * states of all possible cables of the multistate port. For example, if one * calls extcon_set_state(edev, 0x7), it may mean that all the three cables @@ -254,6 +262,15 @@ static inline int extcon_dev_register(struct extcon_dev *edev) static inline void extcon_dev_unregister(struct extcon_dev *edev) { } +static inline devm_extcon_dev_register(struct device *dev, + struct extcon_dev *edev) +{ + return 0; +} + +static inline devm_extcon_dev_unregister(struct device *dev, +struct extcon_dev *edev) { } + static inline u32 extcon_get_state(struct extcon_dev *edev) { return 0; -- 1.7.9.5 -- 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/
[PATCHv4 3/8] extcon: gpio: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo --- drivers/extcon/extcon-gpio.c | 16 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/drivers/extcon/extcon-gpio.c b/drivers/extcon/extcon-gpio.c index 13d5222..43af34c 100644 --- a/drivers/extcon/extcon-gpio.c +++ b/drivers/extcon/extcon-gpio.c @@ -121,34 +121,27 @@ static int gpio_extcon_probe(struct platform_device *pdev) msecs_to_jiffies(pdata->debounce); } - ret = extcon_dev_register(&extcon_data->edev); + ret = devm_extcon_dev_register(&pdev->dev, &extcon_data->edev); if (ret < 0) return ret; INIT_DELAYED_WORK(&extcon_data->work, gpio_extcon_work); extcon_data->irq = gpio_to_irq(extcon_data->gpio); - if (extcon_data->irq < 0) { - ret = extcon_data->irq; - goto err; - } + if (extcon_data->irq < 0) + return extcon_data->irq; ret = request_any_context_irq(extcon_data->irq, gpio_irq_handler, pdata->irq_flags, pdev->name, extcon_data); if (ret < 0) - goto err; + return ret; platform_set_drvdata(pdev, extcon_data); /* Perform initial detection */ gpio_extcon_work(&extcon_data->work.work); return 0; - -err: - extcon_dev_unregister(&extcon_data->edev); - - return ret; } static int gpio_extcon_remove(struct platform_device *pdev) @@ -157,7 +150,6 @@ static int gpio_extcon_remove(struct platform_device *pdev) cancel_delayed_work_sync(&extcon_data->work); free_irq(extcon_data->irq, extcon_data); - extcon_dev_unregister(&extcon_data->edev); return 0; } -- 1.7.9.5 -- 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/
[PATCHv4 2/8] extcon: adc-jack: Use devm_extcon_dev_register()
Use the resource-managed extcon device register function (i.e. devm_extcon_dev_register()) instead of extcon_dev_register(). If extcon device is attached with this function, that extcon device is automatically unregistered on driver detach. That reduces tiresome managing code. Signed-off-by: Sangjung Woo --- drivers/extcon/extcon-adc-jack.c | 30 +- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/extcon/extcon-adc-jack.c b/drivers/extcon/extcon-adc-jack.c index e23f1c2..549d820 100644 --- a/drivers/extcon/extcon-adc-jack.c +++ b/drivers/extcon/extcon-adc-jack.c @@ -105,9 +105,8 @@ static int adc_jack_probe(struct platform_device *pdev) data->edev.name = pdata->name; if (!pdata->cable_names) { - err = -EINVAL; dev_err(&pdev->dev, "error: cable_names not defined.\n"); - goto out; + return -EINVAL; } data->edev.dev.parent = &pdev->dev; @@ -117,18 +116,16 @@ static int adc_jack_probe(struct platform_device *pdev) for (i = 0; data->edev.supported_cable[i]; i++) ; if (i == 0 || i > SUPPORTED_CABLE_MAX) { - err = -EINVAL; dev_err(&pdev->dev, "error: pdata->cable_names size = %d\n", i - 1); - goto out; + return -EINVAL; } data->num_cables = i; if (!pdata->adc_conditions || !pdata->adc_conditions[0].state) { - err = -EINVAL; dev_err(&pdev->dev, "error: adc_conditions not defined.\n"); - goto out; + return -EINVAL; } data->adc_conditions = pdata->adc_conditions; @@ -138,10 +135,8 @@ static int adc_jack_probe(struct platform_device *pdev) data->num_conditions = i; data->chan = iio_channel_get(&pdev->dev, pdata->consumer_channel); - if (IS_ERR(data->chan)) { - err = PTR_ERR(data->chan); - goto out; - } + if (IS_ERR(data->chan)) + return PTR_ERR(data->chan); data->handling_delay = msecs_to_jiffies(pdata->handling_delay_ms); @@ -149,15 +144,14 @@ static int adc_jack_probe(struct platform_device *pdev) platform_set_drvdata(pdev, data); - err = extcon_dev_register(&data->edev); + err = devm_extcon_dev_register(&pdev->dev, &data->edev); if (err) - goto out; + return err; data->irq = platform_get_irq(pdev, 0); if (!data->irq) { dev_err(&pdev->dev, "platform_get_irq failed\n"); - err = -ENODEV; - goto err_irq; + return -ENODEV; } err = request_any_context_irq(data->irq, adc_jack_irq_thread, @@ -165,15 +159,10 @@ static int adc_jack_probe(struct platform_device *pdev) if (err < 0) { dev_err(&pdev->dev, "error: irq %d\n", data->irq); - goto err_irq; + return err; } return 0; - -err_irq: - extcon_dev_unregister(&data->edev); -out: - return err; } static int adc_jack_remove(struct platform_device *pdev) @@ -182,7 +171,6 @@ static int adc_jack_remove(struct platform_device *pdev) free_irq(data->irq, data); cancel_work_sync(&data->handler.work); - extcon_dev_unregister(&data->edev); return 0; } -- 1.7.9.5 -- 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: [3.11.y.z extended stable] Linux 3.11.10.8
diff --git a/Makefile b/Makefile index 3915c57..831a7d8 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ VERSION = 3 PATCHLEVEL = 11 SUBLEVEL = 10 -EXTRAVERSION = .7 +EXTRAVERSION = .8 NAME = Linux for Workgroups # *DOCUMENTATION* diff --git a/arch/m68k/Kconfig b/arch/m68k/Kconfig index 821170e..b969eea 100644 --- a/arch/m68k/Kconfig +++ b/arch/m68k/Kconfig @@ -16,6 +16,7 @@ config M68K select FPU if MMU select ARCH_WANT_IPC_PARSE_VERSION select ARCH_USES_GETTIMEOFFSET if MMU && !COLDFIRE + select HAVE_FUTEX_CMPXCHG if MMU && FUTEX select HAVE_MOD_ARCH_SPECIFIC select MODULES_USE_ELF_REL select MODULES_USE_ELF_RELA diff --git a/arch/s390/Kconfig b/arch/s390/Kconfig index 8a4cae7..f443713 100644 --- a/arch/s390/Kconfig +++ b/arch/s390/Kconfig @@ -116,6 +116,7 @@ config S390 select HAVE_FUNCTION_GRAPH_TRACER select HAVE_FUNCTION_TRACER select HAVE_FUNCTION_TRACE_MCOUNT_TEST + select HAVE_FUTEX_CMPXCHG if FUTEX select HAVE_KERNEL_BZIP2 select HAVE_KERNEL_GZIP select HAVE_KERNEL_LZ4 diff --git a/arch/sparc/Kconfig b/arch/sparc/Kconfig index a00cbd3..d268475 100644 --- a/arch/sparc/Kconfig +++ b/arch/sparc/Kconfig @@ -25,7 +25,7 @@ config SPARC select RTC_DRV_M48T59 select HAVE_DMA_ATTRS select HAVE_DMA_API_DEBUG - select HAVE_ARCH_JUMP_LABEL + select HAVE_ARCH_JUMP_LABEL if SPARC64 select HAVE_GENERIC_HARDIRQS select GENERIC_IRQ_SHOW select ARCH_WANT_IPC_PARSE_VERSION diff --git a/arch/sparc/include/asm/uaccess_64.h b/arch/sparc/include/asm/uaccess_64.h index e562d3c..ad7e178 100644 --- a/arch/sparc/include/asm/uaccess_64.h +++ b/arch/sparc/include/asm/uaccess_64.h @@ -262,8 +262,8 @@ extern unsigned long __must_check __clear_user(void __user *, unsigned long); extern __must_check long strlen_user(const char __user *str); extern __must_check long strnlen_user(const char __user *str, long n); -#define __copy_to_user_inatomic ___copy_to_user -#define __copy_from_user_inatomic ___copy_from_user +#define __copy_to_user_inatomic __copy_to_user +#define __copy_from_user_inatomic __copy_from_user struct pt_regs; extern unsigned long compute_effective_address(struct pt_regs *, diff --git a/arch/sparc/kernel/pci.c b/arch/sparc/kernel/pci.c index bc4d3f5..cb02145 100644 --- a/arch/sparc/kernel/pci.c +++ b/arch/sparc/kernel/pci.c @@ -398,8 +398,8 @@ static void apb_fake_ranges(struct pci_dev *dev, apb_calc_first_last(map, &first, &last); res = bus->resource[1]; res->flags = IORESOURCE_MEM; - region.start = (first << 21); - region.end = (last << 21) + ((1 << 21) - 1); + region.start = (first << 29); + region.end = (last << 29) + ((1 << 29) - 1); pcibios_bus_to_resource(dev, res, ®ion); } diff --git a/arch/sparc/kernel/process_64.c b/arch/sparc/kernel/process_64.c index baebab2..b9cc976 100644 --- a/arch/sparc/kernel/process_64.c +++ b/arch/sparc/kernel/process_64.c @@ -57,9 +57,12 @@ void arch_cpu_idle(void) { if (tlb_type != hypervisor) { touch_nmi_watchdog(); + local_irq_enable(); } else { unsigned long pstate; + local_irq_enable(); + /* The sun4v sleeping code requires that we have PSTATE.IE cleared over * the cpu sleep hypervisor call. */ @@ -81,7 +84,6 @@ void arch_cpu_idle(void) : "=&r" (pstate) : "i" (PSTATE_IE)); } - local_irq_enable(); } #ifdef CONFIG_HOTPLUG_CPU diff --git a/arch/sparc/kernel/syscalls.S b/arch/sparc/kernel/syscalls.S index 73ec8a7..c79c687 100644 --- a/arch/sparc/kernel/syscalls.S +++ b/arch/sparc/kernel/syscalls.S @@ -189,7 +189,8 @@ linux_sparc_syscall32: mov%i0, %l5! IEU1 5: call%l7 ! CTI Group brk forced srl%i5, 0, %o5 ! IEU1 - ba,a,pt %xcc, 3f + ba,pt %xcc, 3f +sra%o0, 0, %o0 /* Linux native system calls enter here... */ .align 32 @@ -217,7 +218,6 @@ linux_sparc_syscall: 3: stx %o0, [%sp + PTREGS_OFF + PT_V9_I0] ret_sys_call: ldx [%sp + PTREGS_OFF + PT_V9_TSTATE], %g3 - sra %o0, 0, %o0 mov %ulo(TSTATE_XCARRY | TSTATE_ICARRY), %g2 sllx%g2, 32, %g2 diff --git a/arch/x86/crypto/ghash-clmulni-intel_asm.S b/arch/x86/crypto/ghash-clmulni-intel_asm.S index 586f41a..185fad4 100644 --- a/arch/x86/crypto/ghash-clmulni-intel_asm.S +++ b/arch/x86/crypto/ghash-clmulni-intel_asm.S @@ -24,10 +24,6 @@ .align 16 .Lbswap_mask: .octa 0x000102030405060708090a0b0c0d0e0f -.Lpoly: - .octa 0xc201 -.Ltwo_one: - .octa 0x00010001 #define DATA %xmm0 #define SHASH %xmm
Re: [PATCH v2 3/8] davinci: da850: Use cpufreq_for_each_entry macro for iteration
On Wednesday 16 April 2014 03:56 AM, Stratos Karafotis wrote: > The cpufreq core now supports the cpufreq_for_each_entry macro helper > for iteration over the cpufreq_frequency_table, so use it. > > It should have no functional changes. > > Signed-off-by: Stratos Karafotis I cannot test this (or even build this) since I do not have the patch which adds cpufreq_for_each_entry(). The change as such looks fine to me. Please prefix the subject line with "ARM: " as is the convention in ARM world. Thanks, Sekhar -- 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 3/8] davinci: da850: Use cpufreq_for_each_entry macro for iteration
On 21 April 2014 15:53, Sekhar Nori wrote: > I cannot test this (or even build this) since I do not have the patch > which adds cpufreq_for_each_entry(). The change as such looks fine to > me. Please prefix the subject line with "ARM: " as is the convention in > ARM world. In case you wanna have a look: https://lkml.org/lkml/2014/4/15/695 -- 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/
[3.11.y.z extended stable] Linux 3.11.10.8
I am announcing the release of the Linux 3.11.10.8 kernel. The updated 3.11.y tree can be found at: git://kernel.ubuntu.com/ubuntu/linux.git linux-3.11.y and can be browsed at: http://kernel.ubuntu.com/git?p=ubuntu/linux.git;h=refs/heads/linux-3.11.y;a=shortlog The diff from v3.11.10.7 is posted as a follow-up to this email. The 3.11.y extended stable tree is maintained by the Ubuntu Kernel Team. For more info, see https://wiki.ubuntu.com/Kernel/Dev/ExtendedStable -Luis -- Makefile| 2 +- arch/m68k/Kconfig | 1 + arch/s390/Kconfig | 1 + arch/sparc/Kconfig | 2 +- arch/sparc/include/asm/uaccess_64.h | 4 +- arch/sparc/kernel/pci.c | 4 +- arch/sparc/kernel/process_64.c | 4 +- arch/sparc/kernel/syscalls.S| 4 +- arch/x86/crypto/ghash-clmulni-intel_asm.S | 29 -- arch/x86/crypto/ghash-clmulni-intel_glue.c | 14 ++- drivers/cpufreq/cpufreq_governor.c | 3 + drivers/cpufreq/powernow-k6.c | 147 +++- drivers/cpuidle/driver.c| 3 +- drivers/input/mouse/cypress_ps2.c | 1 - drivers/isdn/isdnloop/isdnloop.c| 23 +++-- drivers/net/ethernet/broadcom/tg3.c | 5 +- drivers/net/usb/usbnet.c| 33 --- drivers/net/vxlan.c | 3 + drivers/net/xen-netback/netback.c | 4 +- drivers/vhost/net.c | 20 +++- include/linux/futex.h | 4 + include/linux/usb/usbnet.h | 2 +- include/net/netfilter/nf_conntrack_extend.h | 4 +- include/net/sock.h | 5 + init/Kconfig| 7 ++ kernel/futex.c | 14 ++- lib/nlattr.c| 10 +- net/8021q/vlan.c| 4 +- net/8021q/vlan_dev.c| 6 +- net/bridge/br_multicast.c | 6 ++ net/bridge/netfilter/ebtables.c | 5 +- net/core/netpoll.c | 2 +- net/core/rtnetlink.c| 10 +- net/core/sock.c | 5 +- net/ipv4/inet_fragment.c| 5 +- net/ipv4/ipmr.c | 13 ++- net/ipv4/netfilter/arp_tables.c | 6 +- net/ipv4/netfilter/ip_tables.c | 6 +- net/ipv4/tcp_output.c | 11 +++ net/ipv6/addrconf.c | 5 +- net/ipv6/exthdrs_offload.c | 4 +- net/ipv6/icmp.c | 2 +- net/ipv6/ip6_output.c | 18 ++-- net/ipv6/ip6mr.c| 13 ++- net/ipv6/mcast.c| 11 ++- net/ipv6/netfilter/ip6_tables.c | 6 +- net/ipv6/ping.c | 4 +- net/ipv6/route.c| 2 +- net/netfilter/nf_conntrack_proto_dccp.c | 6 +- net/rds/iw.c| 3 +- net/sctp/sm_make_chunk.c| 4 +- net/sctp/sm_statefuns.c | 5 - net/socket.c| 4 + net/unix/af_unix.c | 17 +++- security/selinux/hooks.c| 36 +-- 55 files changed, 391 insertions(+), 181 deletions(-) Andrey Vagin (1): netfilter: nf_conntrack: reserve two bytes for nf_ct_ext->len Anton Nayshtut (1): ipv6: Fix exthdrs offload registration. Ard Biesheuvel (1): crypto: ghash-clmulni-intel - use C implementation for setkey() Dan Carpenter (1): isdnloop: several buffer overflows Daniel Borkmann (2): netfilter: nf_conntrack_dccp: fix skb_header_pointer API usages net: sctp: fix skb leakage in COOKIE ECHO path of chunk->auth_chunk Daniel Fu (1): cpuidle: Check the result of cpuidle_get_driver() against NULL Dave Kleikamp (2): Revert "sparc64: Fix __copy_{to,from}_user_inatomic defines." sparc64: don't treat 64-bit syscall return codes as 32-bit David S. Miller (1): sparc64: Make sure %pil interrupts are enabled during hypervisor yield. David Stevens (1): vxlan: fix potential NULL dereference in arp_reduce() Eric Dumazet (2): net: unix: non blocking recvmsg() should not return -EINTR tcp: tcp_release_cb() should release socket ownership Finn Thain (1): m68k: Skip futex_atomic_cmpxchg_inatomic() test Florian Westphal (1): inet: frag: make sure forced eviction removes all frags Hannes Frederic Sowa (1): ipv6: some ipv6 statistic counters failed to disable bh Hans de Goede (1): Input: cypress_ps2 - don't report as a button pads Heiko Carstens (1): futex: Allow architectures to skip futex_atomic_cmpxch
Re: [PATCHv2 3/3] edac: altera: Add SDRAM EDAC support for CycloneV/ArriaV
Hi! > From: Thor Thayer > > Added EDAC support for reporting ECC errors of CycloneV > and ArriaV SDRAM controller. > - The SDRAM Controller registers are used by the FPGA bridge so > these are accessed through the syscon interface. > - The configuration of the SDRAM memory size for the EDAC framework > is discovered from the SDRAM Controller registers. > - Documentation of the bindings in devicetree/bindings/arm/altera/ > socfpga-sdram-edac.txt > - Correction of single bit errors, detection of double bit errors. > > --- > v2: Use the SDRAM controller registers to calculate memory size > instead of the Device Tree. Update To & Cc list. Add maintainer > information. I'd reduce number of *s in the messages, otherwise Reviewed-by: Pavel Machek for whole series. Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html -- 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/
Estimado E-mail del usuario;
Estimado E-mail del usuario; Se ha superado 23.432 Repositorio para el conjunto buzón Servicios Web / Administrador, y habrás problemas al enviar y recepción de correo, mientras que volver a verificar. Debe actualizar haciendo clic en enlace de abajo y complete la información para verificar su cuenta. http://stananzanleonsin.net/predzenie-ujrarvnyestst.html/ Por favor, haga clic en el siguiente enlace para actualizar la bandeja de entrada. ¡Atención! De no hacerlo, tendrá acceso limitado a su buzón de correo. Si no actualiza su cuenta dentro de los tres días posteriores a la actualización aviso, su cuenta será cerrada permanentemente. -- 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: [PATCHv4 1/8] extcon: Add resource-managed extcon register function
Hi, This patch has some bug and need code clean. I'll fix it and resend only this patch on v5. Thanks, Chanwoo Choi On 04/21/2014 07:10 PM, Sangjung Woo wrote: > Add resource-managed extcon device register function for convenience. > For example, if a extcon device is attached with new > devm_extcon_dev_register(), that extcon device is automatically > unregistered on driver detach. > > Signed-off-by: Sangjung Woo > --- > drivers/extcon/extcon-class.c | 64 > + > include/linux/extcon.h| 17 +++ > 2 files changed, 81 insertions(+) > > diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c > index 7ab21aa..645b02b 100644 > --- a/drivers/extcon/extcon-class.c > +++ b/drivers/extcon/extcon-class.c > @@ -819,6 +819,70 @@ void extcon_dev_unregister(struct extcon_dev *edev) > } > EXPORT_SYMBOL_GPL(extcon_dev_unregister); > > +static void devm_extcon_dev_release(struct device *dev, void *res) > +{ > + extcon_dev_unregister((struct extcon_dev *)res); 'res' is double pointer. this line have to modify as following: extcon_dev_unregister(*(struct extcon_dev **)res); > +} > + > +static int devm_extcon_dev_match(struct device *dev, void *res, void *data) > +{ > + return res == data; 'res' is double pointer so this line have to modify as following: return *res == data; and additionally add error exception code struct extcon_dev **r = res; if (!r || !*r) { WARN_ON(!r || !*r); return 0; } return *r == data; > +} > + > +/** > + * devm_extcon_dev_register() - Resource-managed extcon_dev_register() > + * @dev: device to allocate extcon device > + * @edev:the new extcon device to register > + * > + * Managed extcon_dev_register() function. If extcon device is attached with > + * this function, that extcon device is automatically unregistered on driver > + * detach. Internally this function calls extcon_dev_register() function. > + * To get more information, refer that function. > + * > + * If extcon device is registered with this function and the device needs to > be > + * unregistered separately, devm_extcon_dev_unregister() should be used. > + * > + * RETURNS: > + * 0 on success, negative error number on failure. > + */ > +int devm_extcon_dev_register(struct device *dev, struct extcon_dev *edev) > +{ > + struct extcon_dev **ptr; > + int ret; > + > + ptr = devres_alloc(devm_extcon_dev_release, sizeof(*ptr), > + GFP_KERNEL); > + if (!ptr) > + return -ENOMEM; > + > + ret = extcon_dev_register(edev); > + if (ret) { > + devres_free(ptr); > + return ret; > + } > + > + *ptr = edev; > + devres_add(dev, ptr); > + > + return 0; > +} > +EXPORT_SYMBOL_GPL(devm_extcon_dev_register); > + > +/** > + * devm_extcon_dev_unregister() - Resource-managed extcon_dev_unregister() > + * @dev: device the extcon belongs to > + * @edev:the extcon device to unregister > + * > + * Unregister extcon device that is registered with > devm_extcon_dev_register() > + * function. > + */ > +void devm_extcon_dev_unregister(struct device *dev, struct extcon_dev *edev) > +{ > + WARN_ON(devres_release(dev, devm_extcon_dev_release, > + devm_extcon_dev_match, edev)); Need to keep the indentation for readability. > +} > +EXPORT_SYMBOL_GPL(devm_extcon_dev_unregister); > + > #ifdef CONFIG_OF > /* > * extcon_get_edev_by_phandle - Get the extcon device from devicetree > diff --git a/include/linux/extcon.h b/include/linux/extcon.h > index f488145..6a17f69 100644 > --- a/include/linux/extcon.h > +++ b/include/linux/extcon.h > @@ -188,6 +188,14 @@ extern void extcon_dev_unregister(struct extcon_dev > *edev); > extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); > > /* > + * Resource-managed extcon device register function. > + */ > +extern int devm_extcon_dev_register(struct device *dev, > + struct extcon_dev *edev); > +extern void devm_extcon_dev_unregister(struct device *dev, > +struct extcon_dev *edev); > + > +/* > * get/set/update_state access the 32b encoded state value, which represents > * states of all possible cables of the multistate port. For example, if one > * calls extcon_set_state(edev, 0x7), it may mean that all the three cables > @@ -254,6 +262,15 @@ static inline int extcon_dev_register(struct extcon_dev > *edev) > > static inline void extcon_dev_unregister(struct extcon_dev *edev) { } > > +static inline devm_extcon_dev_register(struct device *dev, Missing the vairable type of return value. > +struct extcon_dev *edev) > +{ > + return 0; > +} > + > +static inline devm_extcon_dev_unregister(struct device *dev, Missing the vairable type of return value. > +
[PATCHv5] extcon: Add resource-managed extcon register function
From: Sangjung Woo Add resource-managed extcon device register function for convenience. For example, if a extcon device is attached with new devm_extcon_dev_register(), that extcon device is automatically unregistered on driver detach. Signed-off-by: Sangjung Woo [Fix bug about devm_extcon_dev_match/release() and code clean by Chanwoo Choi] Signed-off-by: Chanwoo Choi --- drivers/extcon/extcon-class.c | 69 +++ include/linux/extcon.h| 17 +++ 2 files changed, 86 insertions(+) diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c index 7ab21aa..f6df689 100644 --- a/drivers/extcon/extcon-class.c +++ b/drivers/extcon/extcon-class.c @@ -819,6 +819,75 @@ void extcon_dev_unregister(struct extcon_dev *edev) } EXPORT_SYMBOL_GPL(extcon_dev_unregister); +static void devm_extcon_dev_unreg(struct device *dev, void *res) +{ + extcon_dev_unregister(*(struct extcon_dev **)res); +} + +static int devm_extcon_dev_match(struct device *dev, void *res, void *data) +{ + struct extcon_dev **r = res; + + if (!r || !*r) { + WARN_ON(!r || !*r); + return 0; + } + + return *r == data; +} + +/** + * devm_extcon_dev_register() - Resource-managed extcon_dev_register() + * @dev: device to allocate extcon device + * @edev: the new extcon device to register + * + * Managed extcon_dev_register() function. If extcon device is attached with + * this function, that extcon device is automatically unregistered on driver + * detach. Internally this function calls extcon_dev_register() function. + * To get more information, refer that function. + * + * If extcon device is registered with this function and the device needs to be + * unregistered separately, devm_extcon_dev_unregister() should be used. + * + * Returns 0 if success or negaive error number if failure. + */ +int devm_extcon_dev_register(struct device *dev, struct extcon_dev *edev) +{ + struct extcon_dev **ptr; + int ret; + + ptr = devres_alloc(devm_extcon_dev_unreg, sizeof(*ptr), GFP_KERNEL); + if (!ptr) + return -ENOMEM; + + ret = extcon_dev_register(edev); + if (ret) { + devres_free(ptr); + return ret; + } + + *ptr = edev; + devres_add(dev, ptr); + + return 0; +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_register); + +/** + * devm_extcon_dev_unregister() - Resource-managed extcon_dev_unregister() + * @dev: device the extcon belongs to + * @edev: the extcon device to unregister + * + * Unregister extcon device that is registered with devm_extcon_dev_register() + * function. + */ +void devm_extcon_dev_unregister(struct device *dev, struct extcon_dev *edev) +{ + WARN_ON(devres_release(dev, devm_extcon_dev_unreg, + devm_extcon_dev_match, edev)); +} +EXPORT_SYMBOL_GPL(devm_extcon_dev_unregister); + #ifdef CONFIG_OF /* * extcon_get_edev_by_phandle - Get the extcon device from devicetree diff --git a/include/linux/extcon.h b/include/linux/extcon.h index f488145..85a8a5b 100644 --- a/include/linux/extcon.h +++ b/include/linux/extcon.h @@ -188,6 +188,14 @@ extern void extcon_dev_unregister(struct extcon_dev *edev); extern struct extcon_dev *extcon_get_extcon_dev(const char *extcon_name); /* + * Resource-managed extcon device register function. + */ +extern int devm_extcon_dev_register(struct device *dev, + struct extcon_dev *edev); +extern void devm_extcon_dev_unregister(struct device *dev, + struct extcon_dev *edev); + +/* * get/set/update_state access the 32b encoded state value, which represents * states of all possible cables of the multistate port. For example, if one * calls extcon_set_state(edev, 0x7), it may mean that all the three cables @@ -254,6 +262,15 @@ static inline int extcon_dev_register(struct extcon_dev *edev) static inline void extcon_dev_unregister(struct extcon_dev *edev) { } +static inline int devm_extcon_dev_register(struct device *dev, + struct extcon_dev *edev) +{ + return -EINVAL; +} + +static inline void devm_extcon_dev_unregister(struct device *dev, + struct extcon_dev *edev) { } + static inline u32 extcon_get_state(struct extcon_dev *edev) { return 0; -- 1.8.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/
kaslr relocation incompitable with kernel loaded high
Hi, Kees When I'm testing kaslr with kdump, I find that when 2nd kernel is loaded high, it doesn't boot. I reserved 128M memory at high with kernel cmdline "crashkernel=128M,high crashkernel=0,low", and for which I got: [0.00] Reserving 128MB of memory at 6896MB for crashkernel (System RAM: 6013MB) Then I load kdump kernel into the reserved memory region, using a local modified kexec-tools which is passing e820 in boot_params. The e820 map of system RAM passed to 2nd kernel: E820 memmap (of RAM): 1000-0009e3ff (1) 0001af00-0001b6f5dfff (1) 0001b6fff400-0001b6ff (1) In which, 2nd kernel is loaded at 0x1b500. After triggerred a system crash, 2nd kernel doesn't boot even with "nokaslr" cmdline: # echo c > /proc/sysrq-trigger [..] I'm in purgatory early console in decompress_kernel KASLR disabled... Decompressing Linux... Parsing ELF... Performing relocations... 32-bit relocation outside of kernel! -- System halted I know 32bit relocation code has recently moved to misc.c and it's a ground work for kaslr on x86_64. However it doesn't work out on a kernel high loaded case. I'm not quite familiar with this. But I'm wondering if it makes sense to skip handle_relocation() if kaslr doesn't take effects (nokaslr or kaslr failed to find suitable area). Thanks WANG Chao -- 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] arm: oprofile: add ARMv7 cortex-a15 support
Sorry, please ignore, we have operf tool, this is unnecessary. On 2014-4-21 18:11, Kefeng Wang wrote: > ARMv7 cortex-a15 supports Performance Monitor Units, and > it could be used by oprofile, add perf_pmu_name pair. > > Simply tested on hisilicon hip04 soc. > > Signed-off-by: Kefeng Wang > --- > arch/arm/oprofile/common.c |1 + > 1 file changed, 1 insertion(+) > > diff --git a/arch/arm/oprofile/common.c b/arch/arm/oprofile/common.c > index 99c63d4b..9ede34b 100644 > --- a/arch/arm/oprofile/common.c > +++ b/arch/arm/oprofile/common.c > @@ -39,6 +39,7 @@ static struct op_perf_name { > { "v6mpcore", "arm/mpcore"}, > { "ARMv7 Cortex-A8","arm/armv7" }, > { "ARMv7 Cortex-A9","arm/armv7-ca9" }, > + { "ARMv7 Cortex-A15", "arm/armv7-ca15"}, > }; > > char *op_name_from_perf_id(void) > -- 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] ARM: perf: save/restore pmu registers in pm notifier
This adds core support for saving and restoring CPU PMU registers for suspend/resume support i.e. deeper C-states in cpuidle terms. This patch adds support only to ARMv7 PMU registers save/restore. It needs to be extended to xscale and ARMv6 if needed. I make this patch because of DS-5 not work on our CA7 based SoCs. And it is based on Sudeep KarkadaNagesha's patch set for multiple PMUs. Thanks Will and Sudeep's suggestion to only save / restore used events. Cc: Sudeep KarkadaNagesha Signed-off-by: Neil Zhang --- arch/arm/include/asm/pmu.h |4 ++ arch/arm/kernel/perf_event.c |2 + arch/arm/kernel/perf_event_cpu.c | 28 ++ arch/arm/kernel/perf_event_v7.c | 75 ++ 4 files changed, 109 insertions(+) diff --git a/arch/arm/include/asm/pmu.h b/arch/arm/include/asm/pmu.h index ae1919b..3de3db7 100644 --- a/arch/arm/include/asm/pmu.h +++ b/arch/arm/include/asm/pmu.h @@ -83,6 +83,10 @@ struct arm_pmu { int (*request_irq)(struct arm_pmu *, irq_handler_t handler); void(*free_irq)(struct arm_pmu *); int (*map_event)(struct perf_event *event); + int (*register_pm_notifier)(struct arm_pmu *); + void(*unregister_pm_notifier)(struct arm_pmu *); + void(*save_regs)(struct arm_pmu *); + void(*restore_regs)(struct arm_pmu *); int num_events; atomic_tactive_events; struct mutexreserve_mutex; diff --git a/arch/arm/kernel/perf_event.c b/arch/arm/kernel/perf_event.c index a6bc431..08822de 100644 --- a/arch/arm/kernel/perf_event.c +++ b/arch/arm/kernel/perf_event.c @@ -326,6 +326,7 @@ static void armpmu_release_hardware(struct arm_pmu *armpmu) { armpmu->free_irq(armpmu); + armpmu->unregister_pm_notifier(armpmu); pm_runtime_put_sync(&armpmu->plat_device->dev); } @@ -339,6 +340,7 @@ armpmu_reserve_hardware(struct arm_pmu *armpmu) return -ENODEV; pm_runtime_get_sync(&pmu_device->dev); + armpmu->register_pm_notifier(armpmu); err = armpmu->request_irq(armpmu, armpmu_dispatch_irq); if (err) { armpmu_release_hardware(armpmu); diff --git a/arch/arm/kernel/perf_event_cpu.c b/arch/arm/kernel/perf_event_cpu.c index 51798d7..79e1c06 100644 --- a/arch/arm/kernel/perf_event_cpu.c +++ b/arch/arm/kernel/perf_event_cpu.c @@ -19,6 +19,7 @@ #define pr_fmt(fmt) "CPU PMU: " fmt #include +#include #include #include #include @@ -173,6 +174,31 @@ static int cpu_pmu_request_irq(struct arm_pmu *cpu_pmu, irq_handler_t handler) return 0; } +static int cpu_pmu_pm_notify(struct notifier_block *b, + unsigned long action, void *v) +{ + if (action == CPU_PM_ENTER && cpu_pmu->save_regs) + cpu_pmu->save_regs(cpu_pmu); + else if (action == CPU_PM_EXIT && cpu_pmu->restore_regs) + cpu_pmu->restore_regs(cpu_pmu); + + return NOTIFY_OK; +} + +static struct notifier_block cpu_pmu_pm_notifier = { + .notifier_call = cpu_pmu_pm_notify, +}; + +static int cpu_pmu_register_pm_notifier(struct arm_pmu *cpu_pmu) +{ + return cpu_pm_register_notifier(&cpu_pmu_pm_notifier); +} + +static void cpu_pmu_unregister_pm_notifier(struct arm_pmu *cpu_pmu) +{ + cpu_pm_unregister_notifier(&cpu_pmu_pm_notifier); +} + static void cpu_pmu_init(struct arm_pmu *cpu_pmu) { int cpu; @@ -187,6 +213,8 @@ static void cpu_pmu_init(struct arm_pmu *cpu_pmu) cpu_pmu->get_hw_events = cpu_pmu_get_cpu_events; cpu_pmu->request_irq= cpu_pmu_request_irq; cpu_pmu->free_irq = cpu_pmu_free_irq; + cpu_pmu->register_pm_notifier = cpu_pmu_register_pm_notifier; + cpu_pmu->unregister_pm_notifier = cpu_pmu_unregister_pm_notifier; /* Ensure the PMU has sane values out of reset. */ if (cpu_pmu->reset) diff --git a/arch/arm/kernel/perf_event_v7.c b/arch/arm/kernel/perf_event_v7.c index f4ef398..8898b4d 100644 --- a/arch/arm/kernel/perf_event_v7.c +++ b/arch/arm/kernel/perf_event_v7.c @@ -1237,6 +1237,79 @@ static void armv7_pmnc_dump_regs(struct arm_pmu *cpu_pmu) } #endif +struct armv7_pmuregs { + u32 pmc; + u32 pmcntenset; + u32 pmuseren; + u32 pmintenset; + u32 pmxevttype[8]; + u32 pmxevtcnt[8]; +}; + +static DEFINE_PER_CPU(struct armv7_pmuregs, pmu_regs); + +static void armv7pmu_reset(void *info); + +static void armv7pmu_save_regs(struct arm_pmu *cpu_pmu) +{ + struct pmu_hw_events *events = cpu_pmu->get_hw_events(); + struct armv7_pmuregs *regs; + int bit; + + /* Check whether there are events used */ + bit = find_first_bit(events->used_mask, cpu_pmu->num_events); + if (bit >= cpu_pmu->num_events) + return; + + regs = this_cpu_ptr(&pmu_regs); + memset(regs, 0, sizeof(*regs)); + +
[PATCH] ASoC: core: Don't break component searching if both id and num_dai are 0
The commit e41975ed (ASoC: core: Fix the DAI name getting) added a break within the "if (id < 0 || id >= pos->num_dai)" while the original design of the search didn't break the loop if that condition contented but only mark the ret error and let it go on to search the next component. In a case like dmaengine which's not a dai but as a component sharing an identical name with a dai, both the id and pos->num_dai here could be 0. If we break the search, we may never find the dai we want as it might be placed behind its dmaengine in the component list. So this patch fixes the issue above by following the original design to let the search carry on. Signed-off-by: Nicolin Chen --- sound/soc/soc-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index a17c047..82e9fdf 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -4591,7 +4591,7 @@ int snd_soc_of_get_dai_name(struct device_node *of_node, if (id < 0 || id >= pos->num_dai) { ret = -EINVAL; - break; + continue; } ret = 0; -- 1.8.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: 3.14 regression: huge latency in read/select on tun
>> Hmm.. probably already solved by commit >> 1e785f48d29a09b6cf96db7b49b6320dada332e1 >> ("net: Start with correct mac_len in skb_network_protocol") > > Indeed that fixes it. I have cherry picked that onto 3.14 and it works. > That means 1e785f48 should be applied to stable 3.13.y and 3.14.y too. Its already in davem's stable-queue: http://patchwork.ozlabs.org/bundle/davem/stable/?state=* http://patchwork.ozlabs.org/patch/339082/ Lukas -- 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/
kernel panic during boot - 3.14.1, root is btrfs
Hello! I was trying to move several systems which have their root formatted as btrfs from 3.13.x to 3.14.x and the kernel panicked during boot. Is there anything special that needs to be done as to prepare an in-use-btrfs-root for kernel >=3.14 ? I bisected the problem to a btrfs commit, although I'm not entirely sure its 100% correct. The systems are one physical machine and a couple of virtual ones. Since I bisected this the physical one was converted to XFS root - it's a production machine with real users. More details on bugzilla: https://bugzilla.kernel.org/show_bug.cgi?id=74261 Greg KH says that 3.13.11 will be the last of the series, and advises to move on to 3.14.x - but currently that is impossible for me (bar converting the root to different FS). Can someone think of something to help this situation? P.S. Please, CC me as I'm not subscribed to the kernel mailing list. - Plamen Petrov -- 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 0/24] Introduce ff-memless-next as an improved replacement for ff-memless
On Mon, Apr 21, 2014 at 12:29 AM, wrote: > >> Did the WiiWheel have working FF_CONSTANT before this patchset? >> It would be weird if yes, because lg4ff is also used for MOMO-Black >> which works fine. > > Yes, I think that the force requested by fftest was just too weak to > actually move the wheel. ffcfstress (or whatever it is called) works OK. Ah, nice to hear. I had some additional questions that might benefit to the porting of the lgff and sony driver, concerning the optimal value for FF_UPDATE_RATE (at the moment it defaults to a safe 50ms): - Could you try to sniff FF command USB traffic with the Windows driver of the WingMan Force, just to learn what the update interval is when playing a ConstantForce effect with an envelope (I'm only interested in the envelope part)? - If official/decent Windows drivers are present for one of the Sony controllers you have, can you please do the same, but now when playing a vibration effect (using XInput)? Elias -- 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] core, nfqueue, openvswitch: Orphan frags in skb_zerocopy and handle errors
Hi David, On Thu, Mar 27, 2014 at 03:29:56PM -0400, David Miller wrote: > From: Zoltan Kiss > Date: Wed, 26 Mar 2014 22:37:45 + > > > skb_zerocopy can copy elements of the frags array between skbs, but it > > doesn't > > orphan them. Also, it doesn't handle errors, so this patch takes care of > > that > > as well, and modify the callers accordingly. skb_tx_error() is also added to > > the callers so they will signal the failed delivery towards the creator of > > the > > skb. > > > > Signed-off-by: Zoltan Kiss > > Fingers crossed :-) Applied, thanks Zoltan. > -- > To unsubscribe from this list: send the line "unsubscribe netdev" in > the body of a message to majord...@vger.kernel.org > More majordomo info at http://vger.kernel.org/majordomo-info.html Could you please queue this for stable as well? It has CVE-2014-2568 assigned to it and I believe it is applicable to some of the trees. Cheers, -- Luís -- 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: 3.14-rc: /proc/acpi/battery gone?
On 04/20/2014 09:09 PM, Pavel Machek wrote: Hi! I just glance wmbattery code. I find the code in the acpi.c is already using the new sysfs battery interfaces, right? By default, wmbattery appears to default to using upower as abstraction level, instead of querying sysfs itself directly. http://git.kitenet.net/?p=wmbattery.git;a=blob;f=autoconf/makeinfo.in;hb=HEAD which sets USE_UPOWER=1 by default. If USE_UPOWER=0 is set explicitly for the build, it reverts back to direct sysfs parsing - and yes, it does appear to adhere to the current sysfs API properly. The last remains, and the ability to parse procfs (which hasn't been default for quite some time already, in favour of using hal as abstraction layer) has finally been removed in http://git.kitenet.net/?p=wmbattery.git;a=commitdiff;h=833eb63a5ce4f2fb712a201b1db4f2db1700fddb The switch from procfs parsing to hal (by default at least) in turn happened with http://git.kitenet.net/?p=wmbattery.git;a=commitdiff;h=63c3d1a0b11e8ade1a5612bb5baa3d92e153bbbe in 2008 (before Debian squeeze/ oldstable). I have not investigated if hal then read from procfs or sysfs, but wmbattery at least didn't read from procfs itself, unless explicitly told to do so (USE_HAL=0) during the build since mid 2008. The current version of wmbattery however will never try to access /proc/acpi, the current version no longer knows of its existence. [Again, I'm not familiar with wmbattery myself and have never run it] Stefan, Thanks for looking into this. The newest wmbattery version indeed supports upower. However, I haven't figured out how to get it to work. That's obviously not the kernel's fault, but an unfortunate reality. It seems to really want dbus to be running, but when I start dbus (which nothing else on my system needs, apparently), it just hangs. My knowledge of these things is, (un)fortunately non-existent, so I just gave up on the upower approach. Running something as heavy as dbus just for a silly dock app seems... silly as well. Any news on this one? It seems that delaying fsck on battery power also relies on /proc/acpi/battery... Ok. I will prepare a patch to recover /proc/acpi/battery. https://bbs.archlinux.org/viewtopic.php?id=12168 Pavel -- 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: [PATCHv4 0/8] Resource-managed extcon device register function
Hi Sangjung, On 04/21/2014 07:10 PM, Sangjung Woo wrote: > These patches add resource-managed extcon device register functions for > developers' convenience and apply them to related device driver files. > This work can make the code more tidy since extcon device is automatically > unregistered on driver detach so tiresome managing codes could be removed. > > > Changelog > > v4: > * fix the memory leak bug becuase of single pointer > * clean up the unnecessary code and make proper indentation > > v3: > * send the right version instead of previous v1 > * add the credit for reviewers according to the review rules > > v2: > * modify and clean up all unnecessary code reported by Chanwoo > * fix the bug reported by Seung-Woo > * add the credit for reviewers > > v1: > * initial version > > Sangjung Woo (8): > extcon: Add resource-managed extcon register function > extcon: adc-jack: Use devm_extcon_dev_register() > extcon: gpio: Use devm_extcon_dev_register() > extcon: max14577: Use devm_extcon_dev_register() > extcon: max77693: Use devm_extcon_dev_register() > extcon: max8997: Use devm_extcon_dev_register() > extcon: palmas: Use devm_extcon_dev_register() > extcon: arizona: Use devm_extcon_dev_register() > > drivers/extcon/extcon-adc-jack.c | 30 ++ > drivers/extcon/extcon-arizona.c | 12 +++ > drivers/extcon/extcon-class.c| 64 > ++ > drivers/extcon/extcon-gpio.c | 16 +++--- > drivers/extcon/extcon-max14577.c |9 ++ > drivers/extcon/extcon-max77693.c |7 ++--- > drivers/extcon/extcon-max8997.c |4 +-- > drivers/extcon/extcon-palmas.c | 15 +++-- > include/linux/extcon.h | 17 ++ > 9 files changed, 108 insertions(+), 66 deletions(-) > Applied this patchset. But, applied below patch [1] instead of patch[2] on v4. [1] [PATCHv5] extcon: Add resource-managed extcon register function - https://lkml.org/lkml/2014/4/21/140 [2] [PATCHv4 1/8] extcon: Add resource-managed extcon register function - https://lkml.org/lkml/2014/4/21/128 Thanks, Chanwoo Choi -- 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] mcpm: exynos: populate suspend and powered_up callbacks
In order to support cpuidle through mcpm, suspend and powered-up callbacks are required in mcpm platform code. Hence populate the same callbacks. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- arch/arm/mach-exynos/mcpm-exynos.c | 53 1 file changed, 53 insertions(+) diff --git a/arch/arm/mach-exynos/mcpm-exynos.c b/arch/arm/mach-exynos/mcpm-exynos.c index 46d4968..16af0bd 100644 --- a/arch/arm/mach-exynos/mcpm-exynos.c +++ b/arch/arm/mach-exynos/mcpm-exynos.c @@ -318,10 +318,63 @@ static int exynos_power_down_finish(unsigned int cpu, unsigned int cluster) return 0; /* success: the CPU is halted */ } +static void enable_coherency(void) +{ + unsigned long v, u; + + asm volatile( + "mrcp15, 0, %0, c1, c0, 1\n" + "orr%0, %0, %2\n" + "ldr%1, [%3]\n" + "and%1, %1, #0\n" + "orr%0, %0, %1\n" + "mcrp15, 0, %0, c1, c0, 1\n" + : "=&r" (v), "=&r" (u) + : "Ir" (0x40), "Ir" (S5P_INFORM0) + : "cc"); +} + +void exynos_powered_up(void) +{ + unsigned int mpidr, cpu, cluster; + + mpidr = read_cpuid_mpidr(); + cpu = MPIDR_AFFINITY_LEVEL(mpidr, 0); + cluster = MPIDR_AFFINITY_LEVEL(mpidr, 1); + + arch_spin_lock(&bl_lock); + if (cpu_use_count[cpu][cluster] == 0) + cpu_use_count[cpu][cluster] = 1; + arch_spin_unlock(&bl_lock); +} + +static void exynos_suspend(u64 residency) +{ + unsigned int mpidr, cpunr; + + mpidr = read_cpuid_mpidr(); + cpunr = enynos_pmu_cpunr(mpidr); + + __raw_writel(virt_to_phys(mcpm_entry_point), REG_ENTRY_ADDR); + + exynos_power_down(); + + /* +* Execution reaches here only if cpu did not power down. +* Hence roll back the changes done in exynos_power_down function. + */ + __raw_writel(EXYNOS_CORE_LOCAL_PWR_EN, + EXYNOS_ARM_CORE_CONFIGURATION(cpunr)); + set_cr(get_cr() | CR_C); + enable_coherency(); +} + static const struct mcpm_platform_ops exynos_power_ops = { .power_up = exynos_power_up, .power_down = exynos_power_down, .power_down_finish = exynos_power_down_finish, + .suspend= exynos_suspend, + .powered_up = exynos_powered_up, }; static void __init exynos_mcpm_usage_count_init(void) -- 1.7.9.5 -- 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] driver: cpuidle: cpuidle-big-little: init driver for Exynos5420
Add "samsung,exynos5420" compatible string to initialize generic big-little cpuidle driver for Exynos5420. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- drivers/cpuidle/cpuidle-big_little.c |3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/cpuidle/cpuidle-big_little.c b/drivers/cpuidle/cpuidle-big_little.c index b45fc62..d0fac53 100644 --- a/drivers/cpuidle/cpuidle-big_little.c +++ b/drivers/cpuidle/cpuidle-big_little.c @@ -170,7 +170,8 @@ static int __init bl_idle_init(void) /* * Initialize the driver just for a compliant set of machines */ - if (!of_machine_is_compatible("arm,vexpress,v2p-ca15_a7")) + if (!of_machine_is_compatible("arm,vexpress,v2p-ca15_a7") && + (!of_machine_is_compatible("samsung,exynos5420"))) return -ENODEV; /* * For now the differentiation between little and big cores -- 1.7.9.5 -- 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] cpuidle: config: Add SOC_EXYNOS5420 entry to select cpuidle-big-little driver
Exynos5420 is a big-little SoC from Samsung. It has 4 A15 and 4 A7 cores. In order to use generic cpuidle-big-little driver, this patch adds Exynos5420 specific check to initialize generic cpuidle driver. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- drivers/cpuidle/Kconfig.arm |2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/cpuidle/Kconfig.arm b/drivers/cpuidle/Kconfig.arm index 97ccc31..5244d87 100644 --- a/drivers/cpuidle/Kconfig.arm +++ b/drivers/cpuidle/Kconfig.arm @@ -4,7 +4,7 @@ config ARM_BIG_LITTLE_CPUIDLE bool "Support for ARM big.LITTLE processors" - depends on ARCH_VEXPRESS_TC2_PM + depends on ARCH_VEXPRESS_TC2_PM || SOC_EXYNOS5420 select ARM_CPU_SUSPEND select CPU_IDLE_MULTIPLE_DRIVERS help -- 1.7.9.5 -- 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] exynos: cpuidle: do not allow cpuidle registration for Exynos5420
Exynos5420 is big.Little Soc. It uses cpuidle-big-litle generic cpuidle driver. Hence do not allow exynos cpuidle driver registration for Exynos5420. Signed-off-by: Chander Kashyap Signed-off-by: Chander Kashyap --- arch/arm/mach-exynos/cpuidle.c |3 +++ 1 file changed, 3 insertions(+) diff --git a/arch/arm/mach-exynos/cpuidle.c b/arch/arm/mach-exynos/cpuidle.c index c57cae0..242f75d 100644 --- a/arch/arm/mach-exynos/cpuidle.c +++ b/arch/arm/mach-exynos/cpuidle.c @@ -219,6 +219,9 @@ static int exynos_cpuidle_probe(struct platform_device *pdev) int cpu_id, ret; struct cpuidle_device *device; + if (soc_is_exynos5420()) + return -ENODEV; + if (soc_is_exynos5250()) exynos5_core_down_clk(); -- 1.7.9.5 -- 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/4] add cpuidle support for Exynos5420
Exynos5420 is a big-little Soc from Samsung. It has 4 A15 and 4 A7 cores. This patchset adds cpuidle support for Exynos5420 SoC based on generic big.little cpuidle driver. Tested on SMDK5420. This patch set depends on: 1. [PATCH 0/5] MCPM backend for Exynos5420 http://www.spinics.net/lists/arm-kernel/msg321666.html 2. [PATCH v4] arm: exynos: generalize power register address calculation http://www.spinics.net/lists/arm-kernel/msg324024.html Chander Kashyap (4): cpuidle: config: Add SOC_EXYNOS5420 entry to select cpuidle-big-little driver driver: cpuidle: cpuidle-big-little: init driver for Exynos5420 exynos: cpuidle: do not allow cpuidle registration for Exynos5420 mcpm: exynos: populate suspend and powered_up callbacks arch/arm/mach-exynos/cpuidle.c |3 ++ arch/arm/mach-exynos/mcpm-exynos.c | 53 ++ drivers/cpuidle/Kconfig.arm |2 +- drivers/cpuidle/cpuidle-big_little.c |3 +- 4 files changed, 59 insertions(+), 2 deletions(-) -- 1.7.9.5 -- 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] net: Add rtnl_lock for netif_device_attach/detach
Hello. On 21-04-2014 10:30, Li, ZhenHua wrote: The comment is trying to explain why add a lock here. I can read, thanks. :-) I was wondering about the kernel-doc comment style you've used; AFAIK, it's only good for documenting functions and data structures. The normal multi-line comment style in the networking code is this: /* bla * bla */ From: "Li, Zhen-Hua" As netif_running is called in netif_device_attach/detach. There should be rtnl_lock/unlock called, to avoid dev stat change during netif_device_attach and detach being called. I checked NIC some drivers, some of them have netif_device_attach/detach called between rtnl_lock/unlock, while some drivers do not. This patch is tring to find a generic way to fix this for all NIC drivers. Signed-off-by: Li, Zhen-Hua --- net/core/dev.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/net/core/dev.c b/net/core/dev.c index 5b3042e..795bbc5 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -2190,10 +2190,19 @@ EXPORT_SYMBOL(__dev_kfree_skb_any); */ void netif_device_detach(struct net_device *dev) { +/** Hm, why kernel-doc style comment here? + * As netif_running is called , rtnl_lock and unlock are needed to Space before comma not needed. + * avoid __LINK_STATE_START bit changes during this function call. + */ +int need_unlock; + +need_unlock = rtnl_trylock(); if (test_and_clear_bit(__LINK_STATE_PRESENT, &dev->state) && netif_running(dev)) { netif_tx_stop_all_queues(dev); } +if (need_unlock) +rtnl_unlock(); } EXPORT_SYMBOL(netif_device_detach); @@ -2205,11 +2214,20 @@ EXPORT_SYMBOL(netif_device_detach); */ void netif_device_attach(struct net_device *dev) { +/** ... and here? + * As netif_running is called , rtnl_lock and unlock are needed to Space before comma not needed. + * avoid __LINK_STATE_START bit changes during this function call. + */ 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/
[PATCH 2/2 V3] workqueue: simple refactor pwq_adjust_max_active()
Caculate the value(max_active) for pwq->max_active earlier. Fast exit for max_active is not changed. "if (!freezable && pwq->max_active == wq->saved_max_active)" is hardly hit after __WQ_FREEZING was introduced. So we change the exit-condition to a more possible condition. Reduce wake_up_worker() rate. Signed-off-by: Lai Jiangshan --- kernel/workqueue.c | 21 +++-- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/kernel/workqueue.c b/kernel/workqueue.c index beca98b..59bad6e 100644 --- a/kernel/workqueue.c +++ b/kernel/workqueue.c @@ -198,7 +198,7 @@ struct pool_workqueue { int nr_in_flight[WORK_NR_COLORS]; /* L: nr of in_flight works */ int nr_active; /* L: nr of active works */ - int max_active; /* L: max active works */ + int max_active; /* L&WQ: max active works */ struct list_headdelayed_works; /* L: delayed works */ struct list_headpwqs_node; /* WR: node on wq->pwqs */ struct list_headmayday_node;/* MD: node on wq->maydays */ @@ -3756,20 +3756,23 @@ static void pwq_unbound_release_workfn(struct work_struct *work) static void pwq_adjust_max_active(struct pool_workqueue *pwq) { struct workqueue_struct *wq = pwq->wq; - bool freezable = wq->flags & WQ_FREEZABLE; + int max_active = wq->saved_max_active; /* for @wq->saved_max_active and @wq->flags */ lockdep_assert_held(&wq->mutex); - /* fast exit for non-freezable wqs */ - if (!freezable && pwq->max_active == wq->saved_max_active) + if (wq->flags & __WQ_FREEZING) { + if (!WARN_ON_ONCE(!(wq->flags & WQ_FREEZABLE))) + max_active = 0; + } + + /* fast exit for max_active is not changed */ + if (pwq->max_active == max_active) return; spin_lock_irq(&pwq->pool->lock); - - if (!freezable || !(wq->flags & __WQ_FREEZING)) { - pwq->max_active = wq->saved_max_active; - + pwq->max_active = max_active; + if (pwq->nr_active < pwq->max_active) { while (!list_empty(&pwq->delayed_works) && pwq->nr_active < pwq->max_active) pwq_activate_first_delayed(pwq); @@ -3779,8 +3782,6 @@ static void pwq_adjust_max_active(struct pool_workqueue *pwq) * max_active is bumped. It's a slow path. Do it always. */ wake_up_worker(pwq->pool); - } else { - pwq->max_active = 0; } spin_unlock_irq(&pwq->pool->lock); -- 1.7.4.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/