Commit e494b580 authored by Michael Mogenson's avatar Michael Mogenson Committed by Greg Kroah-Hartman

greybus: remove gb_i2c_timeout_operation

Set timeout operation was removed from the Greybus specification. Remove
gb_i2c_timeout_operation and all other no longer necessary code bits from the
Greybus kernel code.
Signed-off-by: default avatarMichael Mogenson <michael.mogenson@leaflabs.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent c7733b61
...@@ -495,23 +495,16 @@ struct gb_hid_input_report_request { ...@@ -495,23 +495,16 @@ struct gb_hid_input_report_request {
/* Greybus i2c request types */ /* Greybus i2c request types */
#define GB_I2C_TYPE_FUNCTIONALITY 0x02 #define GB_I2C_TYPE_FUNCTIONALITY 0x02
#define GB_I2C_TYPE_TIMEOUT 0x03
#define GB_I2C_TYPE_RETRIES 0x04 #define GB_I2C_TYPE_RETRIES 0x04
#define GB_I2C_TYPE_TRANSFER 0x05 #define GB_I2C_TYPE_TRANSFER 0x05
#define GB_I2C_RETRIES_DEFAULT 3 #define GB_I2C_RETRIES_DEFAULT 3
#define GB_I2C_TIMEOUT_DEFAULT 1000 /* milliseconds */
/* functionality request has no payload */ /* functionality request has no payload */
struct gb_i2c_functionality_response { struct gb_i2c_functionality_response {
__le32 functionality; __le32 functionality;
} __packed; } __packed;
struct gb_i2c_timeout_request {
__le16 msec;
} __packed;
/* timeout response has no payload */
struct gb_i2c_retries_request { struct gb_i2c_retries_request {
__u8 retries; __u8 retries;
} __packed; } __packed;
......
...@@ -18,7 +18,6 @@ struct gb_i2c_device { ...@@ -18,7 +18,6 @@ struct gb_i2c_device {
struct gb_connection *connection; struct gb_connection *connection;
u32 functionality; u32 functionality;
u16 timeout_msec;
u8 retries; u8 retries;
struct i2c_adapter adapter; struct i2c_adapter adapter;
...@@ -50,23 +49,6 @@ static int gb_i2c_functionality_operation(struct gb_i2c_device *gb_i2c_dev) ...@@ -50,23 +49,6 @@ static int gb_i2c_functionality_operation(struct gb_i2c_device *gb_i2c_dev)
return 0; return 0;
} }
static int gb_i2c_timeout_operation(struct gb_i2c_device *gb_i2c_dev, u16 msec)
{
struct device *dev = &gb_i2c_dev->connection->bundle->dev;
struct gb_i2c_timeout_request request;
int ret;
request.msec = cpu_to_le16(msec);
ret = gb_operation_sync(gb_i2c_dev->connection, GB_I2C_TYPE_TIMEOUT,
&request, sizeof(request), NULL, 0);
if (ret)
dev_err(dev, "timeout operation failed (%d)\n", ret);
else
gb_i2c_dev->timeout_msec = msec;
return ret;
}
static int gb_i2c_retries_operation(struct gb_i2c_device *gb_i2c_dev, static int gb_i2c_retries_operation(struct gb_i2c_device *gb_i2c_dev,
u8 retries) u8 retries)
{ {
...@@ -267,8 +249,8 @@ static const struct i2c_algorithm gb_i2c_algorithm = { ...@@ -267,8 +249,8 @@ static const struct i2c_algorithm gb_i2c_algorithm = {
/* /*
* Do initial setup of the i2c device. This includes verifying we * Do initial setup of the i2c device. This includes verifying we
* can support it (based on the protocol version it advertises). * can support it (based on the protocol version it advertises).
* If that's OK, we get and cached its functionality bits, and * If that's OK, we get and cached its functionality bits and
* set up the retry count and timeout. * set up the retry count.
* *
* Note: gb_i2c_dev->connection is assumed to have been valid. * Note: gb_i2c_dev->connection is assumed to have been valid.
*/ */
...@@ -281,12 +263,8 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev) ...@@ -281,12 +263,8 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev)
if (ret) if (ret)
return ret; return ret;
/* Set up our default retry count and timeout */ /* Set up our default retry count */
ret = gb_i2c_retries_operation(gb_i2c_dev, GB_I2C_RETRIES_DEFAULT); return gb_i2c_retries_operation(gb_i2c_dev, GB_I2C_RETRIES_DEFAULT);
if (ret)
return ret;
return gb_i2c_timeout_operation(gb_i2c_dev, GB_I2C_TIMEOUT_DEFAULT);
} }
static int gb_i2c_connection_init(struct gb_connection *connection) static int gb_i2c_connection_init(struct gb_connection *connection)
...@@ -312,7 +290,6 @@ static int gb_i2c_connection_init(struct gb_connection *connection) ...@@ -312,7 +290,6 @@ static int gb_i2c_connection_init(struct gb_connection *connection)
adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adapter->algo = &gb_i2c_algorithm; adapter->algo = &gb_i2c_algorithm;
/* adapter->algo_data = what? */ /* adapter->algo_data = what? */
adapter->timeout = gb_i2c_dev->timeout_msec * HZ / 1000;
adapter->retries = gb_i2c_dev->retries; adapter->retries = gb_i2c_dev->retries;
adapter->dev.parent = &connection->bundle->dev; adapter->dev.parent = &connection->bundle->dev;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment