Message ID | 20210709065711.25195-5-chanho61.park@samsung.com |
---|---|
State | Superseded |
Headers | show |
Series | introduce exynosauto v9 ufs driver | expand |
Hi Chanho > -----Original Message----- > From: Chanho Park <chanho61.park@samsung.com> > Sent: 09 July 2021 12:27 > To: Alim Akhtar <alim.akhtar@samsung.com>; James E . J . Bottomley > <jejb@linux.ibm.com>; Martin K . Petersen <martin.petersen@oracle.com> > Cc: Can Guo <cang@codeaurora.org>; Jaegeuk Kim <jaegeuk@kernel.org>; > Kiwoong Kim <kwmad.kim@samsung.com>; Avri Altman > <avri.altman@wdc.com>; Adrian Hunter <adrian.hunter@intel.com>; > Christoph Hellwig <hch@infradead.org>; Bart Van Assche > <bvanassche@acm.org>; jongmin jeong <jjmin.jeong@samsung.com>; > Gyunghoon Kwon <goodjob.kwon@samsung.com>; linux-samsung- > soc@vger.kernel.org; linux-scsi@vger.kernel.org; Chanho Park > <chanho61.park@samsung.com> > Subject: [PATCH 04/15] scsi: ufs: ufs-exynos: simplify drv_data retrieval > > The compatible field of exynos_ufs_drv_data is not necessary because > of_device_id already has it. Thus, we don't need it anymore and we can get > drv_data by device_get_match_data. > > Signed-off-by: Chanho Park <chanho61.park@samsung.com> > --- This patch can independently go in as this is clean-up and simplification of the existing driver. Reviewed-by: Alim Akhtar <alim.akhtar@samsung.com> > drivers/scsi/ufs/ufs-exynos.c | 10 +--------- drivers/scsi/ufs/ufs-exynos.h | > 3 +-- > 2 files changed, 2 insertions(+), 11 deletions(-) > > diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c > index cf46d6f86e0e..db5892901cc0 100644 > --- a/drivers/scsi/ufs/ufs-exynos.c > +++ b/drivers/scsi/ufs/ufs-exynos.c > @@ -893,17 +893,10 @@ static int exynos_ufs_post_link(struct ufs_hba > *hba) static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs > *ufs) { > struct device_node *np = dev->of_node; > - struct exynos_ufs_drv_data *drv_data = &exynos_ufs_drvs; > struct exynos_ufs_uic_attr *attr; > int ret = 0; > > - while (drv_data->compatible) { > - if (of_device_is_compatible(np, drv_data->compatible)) { > - ufs->drv_data = drv_data; > - break; > - } > - drv_data++; > - } > + ufs->drv_data = device_get_match_data(dev); > > if (ufs->drv_data && ufs->drv_data->uic_attr) { > attr = ufs->drv_data->uic_attr; > @@ -1258,7 +1251,6 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr > = { }; > > static struct exynos_ufs_drv_data exynos_ufs_drvs = { > - .compatible = "samsung,exynos7-ufs", > .uic_attr = &exynos7_uic_attr, > .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | > UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR | > diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h > index 475a5adf0f8b..7bf2053f6e90 100644 > --- a/drivers/scsi/ufs/ufs-exynos.h > +++ b/drivers/scsi/ufs/ufs-exynos.h > @@ -142,7 +142,6 @@ struct exynos_ufs_uic_attr { }; > > struct exynos_ufs_drv_data { > - char *compatible; > struct exynos_ufs_uic_attr *uic_attr; > unsigned int quirks; > unsigned int opts; > @@ -191,7 +190,7 @@ struct exynos_ufs { > struct ufs_pa_layer_attr dev_req_params; > struct ufs_phy_time_cfg t_cfg; > ktime_t entry_hibern8_t; > - struct exynos_ufs_drv_data *drv_data; > + const struct exynos_ufs_drv_data *drv_data; > > u32 opts; > #define EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL BIT(0) > -- > 2.32.0
diff --git a/drivers/scsi/ufs/ufs-exynos.c b/drivers/scsi/ufs/ufs-exynos.c index cf46d6f86e0e..db5892901cc0 100644 --- a/drivers/scsi/ufs/ufs-exynos.c +++ b/drivers/scsi/ufs/ufs-exynos.c @@ -893,17 +893,10 @@ static int exynos_ufs_post_link(struct ufs_hba *hba) static int exynos_ufs_parse_dt(struct device *dev, struct exynos_ufs *ufs) { struct device_node *np = dev->of_node; - struct exynos_ufs_drv_data *drv_data = &exynos_ufs_drvs; struct exynos_ufs_uic_attr *attr; int ret = 0; - while (drv_data->compatible) { - if (of_device_is_compatible(np, drv_data->compatible)) { - ufs->drv_data = drv_data; - break; - } - drv_data++; - } + ufs->drv_data = device_get_match_data(dev); if (ufs->drv_data && ufs->drv_data->uic_attr) { attr = ufs->drv_data->uic_attr; @@ -1258,7 +1251,6 @@ static struct exynos_ufs_uic_attr exynos7_uic_attr = { }; static struct exynos_ufs_drv_data exynos_ufs_drvs = { - .compatible = "samsung,exynos7-ufs", .uic_attr = &exynos7_uic_attr, .quirks = UFSHCD_QUIRK_PRDT_BYTE_GRAN | UFSHCI_QUIRK_BROKEN_REQ_LIST_CLR | diff --git a/drivers/scsi/ufs/ufs-exynos.h b/drivers/scsi/ufs/ufs-exynos.h index 475a5adf0f8b..7bf2053f6e90 100644 --- a/drivers/scsi/ufs/ufs-exynos.h +++ b/drivers/scsi/ufs/ufs-exynos.h @@ -142,7 +142,6 @@ struct exynos_ufs_uic_attr { }; struct exynos_ufs_drv_data { - char *compatible; struct exynos_ufs_uic_attr *uic_attr; unsigned int quirks; unsigned int opts; @@ -191,7 +190,7 @@ struct exynos_ufs { struct ufs_pa_layer_attr dev_req_params; struct ufs_phy_time_cfg t_cfg; ktime_t entry_hibern8_t; - struct exynos_ufs_drv_data *drv_data; + const struct exynos_ufs_drv_data *drv_data; u32 opts; #define EXYNOS_UFS_OPT_HAS_APB_CLK_CTRL BIT(0)
The compatible field of exynos_ufs_drv_data is not necessary because of_device_id already has it. Thus, we don't need it anymore and we can get drv_data by device_get_match_data. Signed-off-by: Chanho Park <chanho61.park@samsung.com> --- drivers/scsi/ufs/ufs-exynos.c | 10 +--------- drivers/scsi/ufs/ufs-exynos.h | 3 +-- 2 files changed, 2 insertions(+), 11 deletions(-)