mirror of
https://github.com/ukui/kernel.git
synced 2026-03-09 10:07:04 -07:00
memory: brcmstb: dpfe: optimize generic_show()
We can pass a (struct priv_data *) to generic_show() rather than a (struct device *). For two of the three callers of this function, the change means one less call to dev_get_drvdata(). For the third caller, it makes no difference. Signed-off-by: Markus Mayer <mmayer@broadcom.com> Signed-off-by: Florian Fainelli <f.fainelli@gmail.com>
This commit is contained in:
committed by
Florian Fainelli
parent
7ccd2ffce0
commit
900c8f578b
@@ -527,12 +527,10 @@ static int brcmstb_dpfe_download_firmware(struct platform_device *pdev,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t generic_show(unsigned int command, u32 response[],
|
static ssize_t generic_show(unsigned int command, u32 response[],
|
||||||
struct device *dev, char *buf)
|
struct private_data *priv, char *buf)
|
||||||
{
|
{
|
||||||
struct private_data *priv;
|
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
priv = dev_get_drvdata(dev);
|
|
||||||
if (!priv)
|
if (!priv)
|
||||||
return sprintf(buf, "ERROR: driver private data not set\n");
|
return sprintf(buf, "ERROR: driver private data not set\n");
|
||||||
|
|
||||||
@@ -547,10 +545,12 @@ static ssize_t show_info(struct device *dev, struct device_attribute *devattr,
|
|||||||
char *buf)
|
char *buf)
|
||||||
{
|
{
|
||||||
u32 response[MSG_FIELD_MAX];
|
u32 response[MSG_FIELD_MAX];
|
||||||
|
struct private_data *priv;
|
||||||
unsigned int info;
|
unsigned int info;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
ret = generic_show(DPFE_CMD_GET_INFO, response, dev, buf);
|
priv = dev_get_drvdata(dev);
|
||||||
|
ret = generic_show(DPFE_CMD_GET_INFO, response, priv, buf);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
@@ -573,12 +573,11 @@ static ssize_t show_refresh(struct device *dev,
|
|||||||
u32 mr4;
|
u32 mr4;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
ret = generic_show(DPFE_CMD_GET_REFRESH, response, dev, buf);
|
priv = dev_get_drvdata(dev);
|
||||||
|
ret = generic_show(DPFE_CMD_GET_REFRESH, response, priv, buf);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
priv = dev_get_drvdata(dev);
|
|
||||||
|
|
||||||
info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret);
|
info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret);
|
||||||
if (!info)
|
if (!info)
|
||||||
return ret;
|
return ret;
|
||||||
@@ -632,12 +631,11 @@ static ssize_t show_vendor(struct device *dev, struct device_attribute *devattr,
|
|||||||
void __iomem *info;
|
void __iomem *info;
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
|
|
||||||
ret = generic_show(DPFE_CMD_GET_VENDOR, response, dev, buf);
|
priv = dev_get_drvdata(dev);
|
||||||
|
ret = generic_show(DPFE_CMD_GET_VENDOR, response, priv, buf);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
priv = dev_get_drvdata(dev);
|
|
||||||
|
|
||||||
info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret);
|
info = get_msg_ptr(priv, response[MSG_ARG0], buf, &ret);
|
||||||
if (!info)
|
if (!info)
|
||||||
return ret;
|
return ret;
|
||||||
|
|||||||
Reference in New Issue
Block a user