struct device_attribute *attr, \
char *buf) \
{ \
- struct gb_connection *connection; \
+ struct gb_bundle *bundle; \
struct gb_loopback *gb; \
if (conn) { \
- connection = to_gb_connection(dev); \
- gb = connection->private; \
+ bundle = to_gb_bundle(dev); \
+ gb = bundle->private; \
return sprintf(buf, "%u\n", gb->field); \
} else { \
return sprintf(buf, "%u\n", gb_dev.field); \
struct device_attribute *attr, \
char *buf) \
{ \
- struct gb_connection *connection; \
+ struct gb_bundle *bundle; \
struct gb_loopback *gb; \
if (conn) { \
- connection = to_gb_connection(dev); \
- gb = connection->private; \
+ bundle = to_gb_bundle(dev); \
+ gb = bundle->private; \
return sprintf(buf, "%"#type"\n", gb->name.field); \
} else { \
return sprintf(buf, "%"#type"\n", gb_dev.name.field); \
char *buf) \
{ \
struct gb_loopback_stats *stats; \
- struct gb_connection *connection; \
+ struct gb_bundle *bundle; \
struct gb_loopback *gb; \
u64 avg; \
u32 count, rem; \
if (conn) { \
- connection = to_gb_connection(dev); \
- gb = connection->private; \
+ bundle = to_gb_bundle(dev); \
+ gb = bundle->private; \
stats = &gb->name; \
} else { \
stats = &gb_dev.name; \
struct device_attribute *attr, \
char *buf) \
{ \
- struct gb_connection *connection = to_gb_connection(dev); \
- struct gb_loopback *gb = connection->private; \
+ struct gb_bundle *bundle = to_gb_bundle(dev); \
+ struct gb_loopback *gb = bundle->private; \
return sprintf(buf, "%"#type"\n", gb->field); \
} \
static ssize_t field##_store(struct device *dev, \
size_t len) \
{ \
int ret; \
- struct gb_connection *connection = to_gb_connection(dev); \
+ struct gb_bundle *bundle = to_gb_bundle(dev); \
mutex_lock(&gb_dev.mutex); \
ret = sscanf(buf, "%"#type, &gb->field); \
if (ret != 1) \
len = -EINVAL; \
else \
- gb_loopback_check_attr(connection); \
+ gb_loopback_check_attr(&gb_dev, bundle); \
mutex_unlock(&gb_dev.mutex); \
return len; \
} \
size_t len) \
{ \
int ret; \
- struct gb_connection *connection = to_gb_connection(dev); \
+ struct gb_bundle *bundle = to_gb_bundle(dev); \
mutex_lock(&gb_dev.mutex); \
ret = sscanf(buf, "%"#type, &gb_dev.field); \
if (ret != 1) \
len = -EINVAL; \
else \
- gb_loopback_check_attr(&gb_dev, connection); \
+ gb_loopback_check_attr(&gb_dev, bundle); \
mutex_unlock(&gb_dev.mutex); \
return len; \
} \
static void gb_loopback_reset_stats(struct gb_loopback_device *gb_dev);
static void gb_loopback_check_attr(struct gb_loopback_device *gb_dev,
- struct gb_connection *connection)
+ struct gb_bundle *bundle)
{
struct gb_loopback *gb;
gb->iteration_count = 0;
gb->error = 0;
if (kfifo_depth < gb_dev->iteration_max) {
- dev_warn(&connection->dev,
+ dev_warn(&bundle->dev,
"cannot log bytes %u kfifo_depth %u\n",
gb_dev->iteration_max, kfifo_depth);
}
ret = gb_operation_request_send_sync(operation);
if (ret) {
- dev_err(&gb->connection->dev,
+ dev_err(&gb->connection->bundle->dev,
"synchronous operation failed: %d\n", ret);
} else {
if (response_size == operation->response->payload_size) {
memcpy(response, operation->response->payload,
response_size);
} else {
- dev_err(&gb->connection->dev,
+ dev_err(&gb->connection->bundle->dev,
"response size %zu expected %d\n",
operation->response->payload_size,
response_size);
goto gb_error;
if (memcmp(request->data, response->data, len)) {
- dev_err(&gb->connection->dev, "Loopback Data doesn't match\n");
+ dev_err(&gb->connection->bundle->dev,
+ "Loopback Data doesn't match\n");
retval = -EREMOTEIO;
}
gb->apbridge_latency_ts = (u32)__le32_to_cpu(response->reserved0);
struct gb_connection *connection = operation->connection;
struct gb_loopback_transfer_request *request;
struct gb_loopback_transfer_response *response;
+ struct device *dev = &connection->bundle->dev;
size_t len;
/* By convention, the AP initiates the version operation */
switch (type) {
case GB_REQUEST_TYPE_PROTOCOL_VERSION:
- dev_err(&connection->dev,
- "module-initiated version operation\n");
+ dev_err(dev, "module-initiated version operation\n");
return -EINVAL;
case GB_LOOPBACK_TYPE_PING:
case GB_LOOPBACK_TYPE_SINK:
return 0;
case GB_LOOPBACK_TYPE_TRANSFER:
if (operation->request->payload_size < sizeof(*request)) {
- dev_err(&connection->dev,
- "transfer request too small (%zu < %zu)\n",
+ dev_err(dev, "transfer request too small (%zu < %zu)\n",
operation->request->payload_size,
sizeof(*request));
return -EINVAL; /* -EMSGSIZE */
request = operation->request->payload;
len = le32_to_cpu(request->len);
if (len > gb_dev.size_max) {
- dev_err(&connection->dev,
- "transfer request too large (%zu > %zu)\n",
+ dev_err(dev, "transfer request too large (%zu > %zu)\n",
len, gb_dev.size_max);
return -EINVAL;
}
if (len) {
if (!gb_operation_response_alloc(operation, len,
GFP_KERNEL)) {
- dev_err(&connection->dev,
- "error allocating response\n");
+ dev_err(dev, "error allocating response\n");
return -ENOMEM;
}
response = operation->response->payload;
}
return 0;
default:
- dev_err(&connection->dev,
- "unsupported request: %hhu\n", type);
+ dev_err(dev, "unsupported request: %hhu\n", type);
return -EINVAL;
}
}
/* All threads achieved at least low_count iterations */
if (gb_dev.iteration_count < low_count) {
gb_dev.iteration_count = low_count;
- sysfs_notify(&gb->connection->dev.kobj, NULL,
- "iteration_count");
+ sysfs_notify(&gb->connection->bundle->dev.kobj,
+ NULL, "iteration_count");
}
/* Optionally terminate */
if (gb_dev.iteration_count == gb_dev.iteration_max) {
/* Create per-connection sysfs and debugfs data-points */
snprintf(name, sizeof(name), "raw_latency_%s",
- dev_name(&connection->dev));
+ dev_name(&connection->bundle->dev));
gb->file = debugfs_create_file(name, S_IFREG | S_IRUGO, gb_dev.root, gb,
&gb_loopback_debugfs_latency_ops);
gb->connection = connection;
- connection->private = gb;
- retval = sysfs_create_groups(&connection->dev.kobj,
+ connection->bundle->private = gb;
+ retval = sysfs_create_groups(&connection->bundle->dev.kobj,
loopback_con_groups);
if (retval)
goto out_sysfs_dev;
out_kfifo0:
kfifo_free(&gb->kfifo_lat);
out_sysfs_conn:
- sysfs_remove_groups(&connection->dev.kobj, loopback_con_groups);
+ sysfs_remove_groups(&connection->bundle->dev.kobj, loopback_con_groups);
out_sysfs_dev:
if (!gb_dev.count) {
sysfs_remove_groups(kobj, loopback_dev_groups);
debugfs_remove(gb_dev.file);
}
debugfs_remove(gb->file);
- connection->private = NULL;
+ connection->bundle->private = NULL;
out_sysfs:
mutex_unlock(&gb_dev.mutex);
kfree(gb);
static void gb_loopback_connection_exit(struct gb_connection *connection)
{
- struct gb_loopback *gb = connection->private;
+ struct gb_loopback *gb = connection->bundle->private;
struct kobject *kobj = &connection->hd->endo->dev.kobj;
if (!IS_ERR_OR_NULL(gb->task))
mutex_lock(&gb_dev.mutex);
- connection->private = NULL;
+ connection->bundle->private = NULL;
kfifo_free(&gb->kfifo_lat);
kfifo_free(&gb->kfifo_ts);
gb_connection_latency_tag_disable(connection);
sysfs_remove_groups(kobj, loopback_dev_groups);
debugfs_remove(gb_dev.file);
}
- sysfs_remove_groups(&connection->dev.kobj, loopback_con_groups);
+ sysfs_remove_groups(&connection->bundle->dev.kobj,
+ loopback_con_groups);
debugfs_remove(gb->file);
list_del(&gb->entry);
mutex_unlock(&gb_dev.mutex);