mirror of
git://nv-tegra.nvidia.com/linux-nv-oot.git
synced 2025-12-22 17:25:35 +03:00
pwm: Use conftest to find if pwm_ops has config
Use conftest to determine if pwm_ops struct has config
callback or not. This call back is deprecated from
commit 0829c35dc534 ("pwm: Drop support for legacy drivers")
in Linux 6.0.
Bug 4387902
Change-Id: Ic56d5955e5cfd15acb664fc11b549b9b91277182
Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3037039
Reviewed-by: Shardar Mohammed <smohammed@nvidia.com>
Reviewed-by: Bitan Biswas <bbiswas@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
committed by
mobile promotions
parent
9974fda1d2
commit
b7cbe748e1
@@ -16,7 +16,6 @@
|
|||||||
#include <linux/io.h>
|
#include <linux/io.h>
|
||||||
#include <linux/hwmon.h>
|
#include <linux/hwmon.h>
|
||||||
#include <linux/hwmon-sysfs.h>
|
#include <linux/hwmon-sysfs.h>
|
||||||
#include <linux/version.h>
|
|
||||||
|
|
||||||
#define DRIVER_NAME "pwm_tach"
|
#define DRIVER_NAME "pwm_tach"
|
||||||
|
|
||||||
@@ -144,7 +143,7 @@ static inline void tachometer_writel(struct pwm_tegra_tach *ptt, u32 val,
|
|||||||
writel(val, ptt->regs + reg);
|
writel(val, ptt->regs + reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0))
|
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
|
||||||
static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
static int tegra_pwm_config(struct pwm_chip *chip, struct pwm_device *pwm,
|
||||||
int duty_ns, int period_ns)
|
int duty_ns, int period_ns)
|
||||||
{
|
{
|
||||||
@@ -310,7 +309,7 @@ static irqreturn_t tegra_pwm_tach_irq(int irq, void *dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static const struct pwm_ops pwm_tegra_tach_ops = {
|
static const struct pwm_ops pwm_tegra_tach_ops = {
|
||||||
#if (LINUX_VERSION_CODE < KERNEL_VERSION(6, 0, 0))
|
#if defined(NV_PWM_OPS_STRUCT_HAS_CONFIG) /* Linux 6.0 */
|
||||||
.config = tegra_pwm_config,
|
.config = tegra_pwm_config,
|
||||||
.enable = tegra_pwm_enable,
|
.enable = tegra_pwm_enable,
|
||||||
.disable = tegra_pwm_disable,
|
.disable = tegra_pwm_disable,
|
||||||
|
|||||||
@@ -134,6 +134,7 @@ NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpio_chip_struct_has_of_node_present
|
|||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpiochip_find
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += gpiochip_find
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pde_data
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_owner
|
||||||
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pwm_ops_struct_has_config
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_epc_event_ops_struct_has_core_deinit
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_disable_pcie_error_reporting
|
||||||
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting
|
NV_CONFTEST_FUNCTION_COMPILE_TESTS += pci_enable_pcie_error_reporting
|
||||||
|
|||||||
@@ -7163,6 +7163,22 @@ compile_test() {
|
|||||||
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
|
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_OWNER" "" "types"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
pwm_ops_struct_has_config)
|
||||||
|
#
|
||||||
|
# Determine if the pwm_ops struct has config callback or not
|
||||||
|
#
|
||||||
|
# Removed from commit 0829c35dc534 ("pwm: Drop support for legacy drivers")
|
||||||
|
# in Linux 6.0
|
||||||
|
#
|
||||||
|
CODE="
|
||||||
|
#include <linux/pwm.h>
|
||||||
|
int conftest_pwm_ops_struct_has_owner(void) {
|
||||||
|
return offsetof(struct pwm_ops, config);
|
||||||
|
}"
|
||||||
|
|
||||||
|
compile_check_conftest "$CODE" "NV_PWM_OPS_STRUCT_HAS_CONFIG" "" "types"
|
||||||
|
;;
|
||||||
|
|
||||||
pci_epc_event_ops_struct_has_core_deinit)
|
pci_epc_event_ops_struct_has_core_deinit)
|
||||||
#
|
#
|
||||||
# Determine if the pci_epc_event_ops struct has the core_deinit function.
|
# Determine if the pci_epc_event_ops struct has the core_deinit function.
|
||||||
|
|||||||
Reference in New Issue
Block a user