Skip to content

Commit 22833ce

Browse files
cricard13Jarkko Sakkinen
authored andcommitted
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>
1 parent 96cddd4 commit 22833ce

File tree

1 file changed

+12
-9
lines changed
  • drivers/char/tpm/st33zp24

1 file changed

+12
-9
lines changed

drivers/char/tpm/st33zp24/i2c.c

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ static const struct st33zp24_phy_ops i2c_phy_ops = {
110110
.recv = st33zp24_i2c_recv,
111111
};
112112

113-
static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy)
113+
static int st33zp24_i2c_acpi_request_resources(struct i2c_client *client)
114114
{
115-
struct i2c_client *client = phy->client;
115+
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
116116
const struct acpi_device_id *id;
117117
struct gpio_desc *gpiod_lpcpd;
118118
struct device *dev;
@@ -147,10 +147,10 @@ static int st33zp24_i2c_acpi_request_resources(struct st33zp24_i2c_phy *phy)
147147
return 0;
148148
}
149149

150-
static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy)
150+
static int st33zp24_i2c_of_request_resources(struct i2c_client *client)
151151
{
152+
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
152153
struct device_node *pp;
153-
struct i2c_client *client = phy->client;
154154
int gpio;
155155
int ret;
156156

@@ -185,10 +185,10 @@ static int st33zp24_i2c_of_request_resources(struct st33zp24_i2c_phy *phy)
185185
return 0;
186186
}
187187

188-
static int st33zp24_i2c_request_resources(struct i2c_client *client,
189-
struct st33zp24_i2c_phy *phy)
188+
static int st33zp24_i2c_request_resources(struct i2c_client *client)
190189
{
191190
struct st33zp24_platform_data *pdata;
191+
struct st33zp24_i2c_phy *phy = i2c_get_clientdata(client);
192192
int ret;
193193

194194
pdata = client->dev.platform_data;
@@ -244,17 +244,20 @@ static int st33zp24_i2c_probe(struct i2c_client *client,
244244
return -ENOMEM;
245245

246246
phy->client = client;
247+
248+
i2c_set_clientdata(client, phy);
249+
247250
pdata = client->dev.platform_data;
248251
if (!pdata && client->dev.of_node) {
249-
ret = st33zp24_i2c_of_request_resources(phy);
252+
ret = st33zp24_i2c_of_request_resources(client);
250253
if (ret)
251254
return ret;
252255
} else if (pdata) {
253-
ret = st33zp24_i2c_request_resources(client, phy);
256+
ret = st33zp24_i2c_request_resources(client);
254257
if (ret)
255258
return ret;
256259
} else if (ACPI_HANDLE(&client->dev)) {
257-
ret = st33zp24_i2c_acpi_request_resources(phy);
260+
ret = st33zp24_i2c_acpi_request_resources(client);
258261
if (ret)
259262
return ret;
260263
}

0 commit comments

Comments
 (0)