ANDROID: scsi: ufs: add a hook to add sysfs entries
This patch adds a variant in UFS driver: int (*update_sysfs)(struct ufs_hba *hba); -> called after creating sysfs for vendor to add more sysfs entries Bug: 158050260 Signed-off-by: Jaegeuk Kim <jaegeuk@google.com> Change-Id: Id8c1197ec704e998e89dc25cc69b0f6a1b86e978
This commit is contained in:
@@ -854,15 +854,23 @@ const struct attribute_group ufs_sysfs_lun_attributes_group = {
|
||||
.attrs = ufs_sysfs_lun_attributes,
|
||||
};
|
||||
|
||||
void ufs_sysfs_add_nodes(struct device *dev)
|
||||
void ufs_sysfs_add_nodes(struct ufs_hba *hba)
|
||||
{
|
||||
int ret;
|
||||
|
||||
ret = sysfs_create_groups(&dev->kobj, ufs_sysfs_groups);
|
||||
if (ret)
|
||||
dev_err(dev,
|
||||
ret = sysfs_create_groups(&hba->dev->kobj, ufs_sysfs_groups);
|
||||
if (ret) {
|
||||
dev_err(hba->dev,
|
||||
"%s: sysfs groups creation failed (err = %d)\n",
|
||||
__func__, ret);
|
||||
return;
|
||||
}
|
||||
|
||||
ret = ufshcd_vops_update_sysfs(hba);
|
||||
if (ret)
|
||||
dev_err(hba->dev,
|
||||
"%s: vops sysfs groups update failed (err = %d)\n",
|
||||
__func__, ret);
|
||||
}
|
||||
|
||||
void ufs_sysfs_remove_nodes(struct device *dev)
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
#include "ufshcd.h"
|
||||
|
||||
void ufs_sysfs_add_nodes(struct device *dev);
|
||||
void ufs_sysfs_add_nodes(struct ufs_hba *hba);
|
||||
void ufs_sysfs_remove_nodes(struct device *dev);
|
||||
|
||||
extern const struct attribute_group ufs_sysfs_unit_descriptor_group;
|
||||
|
||||
@@ -9017,7 +9017,7 @@ int ufshcd_init(struct ufs_hba *hba, void __iomem *mmio_base, unsigned int irq)
|
||||
ufshcd_set_ufs_dev_active(hba);
|
||||
|
||||
async_schedule(ufshcd_async_scan, hba);
|
||||
ufs_sysfs_add_nodes(hba->dev);
|
||||
ufs_sysfs_add_nodes(hba);
|
||||
|
||||
return 0;
|
||||
|
||||
|
||||
@@ -285,6 +285,7 @@ struct ufs_pwr_mode_info {
|
||||
* @fill_prdt: called after initializing the standard PRDT fields so that any
|
||||
* variant-specific PRDT fields can be initialized too
|
||||
* @prepare_command: called when receiving a request in the first place
|
||||
* @update_sysfs: adds vendor-specific sysfs entries
|
||||
*/
|
||||
struct ufs_hba_variant_ops {
|
||||
const char *name;
|
||||
@@ -324,6 +325,7 @@ struct ufs_hba_variant_ops {
|
||||
unsigned int segments);
|
||||
void (*prepare_command)(struct ufs_hba *hba,
|
||||
struct request *rq, struct ufshcd_lrb *lrbp);
|
||||
int (*update_sysfs)(struct ufs_hba *hba);
|
||||
};
|
||||
|
||||
/* clock gating state */
|
||||
@@ -1224,6 +1226,13 @@ static inline void ufshcd_vops_prepare_command(struct ufs_hba *hba,
|
||||
hba->vops->prepare_command(hba, rq, lrbp);
|
||||
}
|
||||
|
||||
static inline int ufshcd_vops_update_sysfs(struct ufs_hba *hba)
|
||||
{
|
||||
if (hba->vops && hba->vops->update_sysfs)
|
||||
return hba->vops->update_sysfs(hba);
|
||||
return 0;
|
||||
}
|
||||
|
||||
extern struct ufs_pm_lvl_states ufs_pm_lvl_states[];
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user