Commit 176eb927 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Martin K. Petersen

scsi: ufs: hisi: fix ufs_hba_variant_ops passing

Without CONFIG_OF, the of_match_node() helper does not evaluate its
argument, and the compiler warns about the unused variable:

drivers/scsi/ufs/ufs-hisi.c: In function 'ufs_hisi_probe':
drivers/scsi/ufs/ufs-hisi.c:673:17: error: unused variable 'dev' [-Werror=unused-variable]

Rework this code to pass the data directly, and while we're at it,
correctly handle the const pointers.

Fixes: 653fcb07 ("scsi: ufs: Add HI3670 SoC UFS driver support")
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Reviewed-by: default avatarAvri Altman <avri.altman@wdc.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent db0f166e
...@@ -640,7 +640,7 @@ static int ufs_hi3670_init(struct ufs_hba *hba) ...@@ -640,7 +640,7 @@ static int ufs_hi3670_init(struct ufs_hba *hba)
return 0; return 0;
} }
static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { static const struct ufs_hba_variant_ops ufs_hba_hi3660_vops = {
.name = "hi3660", .name = "hi3660",
.init = ufs_hi3660_init, .init = ufs_hi3660_init,
.link_startup_notify = ufs_hisi_link_startup_notify, .link_startup_notify = ufs_hisi_link_startup_notify,
...@@ -649,7 +649,7 @@ static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = { ...@@ -649,7 +649,7 @@ static struct ufs_hba_variant_ops ufs_hba_hi3660_vops = {
.resume = ufs_hisi_resume, .resume = ufs_hisi_resume,
}; };
static struct ufs_hba_variant_ops ufs_hba_hi3670_vops = { static const struct ufs_hba_variant_ops ufs_hba_hi3670_vops = {
.name = "hi3670", .name = "hi3670",
.init = ufs_hi3670_init, .init = ufs_hi3670_init,
.link_startup_notify = ufs_hisi_link_startup_notify, .link_startup_notify = ufs_hisi_link_startup_notify,
...@@ -669,13 +669,10 @@ MODULE_DEVICE_TABLE(of, ufs_hisi_of_match); ...@@ -669,13 +669,10 @@ MODULE_DEVICE_TABLE(of, ufs_hisi_of_match);
static int ufs_hisi_probe(struct platform_device *pdev) static int ufs_hisi_probe(struct platform_device *pdev)
{ {
const struct of_device_id *of_id; const struct of_device_id *of_id;
struct ufs_hba_variant_ops *vops;
struct device *dev = &pdev->dev;
of_id = of_match_node(ufs_hisi_of_match, dev->of_node); of_id = of_match_node(ufs_hisi_of_match, pdev->dev.of_node);
vops = (struct ufs_hba_variant_ops *)of_id->data;
return ufshcd_pltfrm_init(pdev, vops); return ufshcd_pltfrm_init(pdev, of_id->data);
} }
static int ufs_hisi_remove(struct platform_device *pdev) static int ufs_hisi_remove(struct platform_device *pdev)
......
...@@ -297,7 +297,7 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba) ...@@ -297,7 +297,7 @@ static void ufshcd_init_lanes_per_dir(struct ufs_hba *hba)
* Returns 0 on success, non-zero value on failure * Returns 0 on success, non-zero value on failure
*/ */
int ufshcd_pltfrm_init(struct platform_device *pdev, int ufshcd_pltfrm_init(struct platform_device *pdev,
struct ufs_hba_variant_ops *vops) const struct ufs_hba_variant_ops *vops)
{ {
struct ufs_hba *hba; struct ufs_hba *hba;
void __iomem *mmio_base; void __iomem *mmio_base;
......
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
#include "ufshcd.h" #include "ufshcd.h"
int ufshcd_pltfrm_init(struct platform_device *pdev, int ufshcd_pltfrm_init(struct platform_device *pdev,
struct ufs_hba_variant_ops *vops); const struct ufs_hba_variant_ops *vops);
void ufshcd_pltfrm_shutdown(struct platform_device *pdev); void ufshcd_pltfrm_shutdown(struct platform_device *pdev);
#ifdef CONFIG_PM #ifdef CONFIG_PM
......
...@@ -546,7 +546,7 @@ struct ufs_hba { ...@@ -546,7 +546,7 @@ struct ufs_hba {
int nutrs; int nutrs;
int nutmrs; int nutmrs;
u32 ufs_version; u32 ufs_version;
struct ufs_hba_variant_ops *vops; const struct ufs_hba_variant_ops *vops;
void *priv; void *priv;
unsigned int irq; unsigned int irq;
bool is_irq_enabled; bool is_irq_enabled;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment