diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2023-10-31 18:32:51 -1000 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2023-10-31 18:32:51 -1000 |
commit | c52894359395ea0a562b3ed556848ed66fbfff86 (patch) | |
tree | 5667b0e341ccc8dc7e160f13d2de6de48feee626 | |
parent | 59fff63cc2b75dcfe08f9eeb4b2187d73e53843d (diff) | |
parent | fc62d5e214df2dd64f5d675f01b609d86a422a2b (diff) |
Merge tag 'for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux
Pull hte/timestamp updates from Dipen Patel:
- Improve comments in the translate function
- Reflect the GPIOLIB API changes during calculation of the GPIO base
- Improve error handling in Tegra test and provider drivers
- Improve code to set the line name
* tag 'for-6.7-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux:
hte: Use kasprintf() instead of fixed buffer formatting
hte: tegra: Fix missing error code in tegra_hte_test_probe()
hte: tegra194: Switch to LATE_SIMPLE_DEV_PM_OPS()
hte: tegra194: Remove redundant dev_err()
hte: tegra194: improve the GPIO-related comment
hte: allow building modules with COMPILE_TEST enabled
hte: Annotate struct hte_device with __counted_by
-rw-r--r-- | drivers/hte/Kconfig | 4 | ||||
-rw-r--r-- | drivers/hte/hte-tegra194-test.c | 4 | ||||
-rw-r--r-- | drivers/hte/hte-tegra194.c | 26 | ||||
-rw-r--r-- | drivers/hte/hte.c | 15 |
4 files changed, 23 insertions, 26 deletions
diff --git a/drivers/hte/Kconfig b/drivers/hte/Kconfig index 8e0fd818a73e..641af722b555 100644 --- a/drivers/hte/Kconfig +++ b/drivers/hte/Kconfig @@ -16,7 +16,7 @@ if HTE config HTE_TEGRA194 tristate "NVIDIA Tegra194 HTE Support" - depends on ARCH_TEGRA_194_SOC + depends on (ARCH_TEGRA_194_SOC || COMPILE_TEST) depends on GPIOLIB help Enable this option for integrated hardware timestamping engine also @@ -26,7 +26,7 @@ config HTE_TEGRA194 config HTE_TEGRA194_TEST tristate "NVIDIA Tegra194 HTE Test" - depends on HTE_TEGRA194 + depends on (HTE_TEGRA194 || COMPILE_TEST) help The NVIDIA Tegra194 GTE test driver demonstrates how to use HTE framework to timestamp GPIO and LIC IRQ lines. diff --git a/drivers/hte/hte-tegra194-test.c b/drivers/hte/hte-tegra194-test.c index ba37a5efbf82..ab2edff018eb 100644 --- a/drivers/hte/hte-tegra194-test.c +++ b/drivers/hte/hte-tegra194-test.c @@ -153,8 +153,10 @@ static int tegra_hte_test_probe(struct platform_device *pdev) } cnt = of_hte_req_count(hte.pdev); - if (cnt < 0) + if (cnt < 0) { + ret = cnt; goto free_irq; + } dev_info(&pdev->dev, "Total requested lines:%d\n", cnt); diff --git a/drivers/hte/hte-tegra194.c b/drivers/hte/hte-tegra194.c index 341a134cb7d0..690eb9be30fb 100644 --- a/drivers/hte/hte-tegra194.c +++ b/drivers/hte/hte-tegra194.c @@ -407,12 +407,15 @@ static int tegra_hte_line_xlate(struct hte_chip *gc, return -EINVAL; /* + * GPIO consumers can access GPIOs in two ways: * - * There are two paths GPIO consumers can take as follows: - * 1) The consumer (gpiolib-cdev for example) which uses GPIO global - * number which gets assigned run time. - * 2) The consumer passing GPIO from the DT which is assigned - * statically for example by using TEGRA194_AON_GPIO gpio DT binding. + * 1) Using the global GPIO numberspace. + * + * This is the old, now DEPRECATED method and should not be used in + * new code. TODO: Check if tegra is even concerned by this. + * + * 2) Using GPIO descriptors that can be assigned to consumer devices + * using device-tree, ACPI or lookup tables. * * The code below addresses both the consumer use cases and maps into * HTE/GTE namespace. @@ -725,10 +728,8 @@ static int tegra_hte_probe(struct platform_device *pdev) return -ENOMEM; ret = platform_get_irq(pdev, 0); - if (ret < 0) { - dev_err_probe(dev, ret, "failed to get irq\n"); + if (ret < 0) return ret; - } hte_dev->hte_irq = ret; ret = devm_request_irq(dev, hte_dev->hte_irq, tegra_hte_isr, 0, dev_name(dev), hte_dev); @@ -811,7 +812,7 @@ static int tegra_hte_probe(struct platform_device *pdev) return 0; } -static int __maybe_unused tegra_hte_resume_early(struct device *dev) +static int tegra_hte_resume_early(struct device *dev) { u32 i; struct tegra_hte_soc *gs = dev_get_drvdata(dev); @@ -832,7 +833,7 @@ static int __maybe_unused tegra_hte_resume_early(struct device *dev) return 0; } -static int __maybe_unused tegra_hte_suspend_late(struct device *dev) +static int tegra_hte_suspend_late(struct device *dev) { u32 i; struct tegra_hte_soc *gs = dev_get_drvdata(dev); @@ -852,15 +853,14 @@ static int __maybe_unused tegra_hte_suspend_late(struct device *dev) } static const struct dev_pm_ops tegra_hte_pm = { - SET_LATE_SYSTEM_SLEEP_PM_OPS(tegra_hte_suspend_late, - tegra_hte_resume_early) + LATE_SYSTEM_SLEEP_PM_OPS(tegra_hte_suspend_late, tegra_hte_resume_early) }; static struct platform_driver tegra_hte_driver = { .probe = tegra_hte_probe, .driver = { .name = "tegra_hte", - .pm = &tegra_hte_pm, + .pm = pm_sleep_ptr(&tegra_hte_pm), .of_match_table = tegra_hte_of_match, }, }; diff --git a/drivers/hte/hte.c b/drivers/hte/hte.c index 598a716b7364..23a6eeb8c506 100644 --- a/drivers/hte/hte.c +++ b/drivers/hte/hte.c @@ -17,8 +17,6 @@ #include <linux/debugfs.h> #include <linux/device.h> -#define HTE_TS_NAME_LEN 10 - /* Global list of the HTE devices */ static DEFINE_SPINLOCK(hte_lock); static LIST_HEAD(hte_devices); @@ -88,7 +86,7 @@ struct hte_device { struct list_head list; struct hte_chip *chip; struct module *owner; - struct hte_ts_info ei[]; + struct hte_ts_info ei[] __counted_by(nlines); }; #ifdef CONFIG_DEBUG_FS @@ -389,13 +387,10 @@ static int __hte_req_ts(struct hte_ts_desc *desc, hte_ts_cb_t cb, atomic_inc(&gdev->ts_req); - ei->line_name = NULL; - if (!desc->attr.name) { - ei->line_name = kzalloc(HTE_TS_NAME_LEN, GFP_KERNEL); - if (ei->line_name) - scnprintf(ei->line_name, HTE_TS_NAME_LEN, "ts_%u", - desc->attr.line_id); - } + if (desc->attr.name) + ei->line_name = NULL; + else + ei->line_name = kasprintf(GFP_KERNEL, "ts_%u", desc->attr.line_id); hte_ts_dbgfs_init(desc->attr.name == NULL ? ei->line_name : desc->attr.name, ei); |