Remove custom connection error function and replace it with dev_err.
The standard error function provides more information in the message
prefix (e.g. includes the interface id), has a well-known semantics
(e.g. does does not add newlines to messages), and is even somewhat
shorter to type.
Note that some uses of the custom function were already adding double
newlines due to the non-standard semantics.
Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
device_del(&connection->dev);
}
-void gb_connection_err(struct gb_connection *connection, const char *fmt, ...)
-{
- struct va_format vaf;
- va_list args;
-
- va_start(args, fmt);
-
- vaf.fmt = fmt;
- vaf.va = &args;
-
- pr_err("greybus: [%hhu:%hhu:%hu]: %pV\n",
- connection->bundle->intf->module->module_id,
- connection->bundle->id,
- connection->bundle_cport_id, &vaf);
-
- va_end(args);
-}
-EXPORT_SYMBOL_GPL(gb_connection_err);
-
int gb_connection_init(struct gb_connection *connection)
{
int ret;
void greybus_data_rcvd(struct greybus_host_device *hd, u16 cport_id,
u8 *data, size_t length);
-__printf(2, 3)
-void gb_connection_err(struct gb_connection *connection, const char *fmt, ...);
void gb_connection_bind_protocol(struct gb_connection *connection);
u32 i;
if (msg_count > (u32)U16_MAX) {
- gb_connection_err(connection, "msg_count (%u) too big",
- msg_count);
+ dev_err(&connection->dev, "msg_count (%u) too big\n",
+ msg_count);
return NULL;
}
op_count = (u16)msg_count;
return;
}
- gb_connection_err(operation->connection,
+ dev_err(&operation->connection->dev,
"unexpected incoming request type 0x%02hhx\n", operation->type);
if (gb_operation_result_set(operation, -EPROTONOSUPPORT))
queue_work(gb_operation_workqueue, &operation->work);
operation = gb_operation_create_incoming(connection, operation_id,
type, data, size);
if (!operation) {
- gb_connection_err(connection, "can't create operation");
+ dev_err(&connection->dev, "can't create operation\n");
return; /* XXX Respond with pre-allocated ENOMEM */
}
operation = gb_operation_find(connection, operation_id);
if (!operation) {
- gb_connection_err(connection, "operation not found");
+ dev_err(&connection->dev, "operation not found\n");
return;
}
message = operation->response;
message_size = sizeof(*message->header) + message->payload_size;
if (!errno && size != message_size) {
- gb_connection_err(connection, "bad message size (%zu != %zu)",
+ dev_err(&connection->dev, "bad message size (%zu != %zu)\n",
size, message_size);
errno = -EMSGSIZE;
}
u16 operation_id;
if (connection->state != GB_CONNECTION_STATE_ENABLED) {
- gb_connection_err(connection, "dropping %zu received bytes",
+ dev_err(&connection->dev, "dropping %zu received bytes\n",
size);
return;
}
if (size < sizeof(*header)) {
- gb_connection_err(connection, "message too small");
+ dev_err(&connection->dev, "message too small\n");
return;
}
header = data;
msg_size = (size_t)le16_to_cpu(header->size);
if (msg_size > size) {
- gb_connection_err(connection, "incomplete message");
+ dev_err(&connection->dev, "incomplete message\n");
return; /* XXX Should still complete operation */
}
/* Find number of transfers queued and tx/rx length in the message */
list_for_each_entry(xfer, &msg->transfers, transfer_list) {
if (!xfer->tx_buf && !xfer->rx_buf) {
- gb_connection_err(connection,
- "Bufferless transfer, length %u\n",
- xfer->len);
+ dev_err(&connection->dev,
+ "bufferless transfer, length %u\n", xfer->len);
return NULL;
}
/* Too many transfers ? */
if (count > (u32)U16_MAX) {
- gb_connection_err(connection, "transfer count (%u) too big",
- count);
+ dev_err(&connection->dev, "transfer count (%u) too big\n",
+ count);
return NULL;
}
/* Allocate master with space for data */
master = spi_alloc_master(&connection->dev, sizeof(*spi));
if (!master) {
- gb_connection_err(connection, "cannot alloc SPI master\n");
+ dev_err(&connection->dev, "cannot alloc SPI master\n");
return -ENOMEM;
}