drivers: prod: Fix kernel version checks

The new Tegra Prod APIs are to be used for NVIDIA Linux kernels v5.16+.
Building the MTTCAN and QUAD SPI driver currently fail for upstream
Linux v5.16 because the various version definitions are not correct.

Some definitions have greater than v5.16.0 instead of greater than OR
equal to v5.16.0. This means that the new APIs will only be used
starting with v5.16.1+ and not v5.16.0 as inteaded.

Other definitions have less than or equal to v5.16.0 instead of just
less than v5.16.0. This means that we will still use the legacy APIs for
v5.16.0.

Fix this by correcting the definition that the drivers can be built for
upstream Linux v5.16.

Bug 4097475

Change-Id: I7d8dd04911a7d6426c67e82396c8a6f1b372875d
Signed-off-by: Jon Hunter <jonathanh@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/c/linux-nv-oot/+/3006521
Reviewed-by: Laxman Dewangan <ldewangan@nvidia.com>
GVS: Gerrit_Virtual_Submit <buildbot_gerritrpt@nvidia.com>
This commit is contained in:
Jon Hunter
2023-10-30 12:23:04 +00:00
committed by mobile promotions
parent e8d516daf3
commit 325bd67f86
2 changed files with 5 additions and 5 deletions

View File

@@ -12,7 +12,7 @@
#define CAN_MSG_FLUSH_TIMEOUT 100 #define CAN_MSG_FLUSH_TIMEOUT 100
static void mttcan_start(struct net_device *dev); static void mttcan_start(struct net_device *dev);
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 16, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#define MTTCAN_PROD_FIELD(name, rindex, roffset, fname) \ #define MTTCAN_PROD_FIELD(name, rindex, roffset, fname) \
{ \ { \
.field_name = name, \ .field_name = name, \

View File

@@ -254,14 +254,14 @@ struct tegra_qspi {
dma_addr_t tx_dma_phys; dma_addr_t tx_dma_phys;
struct dma_async_tx_descriptor *tx_dma_desc; struct dma_async_tx_descriptor *tx_dma_desc;
const struct tegra_qspi_soc_data *soc_data; const struct tegra_qspi_soc_data *soc_data;
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 16, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
struct tegra_prod_cfg_list *prod_list; struct tegra_prod_cfg_list *prod_list;
#else #else
struct tegra_prod *prod_list; struct tegra_prod *prod_list;
#endif #endif
}; };
#if LINUX_VERSION_CODE > KERNEL_VERSION(5, 16, 0) #if LINUX_VERSION_CODE >= KERNEL_VERSION(5, 16, 0)
#define QSPI_PROD_FIELD(name, rindex, roffset, fname) \ #define QSPI_PROD_FIELD(name, rindex, roffset, fname) \
{ \ { \
.field_name = name, \ .field_name = name, \
@@ -996,7 +996,7 @@ static void tegra_qspi_set_gr_registers(struct tegra_qspi *tqspi)
/* If available, initialise the config registers /* If available, initialise the config registers
* for QSPI with the values mentioned in prod list. * for QSPI with the values mentioned in prod list.
*/ */
#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 16, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
err = tegra_prod_set_by_name(&tqspi->base, "prod", tqspi->prod_list); err = tegra_prod_set_by_name(&tqspi->base, "prod", tqspi->prod_list);
if (err < 0) if (err < 0)
dev_info_once(tqspi->dev, dev_info_once(tqspi->dev,
@@ -1726,7 +1726,7 @@ static int tegra_qspi_probe(struct platform_device *pdev)
tqspi->master = master; tqspi->master = master;
tqspi->dev = &pdev->dev; tqspi->dev = &pdev->dev;
#if LINUX_VERSION_CODE <= KERNEL_VERSION(5, 16, 0) #if LINUX_VERSION_CODE < KERNEL_VERSION(5, 16, 0)
tqspi->prod_list = devm_tegra_prod_get(&pdev->dev); tqspi->prod_list = devm_tegra_prod_get(&pdev->dev);
#else #else
tqspi->prod_list = devm_tegra_prod_get_list(&pdev->dev, &qspi_prod_dev_info); tqspi->prod_list = devm_tegra_prod_get_list(&pdev->dev, &qspi_prod_dev_info);