mirror of https://gitee.com/openkylin/linux.git
tpm/st33zp24/i2c: Change xxx_request_resources header
Simplify st33zp24_i2c_acpi_request_resources, st33zp24_i2c_of_request_resources and st33zp24_i2c_request_resources to have the same prototype and using i2c_get_clientdata. Signed-off-by: Christophe Ricard <christophe-h.ricard@st.com> Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> Signed-off-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
This commit is contained in:
parent
160beb40d5
commit
6388b65953
|
@ -110,9 +110,9 @@ static const struct st33zp24_phy_ops i2c_phy_ops = {
|
||||||
.recv = st33zp24_i2c_recv,
|
.recv = st33zp24_i2c_recv,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy)
|
static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
struct i2c_client *client = phy->client;
|
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
|
||||||
const struct acpi_device_id *id;
|
const struct acpi_device_id *id;
|
||||||
struct gpio_desc *gpiod_lpcpd;
|
struct gpio_desc *gpiod_lpcpd;
|
||||||
struct device *dev;
|
struct device *dev;
|
||||||
|
@ -147,10 +147,10 @@ static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy)
|
static int st33zp24_i2c_of_request_resources(struct i2c_client *client)
|
||||||
{
|
{
|
||||||
|
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
|
||||||
struct device_node *pp;
|
struct device_node *pp;
|
||||||
struct i2c_client *client = phy->client;
|
|
||||||
int gpio;
|
int gpio;
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
|
@ -185,10 +185,10 @@ static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int st33zp24_i2c_request_resources(struct i2c_client *client,
|
static int st33zp24_i2c_request_resources(struct i2c_client *client)
|
||||||
struct st33zp24_i2c_phy *phy)
|
|
||||||
{
|
{
|
||||||
struct st33zp24_platform_data *pdata;
|
struct st33zp24_platform_data *pdata;
|
||||||
|
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
pdata = client->dev.platform_data;
|
pdata = client->dev.platform_data;
|
||||||
|
@ -244,17 +244,20 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
phy->client = client;
|
phy->client = client;
|
||||||
|
|
||||||
|
i2c_set_clientdata(client, phy);
|
||||||
|
|
||||||
pdata = client->dev.platform_data;
|
pdata = client->dev.platform_data;
|
||||||
if (!pdata && client->dev.of_node) {
|
if (!pdata && client->dev.of_node) {
|
||||||
ret = st33zp24_i2c_of_request_resources(phy);
|
ret = st33zp24_i2c_of_request_resources(client);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else if (pdata) {
|
} else if (pdata) {
|
||||||
ret = st33zp24_i2c_request_resources(client, phy);
|
ret = st33zp24_i2c_request_resources(client);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
} else if (ACPI_HANDLE(&client->dev)) {
|
} else if (ACPI_HANDLE(&client->dev)) {
|
||||||
ret = st33zp24_i2c_acpi_request_resources(phy);
|
ret = st33zp24_i2c_acpi_request_resources(client);
|
||||||
if (ret)
|
if (ret)
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue