Skip to content

Commit 95bef89

Browse files
committed
Merge branch 'for-next' of git://git.kernel.org/pub/scm/linux/kernel/git/pateldipen1984/linux.git
# Conflicts: # drivers/hte/Kconfig
2 parents d56b65a + fc62d5e commit 95bef89

File tree

4 files changed

+23
-26
lines changed

4 files changed

+23
-26
lines changed

drivers/hte/Kconfig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ if HTE
1616

1717
config HTE_TEGRA194
1818
tristate "NVIDIA Tegra194 HTE Support"
19-
depends on ARCH_TEGRA_194_SOC
19+
depends on (ARCH_TEGRA_194_SOC || COMPILE_TEST)
2020
depends on GPIOLIB
2121
help
2222
Enable this option for integrated hardware timestamping engine also
@@ -26,7 +26,7 @@ config HTE_TEGRA194
2626

2727
config HTE_TEGRA194_TEST
2828
tristate "NVIDIA Tegra194 HTE Test"
29-
depends on HTE_TEGRA194
29+
depends on (HTE_TEGRA194 || COMPILE_TEST)
3030
help
3131
The NVIDIA Tegra194 GTE test driver demonstrates how to use HTE
3232
framework to timestamp GPIO and LIC IRQ lines.

drivers/hte/hte-tegra194-test.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,10 @@ static int tegra_hte_test_probe(struct platform_device *pdev)
153153
}
154154

155155
cnt = of_hte_req_count(hte.pdev);
156-
if (cnt < 0)
156+
if (cnt < 0) {
157+
ret = cnt;
157158
goto free_irq;
159+
}
158160

159161
dev_info(&pdev->dev, "Total requested lines:%d\n", cnt);
160162

drivers/hte/hte-tegra194.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -407,12 +407,15 @@ static int tegra_hte_line_xlate(struct hte_chip *gc,
407407
return -EINVAL;
408408

409409
/*
410+
* GPIO consumers can access GPIOs in two ways:
410411
*
411-
* There are two paths GPIO consumers can take as follows:
412-
* 1) The consumer (gpiolib-cdev for example) which uses GPIO global
413-
* number which gets assigned run time.
414-
* 2) The consumer passing GPIO from the DT which is assigned
415-
* statically for example by using TEGRA194_AON_GPIO gpio DT binding.
412+
* 1) Using the global GPIO numberspace.
413+
*
414+
* This is the old, now DEPRECATED method and should not be used in
415+
* new code. TODO: Check if tegra is even concerned by this.
416+
*
417+
* 2) Using GPIO descriptors that can be assigned to consumer devices
418+
* using device-tree, ACPI or lookup tables.
416419
*
417420
* The code below addresses both the consumer use cases and maps into
418421
* HTE/GTE namespace.
@@ -725,10 +728,8 @@ static int tegra_hte_probe(struct platform_device *pdev)
725728
return -ENOMEM;
726729

727730
ret = platform_get_irq(pdev, 0);
728-
if (ret < 0) {
729-
dev_err_probe(dev, ret, "failed to get irq\n");
731+
if (ret < 0)
730732
return ret;
731-
}
732733
hte_dev->hte_irq = ret;
733734
ret = devm_request_irq(dev, hte_dev->hte_irq, tegra_hte_isr, 0,
734735
dev_name(dev), hte_dev);
@@ -811,7 +812,7 @@ static int tegra_hte_probe(struct platform_device *pdev)
811812
return 0;
812813
}
813814

814-
static int __maybe_unused tegra_hte_resume_early(struct device *dev)
815+
static int tegra_hte_resume_early(struct device *dev)
815816
{
816817
u32 i;
817818
struct tegra_hte_soc *gs = dev_get_drvdata(dev);
@@ -832,7 +833,7 @@ static int __maybe_unused tegra_hte_resume_early(struct device *dev)
832833
return 0;
833834
}
834835

835-
static int __maybe_unused tegra_hte_suspend_late(struct device *dev)
836+
static int tegra_hte_suspend_late(struct device *dev)
836837
{
837838
u32 i;
838839
struct tegra_hte_soc *gs = dev_get_drvdata(dev);
@@ -852,15 +853,14 @@ static int __maybe_unused tegra_hte_suspend_late(struct device *dev)
852853
}
853854

854855
static const struct dev_pm_ops tegra_hte_pm = {
855-
SET_LATE_SYSTEM_SLEEP_PM_OPS(tegra_hte_suspend_late,
856-
tegra_hte_resume_early)
856+
LATE_SYSTEM_SLEEP_PM_OPS(tegra_hte_suspend_late, tegra_hte_resume_early)
857857
};
858858

859859
static struct platform_driver tegra_hte_driver = {
860860
.probe = tegra_hte_probe,
861861
.driver = {
862862
.name = "tegra_hte",
863-
.pm = &tegra_hte_pm,
863+
.pm = pm_sleep_ptr(&tegra_hte_pm),
864864
.of_match_table = tegra_hte_of_match,
865865
},
866866
};

drivers/hte/hte.c

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@
1717
#include <linux/debugfs.h>
1818
#include <linux/device.h>
1919

20-
#define HTE_TS_NAME_LEN 10
21-
2220
/* Global list of the HTE devices */
2321
static DEFINE_SPINLOCK(hte_lock);
2422
static LIST_HEAD(hte_devices);
@@ -88,7 +86,7 @@ struct hte_device {
8886
struct list_head list;
8987
struct hte_chip *chip;
9088
struct module *owner;
91-
struct hte_ts_info ei[];
89+
struct hte_ts_info ei[] __counted_by(nlines);
9290
};
9391

9492
#ifdef CONFIG_DEBUG_FS
@@ -389,13 +387,10 @@ static int __hte_req_ts(struct hte_ts_desc *desc, hte_ts_cb_t cb,
389387

390388
atomic_inc(&gdev->ts_req);
391389

392-
ei->line_name = NULL;
393-
if (!desc->attr.name) {
394-
ei->line_name = kzalloc(HTE_TS_NAME_LEN, GFP_KERNEL);
395-
if (ei->line_name)
396-
scnprintf(ei->line_name, HTE_TS_NAME_LEN, "ts_%u",
397-
desc->attr.line_id);
398-
}
390+
if (desc->attr.name)
391+
ei->line_name = NULL;
392+
else
393+
ei->line_name = kasprintf(GFP_KERNEL, "ts_%u", desc->attr.line_id);
399394

400395
hte_ts_dbgfs_init(desc->attr.name == NULL ?
401396
ei->line_name : desc->attr.name, ei);

0 commit comments

Comments
 (0)