Message ID | 1692717141-32743-4-git-send-email-quic_krichai@quicinc.com |
---|---|
State | New |
Headers | show |
Series | None | expand |
Hi Krishna, kernel test robot noticed the following build errors: [auto build test ERROR on pci/for-linus] [also build test ERROR on robh/for-next rafael-pm/linux-next linus/master v6.5-rc7 next-20230822] [cannot apply to pci/next] [If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Krishna-chaitanya-chundru/dt-bindings-pci-qcom-Add-opp-table/20230822-232104 base: https://git.kernel.org/pub/scm/linux/kernel/git/pci/pci.git for-linus patch link: https://lore.kernel.org/r/1692717141-32743-4-git-send-email-quic_krichai%40quicinc.com patch subject: [PATCH v4 3/4] OPP: Add api to retrieve opps which is at most the provided level config: um-allnoconfig (https://download.01.org/0day-ci/archive/20230823/202308230750.JgHxIvTb-lkp@intel.com/config) compiler: clang version 17.0.0 (https://github.com/llvm/llvm-project.git 4a5ac14ee968ff0ad5d2cc1ffa0299048db4c88a) reproduce: (https://download.01.org/0day-ci/archive/20230823/202308230750.JgHxIvTb-lkp@intel.com/reproduce) If you fix the issue in a separate patch/commit (i.e. not just a new version of the same patch/commit), kindly add following tags | Reported-by: kernel test robot <lkp@intel.com> | Closes: https://lore.kernel.org/oe-kbuild-all/202308230750.JgHxIvTb-lkp@intel.com/ All errors (new ones prefixed by >>): In file included from kernel/cpu.c:13: In file included from include/linux/sched/isolation.h:6: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from kernel/cpu.c:13: In file included from include/linux/sched/isolation.h:6: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from kernel/cpu.c:13: In file included from include/linux/sched/isolation.h:6: In file included from include/linux/tick.h:8: In file included from include/linux/clockchips.h:14: In file included from include/linux/clocksource.h:22: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 692 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 700 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 708 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 717 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 726 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 735 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ In file included from kernel/cpu.c:41: In file included from include/trace/events/power.h:8: In file included from include/linux/cpufreq.h:18: >> include/linux/pm_opp.h:289:34: error: expected ';' after top level declarator 289 | unsigned int *bw, int index) | ^ | ; 12 warnings and 1 error generated. -- In file included from drivers/base/core.c:12: In file included from include/linux/cpufreq.h:18: >> include/linux/pm_opp.h:289:34: error: expected ';' after top level declarator 289 | unsigned int *bw, int index) | ^ | ; In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:97:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 97 | return (set->sig[3] | set->sig[2] | | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:97:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 97 | return (set->sig[3] | set->sig[2] | | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:98:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 98 | set->sig[1] | set->sig[0]) == 0; | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:100:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 100 | return (set->sig[1] | set->sig[0]) == 0; | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:113:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 113 | return (set1->sig[3] == set2->sig[3]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:113:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 113 | return (set1->sig[3] == set2->sig[3]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from drivers/base/core.c:25: In file included from include/linux/blkdev.h:9: In file included from include/linux/blk_types.h:10: In file included from include/linux/bvec.h:10: In file included from include/linux/highmem.h:5: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: -- In file included from kernel/power/qos.c:40: In file included from include/trace/events/power.h:8: In file included from include/linux/cpufreq.h:18: >> include/linux/pm_opp.h:289:34: error: expected ';' after top level declarator 289 | unsigned int *bw, int index) | ^ | ; In file included from kernel/power/qos.c:40: In file included from include/trace/events/power.h:12: In file included from include/linux/trace_events.h:9: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:547:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 547 | val = __raw_readb(PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:560:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 560 | val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu' 37 | #define __le16_to_cpu(x) ((__force __u16)(__le16)(x)) | ^ In file included from kernel/power/qos.c:40: In file included from include/trace/events/power.h:12: In file included from include/linux/trace_events.h:9: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:573:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 573 | val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr)); | ~~~~~~~~~~ ^ include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu' 35 | #define __le32_to_cpu(x) ((__force __u32)(__le32)(x)) | ^ In file included from kernel/power/qos.c:40: In file included from include/trace/events/power.h:12: In file included from include/linux/trace_events.h:9: In file included from include/linux/hardirq.h:11: In file included from arch/um/include/asm/hardirq.h:5: In file included from include/asm-generic/hardirq.h:17: In file included from include/linux/irq.h:20: In file included from include/linux/io.h:13: In file included from arch/um/include/asm/io.h:24: include/asm-generic/io.h:584:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 584 | __raw_writeb(value, PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:594:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 594 | __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:604:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 604 | __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr); | ~~~~~~~~~~ ^ include/asm-generic/io.h:692:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 692 | readsb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:700:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 700 | readsw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:708:20: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 708 | readsl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:717:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 717 | writesb(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:726:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 726 | writesw(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ include/asm-generic/io.h:735:21: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic] 735 | writesl(PCI_IOBASE + addr, buffer, count); | ~~~~~~~~~~ ^ 12 warnings and 1 error generated. -- In file included from fs/proc/cpuinfo.c:2: In file included from include/linux/cpufreq.h:18: >> include/linux/pm_opp.h:289:34: error: expected ';' after top level declarator 289 | unsigned int *bw, int index) | ^ | ; In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:97:11: warning: array index 3 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 97 | return (set->sig[3] | set->sig[2] | | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:97:25: warning: array index 2 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 97 | return (set->sig[3] | set->sig[2] | | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:98:4: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 98 | set->sig[1] | set->sig[0]) == 0; | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:100:11: warning: array index 1 is past the end of the array (that has type 'unsigned long[1]') [-Warray-bounds] 100 | return (set->sig[1] | set->sig[0]) == 0; | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:113:11: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 113 | return (set1->sig[3] == set2->sig[3]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:113:27: warning: array index 3 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 113 | return (set1->sig[3] == set2->sig[3]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:114:5: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 114 | (set1->sig[2] == set2->sig[2]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:114:21: warning: array index 2 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 114 | (set1->sig[2] == set2->sig[2]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here 24 | unsigned long sig[_NSIG_WORDS]; | ^ In file included from fs/proc/cpuinfo.c:3: In file included from include/linux/fs.h:33: In file included from include/linux/percpu-rwsem.h:7: In file included from include/linux/rcuwait.h:6: In file included from include/linux/sched/signal.h:6: include/linux/signal.h:115:5: warning: array index 1 is past the end of the array (that has type 'const unsigned long[1]') [-Warray-bounds] 115 | (set1->sig[1] == set2->sig[1]) && | ^ ~ arch/x86/include/asm/signal.h:24:2: note: array 'sig' declared here .. vim +289 include/linux/pm_opp.h 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 287 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 288 static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 @289 unsigned int *bw, int index) f220ddccf1afc8 Krishna chaitanya chundru 2023-08-22 290 static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, f220ddccf1afc8 Krishna chaitanya chundru 2023-08-22 291 unsigned long *level) 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 292 { 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 293 return ERR_PTR(-EOPNOTSUPP); 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 294 } 00ce3873f730fb Krzysztof Kozlowski 2022-05-04 295
On Tue, Aug 22, 2023 at 08:42:20PM +0530, Krishna chaitanya chundru wrote: > Add dev_pm_opp_find_level_floor() for searching a lesser match or > operating on OPP in the order of decreasing level. > "OPP: Add api to retrieve opps which is at most the provided level". Pls change this to "opp: Add dev_pm_opp_find_level_floor()". The API name conveys the message. In the description, you can give a use case. i.e voting for the max level during initialization of a driver. > Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> > --- > drivers/opp/core.c | 26 ++++++++++++++++++++++++++ > include/linux/pm_opp.h | 4 ++++ > 2 files changed, 30 insertions(+) > > diff --git a/drivers/opp/core.c b/drivers/opp/core.c > index 954c948..e668cf2 100644 > --- a/drivers/opp/core.c > +++ b/drivers/opp/core.c > @@ -727,6 +727,32 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, > } > EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil); > > + > +/** > + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq > + * @dev: device for which we do this operation > + * @freq: Start level > + * %s/freq/level Run make W=1 so that kerneldoc is tested. > + * Search for the matching floor *available* OPP from a starting level > + * for a device. > + * > + * Return: matching *opp and refreshes *level accordingly, else returns > + * ERR_PTR in case of error and should be handled using IS_ERR. Error return > + * values can be: What do you mean by refresh here? > + * EINVAL: for bad pointer > + * ERANGE: no match found for search > + * ENODEV: if device not found in list of registered devices > + * > + * The callers are required to call dev_pm_opp_put() for the returned OPP after > + * use. > + */ > +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, > + unsigned long *level) > +{ > + return _find_key_floor(dev, level, 0, true, _read_level, NULL); > +} > +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor); > + > /** > * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth > * @dev: device for which we do this operation > diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h > index dc1fb58..a3bc386 100644 > --- a/include/linux/pm_opp.h > +++ b/include/linux/pm_opp.h > @@ -128,6 +128,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, > unsigned int level); > struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, > unsigned int *level); > +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, > + unsigned long *level); > > struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, > unsigned long *freq); > @@ -285,6 +287,8 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, > > static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, > unsigned int *bw, int index) > +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, > + unsigned long *level) > { > return ERR_PTR(-EOPNOTSUPP); > } > Please run ./scripts/checkpatch.pl --strict <your patch> and fix the indentation warnings from this patch. Thanks, Pavan
On 8/23/2023 6:35 AM, Pavan Kondeti wrote: > On Tue, Aug 22, 2023 at 08:42:20PM +0530, Krishna chaitanya chundru wrote: >> Add dev_pm_opp_find_level_floor() for searching a lesser match or >> operating on OPP in the order of decreasing level. >> > "OPP: Add api to retrieve opps which is at most the provided level". Pls > change this to "opp: Add dev_pm_opp_find_level_floor()". The API name > conveys the message. > > In the description, you can give a use case. i.e voting for the max > level during initialization of a driver. > Done >> Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> >> --- >> drivers/opp/core.c | 26 ++++++++++++++++++++++++++ >> include/linux/pm_opp.h | 4 ++++ >> 2 files changed, 30 insertions(+) >> >> diff --git a/drivers/opp/core.c b/drivers/opp/core.c >> index 954c948..e668cf2 100644 >> --- a/drivers/opp/core.c >> +++ b/drivers/opp/core.c >> @@ -727,6 +727,32 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, >> } >> EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil); >> >> + >> +/** >> + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq >> + * @dev: device for which we do this operation >> + * @freq: Start level >> + * > %s/freq/level > > Run make W=1 so that kerneldoc is tested. Done >> + * Search for the matching floor *available* OPP from a starting level >> + * for a device. >> + * >> + * Return: matching *opp and refreshes *level accordingly, else returns >> + * ERR_PTR in case of error and should be handled using IS_ERR. Error return >> + * values can be: > What do you mean by refresh here? LevelĀ argument will be updated by this API with the opp level being returned here, I was trying to use same terminology used in other API's >> + * EINVAL: for bad pointer >> + * ERANGE: no match found for search >> + * ENODEV: if device not found in list of registered devices >> + * >> + * The callers are required to call dev_pm_opp_put() for the returned OPP after >> + * use. >> + */ >> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, >> + unsigned long *level) >> +{ >> + return _find_key_floor(dev, level, 0, true, _read_level, NULL); >> +} >> +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor); >> + >> /** >> * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth >> * @dev: device for which we do this operation >> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h >> index dc1fb58..a3bc386 100644 >> --- a/include/linux/pm_opp.h >> +++ b/include/linux/pm_opp.h >> @@ -128,6 +128,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, >> unsigned int level); >> struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, >> unsigned int *level); >> +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, >> + unsigned long *level); >> >> struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, >> unsigned long *freq); >> @@ -285,6 +287,8 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, >> >> static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, >> unsigned int *bw, int index) >> +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, >> + unsigned long *level) >> { >> return ERR_PTR(-EOPNOTSUPP); >> } >> > Please run ./scripts/checkpatch.pl --strict <your patch> and fix the > indentation warnings from this patch. > > Thanks, > Pavan Done - KC
diff --git a/drivers/opp/core.c b/drivers/opp/core.c index 954c948..e668cf2 100644 --- a/drivers/opp/core.c +++ b/drivers/opp/core.c @@ -727,6 +727,32 @@ struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, } EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_ceil); + +/** + * dev_pm_opp_find_level_floor() - Search for a rounded floor freq + * @dev: device for which we do this operation + * @freq: Start level + * + * Search for the matching floor *available* OPP from a starting level + * for a device. + * + * Return: matching *opp and refreshes *level accordingly, else returns + * ERR_PTR in case of error and should be handled using IS_ERR. Error return + * values can be: + * EINVAL: for bad pointer + * ERANGE: no match found for search + * ENODEV: if device not found in list of registered devices + * + * The callers are required to call dev_pm_opp_put() for the returned OPP after + * use. + */ +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, + unsigned long *level) +{ + return _find_key_floor(dev, level, 0, true, _read_level, NULL); +} +EXPORT_SYMBOL_GPL(dev_pm_opp_find_level_floor); + /** * dev_pm_opp_find_bw_ceil() - Search for a rounded ceil bandwidth * @dev: device for which we do this operation diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h index dc1fb58..a3bc386 100644 --- a/include/linux/pm_opp.h +++ b/include/linux/pm_opp.h @@ -128,6 +128,8 @@ struct dev_pm_opp *dev_pm_opp_find_level_exact(struct device *dev, unsigned int level); struct dev_pm_opp *dev_pm_opp_find_level_ceil(struct device *dev, unsigned int *level); +struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, + unsigned long *level); struct dev_pm_opp *dev_pm_opp_find_freq_ceil(struct device *dev, unsigned long *freq); @@ -285,6 +287,8 @@ static inline struct dev_pm_opp *dev_pm_opp_find_bw_ceil(struct device *dev, static inline struct dev_pm_opp *dev_pm_opp_find_bw_floor(struct device *dev, unsigned int *bw, int index) +static inline struct dev_pm_opp *dev_pm_opp_find_level_floor(struct device *dev, + unsigned long *level) { return ERR_PTR(-EOPNOTSUPP); }
Add dev_pm_opp_find_level_floor() for searching a lesser match or operating on OPP in the order of decreasing level. Signed-off-by: Krishna chaitanya chundru <quic_krichai@quicinc.com> --- drivers/opp/core.c | 26 ++++++++++++++++++++++++++ include/linux/pm_opp.h | 4 ++++ 2 files changed, 30 insertions(+)