Commit c5289435 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
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
parents 59fff63c fc62d5e2
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -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.
+3 −1
Original line number Diff line number Diff line
@@ -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);

+13 −13
Original line number Diff line number Diff line
@@ -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,
	},
};
+5 −10
Original line number Diff line number Diff line
@@ -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);

	if (desc->attr.name)
		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);
	}
	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);