Some parameters are aligned with parentheses.
Some parentheses was opened at end of line.
Signed-off-by: Cristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
const char *buf, size_t count);
};
-static ssize_t gb_audio_module_attr_show(
- struct kobject *kobj, struct attribute *attr, char *buf)
+static ssize_t gb_audio_module_attr_show(struct kobject *kobj,
+ struct attribute *attr, char *buf)
{
struct gb_audio_manager_module_attribute *attribute;
struct gb_audio_manager_module *module;
#include "audio_manager.h"
#include "audio_manager_private.h"
-static ssize_t manager_sysfs_add_store(
- struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t manager_sysfs_add_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
{
struct gb_audio_manager_module_descriptor desc = { {0} };
static struct kobj_attribute manager_add_attribute =
__ATTR(add, 0664, NULL, manager_sysfs_add_store);
-static ssize_t manager_sysfs_remove_store(
- struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t manager_sysfs_remove_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
{
int id;
static struct kobj_attribute manager_remove_attribute =
__ATTR(remove, 0664, NULL, manager_sysfs_remove_store);
-static ssize_t manager_sysfs_dump_store(
- struct kobject *kobj, struct kobj_attribute *attr,
- const char *buf, size_t count)
+static ssize_t manager_sysfs_dump_store(struct kobject *kobj,
+ struct kobj_attribute *attr,
+ const char *buf, size_t count)
{
int id;
static struct kobj_attribute manager_dump_attribute =
__ATTR(dump, 0664, NULL, manager_sysfs_dump_store);
-static void manager_sysfs_init_attribute(
- struct kobject *kobj, struct kobj_attribute *kattr)
+static void manager_sysfs_init_attribute(struct kobject *kobj,
+ struct kobj_attribute *kattr)
{
int err;
*/
static int gbaudio_request_jack(struct gbaudio_module_info *module,
- struct gb_audio_jack_event_request *req)
+ struct gb_audio_jack_event_request *req)
{
int report;
struct snd_jack *jack = module->headset_jack.jack;
if (!jack) {
dev_err_ratelimited(module->dev,
- "Invalid jack event received:type: %u, event: %u\n",
- req->jack_attribute, req->event);
+ "Invalid jack event received:type: %u, event: %u\n",
+ req->jack_attribute, req->event);
return -EINVAL;
}
report = req->jack_attribute & module->jack_mask;
if (!report) {
dev_err_ratelimited(module->dev,
- "Invalid jack event received:type: %u, event: %u\n",
- req->jack_attribute, req->event);
+ "Invalid jack event received:type: %u, event: %u\n",
+ req->jack_attribute, req->event);
return -EINVAL;
}
if (!btn_jack) {
dev_err_ratelimited(module->dev,
- "Invalid button event received:type: %u, event: %u\n",
- req->button_id, req->event);
+ "Invalid button event received:type: %u, event: %u\n",
+ req->button_id, req->event);
return -EINVAL;
}
return -ENOMEM;
connection = gb_connection_create_offloaded(bundle,
- le16_to_cpu(cport_desc->id),
- GB_CONNECTION_FLAG_CSD);
+ le16_to_cpu(cport_desc->id),
+ GB_CONNECTION_FLAG_CSD);
if (IS_ERR(connection)) {
devm_kfree(gbmodule->dev, dai);
return PTR_ERR(connection);
ret = gbaudio_tplg_parse_data(gbmodule, topology);
if (ret) {
dev_err(dev, "%d:Error while parsing topology data\n",
- ret);
+ ret);
goto free_topology;
}
gbmodule->topology = topology;
}
static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_info *uinfo)
+ struct snd_ctl_elem_info *uinfo)
{
unsigned int max;
const char *name;
}
static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ struct snd_ctl_elem_value *ucontrol)
{
int ret;
struct gb_audio_ctl_elem_info *info;
}
static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ struct snd_ctl_elem_value *ucontrol)
{
int ret = 0;
struct gb_audio_ctl_elem_info *info;
* of DAPM related sequencing, etc.
*/
static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_info *uinfo)
+ struct snd_ctl_elem_info *uinfo)
{
int platform_max, platform_min;
struct gbaudio_ctl_pvt *data;
}
static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ struct snd_ctl_elem_value *ucontrol)
{
int ret;
struct gb_audio_ctl_elem_info *info;
}
static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
+ struct snd_ctl_elem_value *ucontrol)
{
int ret, wi, max, connect;
unsigned int mask, val;
.private_value = (unsigned long)data}
static int gbcodec_event_spk(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *k, int event)
+ struct snd_kcontrol *k, int event)
{
/* Ensure GB speaker is connected */
}
static int gbcodec_event_hp(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *k, int event)
+ struct snd_kcontrol *k, int event)
{
/* Ensure GB module supports jack slot */
}
static int gbcodec_event_int_mic(struct snd_soc_dapm_widget *w,
- struct snd_kcontrol *k, int event)
+ struct snd_kcontrol *k, int event)
{
/* Ensure GB module supports jack slot */
/* debug enum info */
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max,
- le16_to_cpu(gb_enum->names_length));
+ le16_to_cpu(gb_enum->names_length));
for (i = 0; i < gbe->max; i++)
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
/* debug enum info */
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max,
- le16_to_cpu(gb_enum->names_length));
+ le16_to_cpu(gb_enum->names_length));
for (i = 0; i < gbe->max; i++)
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
}
static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb,
- struct snd_kcontrol_new *kctl,
- struct gb_audio_control *ctl)
+ struct snd_kcontrol_new *kctl,
+ struct gb_audio_control *ctl)
{
struct gbaudio_ctl_pvt *ctldata;
}
static int gbaudio_tplg_create_wcontrol(struct gbaudio_module_info *gb,
- struct snd_kcontrol_new *kctl,
- struct gb_audio_control *ctl)
+ struct snd_kcontrol_new *kctl,
+ struct gb_audio_control *ctl)
{
int ret;
case snd_soc_dapm_switch:
*dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_SWITCH_E(w->name, SND_SOC_NOPM, 0, 0,
- widget_kctls, gbaudio_widget_event,
- SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD);
+ widget_kctls,
+ gbaudio_widget_event,
+ SND_SOC_DAPM_PRE_PMU |
+ SND_SOC_DAPM_POST_PMD);
break;
case snd_soc_dapm_pga:
*dw = (struct snd_soc_dapm_widget)
case snd_soc_dapm_mixer:
*dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_MIXER_E(w->name, SND_SOC_NOPM, 0, 0, NULL,
- 0, gbaudio_widget_event,
- SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD);
+ 0, gbaudio_widget_event,
+ SND_SOC_DAPM_PRE_PMU |
+ SND_SOC_DAPM_POST_PMD);
break;
case snd_soc_dapm_mux:
*dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_MUX_E(w->name, SND_SOC_NOPM, 0, 0,
- widget_kctls, gbaudio_widget_event,
- SND_SOC_DAPM_PRE_PMU |
- SND_SOC_DAPM_POST_PMD);
+ widget_kctls, gbaudio_widget_event,
+ SND_SOC_DAPM_PRE_PMU |
+ SND_SOC_DAPM_POST_PMD);
break;
case snd_soc_dapm_aif_in:
*dw = (struct snd_soc_dapm_widget)
}
static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module,
- struct gb_audio_control *controls)
+ struct gb_audio_control *controls)
{
int i, csize, ret;
struct snd_kcontrol_new *dapm_kctls;
}
static int gbaudio_tplg_process_widgets(struct gbaudio_module_info *module,
- struct gb_audio_widget *widgets)
+ struct gb_audio_widget *widgets)
{
int i, ret, w_size;
struct snd_soc_dapm_widget *dapm_widgets;
}
static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module,
- struct gb_audio_route *routes)
+ struct gb_audio_route *routes)
{
int i, ret;
struct snd_soc_dapm_route *dapm_routes;
}
dapm_routes->control =
gbaudio_map_controlid(module,
- curr->control_id,
- curr->index);
+ curr->control_id,
+ curr->index);
if ((curr->control_id != GBAUDIO_INVALID_ID) &&
!dapm_routes->control) {
dev_err(module->dev, "%d:%d:%d:%d - Invalid control\n",
}
static int gbaudio_tplg_process_header(struct gbaudio_module_info *module,
- struct gb_audio_topology *tplg_data)
+ struct gb_audio_topology *tplg_data)
{
/* fetch no. of kcontrols, widgets & routes */
module->num_controls = tplg_data->num_controls;
}
int gbaudio_tplg_parse_data(struct gbaudio_module_info *module,
- struct gb_audio_topology *tplg_data)
+ struct gb_audio_topology *tplg_data)
{
int ret;
struct gb_audio_control *controls;
}
static void gb_bootrom_set_timeout(struct gb_bootrom *bootrom,
- enum next_request_type next, unsigned long timeout)
+ enum next_request_type next,
+ unsigned long timeout)
{
bootrom->next_request = next;
schedule_delayed_work(&bootrom->dwork, msecs_to_jiffies(timeout));
firmware_name);
rc = request_firmware(&bootrom->fw, firmware_name,
- &connection->bundle->dev);
+ &connection->bundle->dev);
if (rc) {
dev_err(&connection->bundle->dev,
"failed to find %s firmware (%d)\n", firmware_name, rc);
if (offset >= fw->size || size > fw->size - offset) {
dev_warn(dev, "bad firmware request (offs = %u, size = %u)\n",
- offset, size);
+ offset, size);
ret = -EINVAL;
goto unlock;
}
sizeof(response));
if (ret) {
dev_err(&bundle->dev,
- "failed to get protocol version: %d\n",
- ret);
+ "failed to get protocol version: %d\n",
+ ret);
return ret;
}
if (response.major > request.major) {
dev_err(&bundle->dev,
- "unsupported major protocol version (%u > %u)\n",
- response.major, request.major);
+ "unsupported major protocol version (%u > %u)\n",
+ response.major, request.major);
return -ENOTSUPP;
}
bootrom->protocol_minor = response.minor;
dev_dbg(&bundle->dev, "%s - %u.%u\n", __func__, response.major,
- response.minor);
+ response.minor);
return 0;
}
static int gb_bootrom_probe(struct gb_bundle *bundle,
- const struct greybus_bundle_id *id)
+ const struct greybus_bundle_id *id)
{
struct greybus_descriptor_cport *cport_desc;
struct gb_connection *connection;
return -ENOMEM;
connection = gb_connection_create(bundle,
- le16_to_cpu(cport_desc->id),
- gb_bootrom_request_handler);
+ le16_to_cpu(cport_desc->id),
+ gb_bootrom_request_handler);
if (IS_ERR(connection)) {
ret = PTR_ERR(connection);
goto err_free_bootrom;
NULL, 0);
if (ret) {
dev_err(&connection->bundle->dev,
- "failed to send AP READY: %d\n", ret);
+ "failed to send AP READY: %d\n", ret);
goto err_cancel_timeout;
}
}
static int gb_camera_op_capture(void *priv, u32 request_id,
- unsigned int streams, unsigned int num_frames,
- size_t settings_size, const void *settings)
+ unsigned int streams, unsigned int num_frames,
+ size_t settings_size, const void *settings)
{
struct gb_camera *gcam = priv;
*/
static ssize_t gb_camera_debugfs_capabilities(struct gb_camera *gcam,
- char *buf, size_t len)
+ char *buf, size_t len)
{
struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_CAPABILITIES];
}
static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
- char *buf, size_t len)
+ char *buf, size_t len)
{
struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_STREAMS];
};
static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam,
- char *buf, size_t len)
+ char *buf, size_t len)
{
unsigned int request_id;
unsigned int streams_mask;
}
static ssize_t gb_camera_debugfs_flush(struct gb_camera *gcam,
- char *buf, size_t len)
+ char *buf, size_t len)
{
struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_FLUSH];
list_for_each_entry(connection, &hd->connections, hd_links) {
if (connection->intf == intf &&
- connection->intf_cport_id == cport_id)
+ connection->intf_cport_id == cport_id)
return true;
}
* received on the bundle.
*/
void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id,
- u8 *data, size_t length)
+ u8 *data, size_t length)
{
struct gb_connection *connection;
}
snprintf(connection->name, sizeof(connection->name),
- "%u/%u:%u", hd_cport_id, intf_id, cport_id);
+ "%u/%u:%u", hd_cport_id, intf_id, cport_id);
}
/*
*/
static struct gb_connection *
_gb_connection_create(struct gb_host_device *hd, int hd_cport_id,
- struct gb_interface *intf,
- struct gb_bundle *bundle, int cport_id,
- gb_request_handler_t handler,
- unsigned long flags)
+ struct gb_interface *intf,
+ struct gb_bundle *bundle, int cport_id,
+ gb_request_handler_t handler,
+ unsigned long flags)
{
struct gb_connection *connection;
int ret;
struct gb_connection *
gb_connection_create_static(struct gb_host_device *hd, u16 hd_cport_id,
- gb_request_handler_t handler)
+ gb_request_handler_t handler)
{
return _gb_connection_create(hd, hd_cport_id, NULL, NULL, 0, handler,
- GB_CONNECTION_FLAG_HIGH_PRIO);
+ GB_CONNECTION_FLAG_HIGH_PRIO);
}
struct gb_connection *
gb_connection_create_control(struct gb_interface *intf)
{
return _gb_connection_create(intf->hd, -1, intf, NULL, 0, NULL,
- GB_CONNECTION_FLAG_CONTROL |
- GB_CONNECTION_FLAG_HIGH_PRIO);
+ GB_CONNECTION_FLAG_CONTROL |
+ GB_CONNECTION_FLAG_HIGH_PRIO);
}
struct gb_connection *
gb_connection_create(struct gb_bundle *bundle, u16 cport_id,
- gb_request_handler_t handler)
+ gb_request_handler_t handler)
{
struct gb_interface *intf = bundle->intf;
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
- handler, 0);
+ handler, 0);
}
EXPORT_SYMBOL_GPL(gb_connection_create);
struct gb_connection *
gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id,
- gb_request_handler_t handler,
- unsigned long flags)
+ gb_request_handler_t handler,
+ unsigned long flags)
{
struct gb_interface *intf = bundle->intf;
flags &= ~GB_CONNECTION_FLAG_CORE_MASK;
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
- handler, flags);
+ handler, flags);
}
EXPORT_SYMBOL_GPL(gb_connection_create_flags);
struct gb_connection *
gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id,
- unsigned long flags)
+ unsigned long flags)
{
flags |= GB_CONNECTION_FLAG_OFFLOADED;
return 0;
ret = hd->driver->cport_enable(hd, connection->hd_cport_id,
- connection->flags);
+ connection->flags);
if (ret) {
dev_err(&hd->dev, "%s: failed to enable host cport: %d\n",
- connection->name, ret);
+ connection->name, ret);
return ret;
}
ret = hd->driver->cport_disable(hd, connection->hd_cport_id);
if (ret) {
dev_err(&hd->dev, "%s: failed to disable host cport: %d\n",
- connection->name, ret);
+ connection->name, ret);
}
}
ret = hd->driver->cport_connected(hd, connection->hd_cport_id);
if (ret) {
dev_err(&hd->dev, "%s: failed to set connected state: %d\n",
- connection->name, ret);
+ connection->name, ret);
return ret;
}
ret = hd->driver->cport_flush(hd, connection->hd_cport_id);
if (ret) {
dev_err(&hd->dev, "%s: failed to flush host cport: %d\n",
- connection->name, ret);
+ connection->name, ret);
return ret;
}
GB_CONNECTION_CPORT_QUIESCE_TIMEOUT);
if (ret) {
dev_err(&hd->dev, "%s: failed to quiesce host cport: %d\n",
- connection->name, ret);
+ connection->name, ret);
return ret;
}
ret = hd->driver->cport_clear(hd, connection->hd_cport_id);
if (ret) {
dev_err(&hd->dev, "%s: failed to clear host cport: %d\n",
- connection->name, ret);
+ connection->name, ret);
return ret;
}
}
ret = gb_svc_connection_create(hd->svc,
- hd->svc->ap_intf_id,
- connection->hd_cport_id,
- intf->interface_id,
- connection->intf_cport_id,
- cport_flags);
+ hd->svc->ap_intf_id,
+ connection->hd_cport_id,
+ intf->interface_id,
+ connection->intf_cport_id,
+ cport_flags);
if (ret) {
dev_err(&connection->hd->dev,
"%s: failed to create svc connection: %d\n",
ret = gb_control_disconnecting_operation(control, cport_id);
if (ret) {
dev_err(&connection->hd->dev,
- "%s: failed to send disconnecting: %d\n",
- connection->name, ret);
+ "%s: failed to send disconnecting: %d\n",
+ connection->name, ret);
}
}
}
static int gb_connection_shutdown_operation(struct gb_connection *connection,
- u8 phase)
+ u8 phase)
{
struct gb_cport_shutdown_request *req;
struct gb_operation *operation;
int ret;
operation = gb_operation_create_core(connection,
- GB_REQUEST_TYPE_CPORT_SHUTDOWN,
- sizeof(*req), 0, 0,
- GFP_KERNEL);
+ GB_REQUEST_TYPE_CPORT_SHUTDOWN,
+ sizeof(*req), 0, 0,
+ GFP_KERNEL);
if (!operation)
return -ENOMEM;
return 0;
ret = drv->cport_shutdown(hd, connection->hd_cport_id, phase,
- GB_OPERATION_TIMEOUT_DEFAULT);
+ GB_OPERATION_TIMEOUT_DEFAULT);
} else {
ret = gb_connection_shutdown_operation(connection, phase);
}
if (ret) {
dev_err(&hd->dev, "%s: failed to send cport shutdown (phase %d): %d\n",
- connection->name, phase, ret);
+ connection->name, phase, ret);
return ret;
}
* DISCONNECTING.
*/
static void gb_connection_cancel_operations(struct gb_connection *connection,
- int errno)
+ int errno)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
while (!list_empty(&connection->operations)) {
operation = list_last_entry(&connection->operations,
- struct gb_operation, links);
+ struct gb_operation, links);
gb_operation_get(operation);
spin_unlock_irq(&connection->lock);
*/
static void
gb_connection_flush_incoming_operations(struct gb_connection *connection,
- int errno)
+ int errno)
__must_hold(&connection->lock)
{
struct gb_operation *operation;
while (!list_empty(&connection->operations)) {
incoming = false;
list_for_each_entry(operation, &connection->operations,
- links) {
+ links) {
if (gb_operation_is_incoming(operation)) {
gb_operation_get(operation);
incoming = true;
sizeof(response));
if (ret) {
dev_err(&intf->dev,
- "failed to get control-protocol version: %d\n",
- ret);
+ "failed to get control-protocol version: %d\n",
+ ret);
return ret;
}
if (response.major > request.major) {
dev_err(&intf->dev,
- "unsupported major control-protocol version (%u > %u)\n",
- response.major, request.major);
+ "unsupported major control-protocol version (%u > %u)\n",
+ response.major, request.major);
return -ENOTSUPP;
}
control->protocol_minor = response.minor;
dev_dbg(&intf->dev, "%s - %u.%u\n", __func__, response.major,
- response.minor);
+ response.minor);
return 0;
}
static int gb_control_get_bundle_version(struct gb_control *control,
- struct gb_bundle *bundle)
+ struct gb_bundle *bundle)
{
struct gb_interface *intf = control->connection->intf;
struct gb_control_bundle_version_request request;
&response, sizeof(response));
if (ret) {
dev_err(&intf->dev,
- "failed to get bundle %u class version: %d\n",
- bundle->id, ret);
+ "failed to get bundle %u class version: %d\n",
+ bundle->id, ret);
return ret;
}
bundle->class_minor = response.minor;
dev_dbg(&intf->dev, "%s - %u: %u.%u\n", __func__, bundle->id,
- response.major, response.minor);
+ response.major, response.minor);
return 0;
}
NULL, 0, &response, sizeof(response));
if (ret) {
dev_err(&connection->intf->dev,
- "failed to get manifest size: %d\n", ret);
+ "failed to get manifest size: %d\n", ret);
return ret;
}
}
int gb_control_disconnecting_operation(struct gb_control *control,
- u16 cport_id)
+ u16 cport_id)
{
struct gb_control_disconnecting_request *request;
struct gb_operation *operation;
int ret;
operation = gb_operation_create_core(control->connection,
- GB_CONTROL_TYPE_DISCONNECTING,
- sizeof(*request), 0, 0,
- GFP_KERNEL);
+ GB_CONTROL_TYPE_DISCONNECTING,
+ sizeof(*request), 0, 0,
+ GFP_KERNEL);
if (!operation)
return -ENOMEM;
ret = gb_operation_request_send_sync(operation);
if (ret) {
dev_err(&control->dev, "failed to send disconnecting: %d\n",
- ret);
+ ret);
}
gb_operation_put(operation);
int ret;
operation = gb_operation_create_core(control->connection,
- GB_CONTROL_TYPE_MODE_SWITCH,
- 0, 0, GB_OPERATION_FLAG_UNIDIRECTIONAL,
- GFP_KERNEL);
+ GB_CONTROL_TYPE_MODE_SWITCH,
+ 0, 0,
+ GB_OPERATION_FLAG_UNIDIRECTIONAL,
+ GFP_KERNEL);
if (!operation)
return -ENOMEM;
}
static ssize_t vendor_string_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_control *control = to_gb_control(dev);
static DEVICE_ATTR_RO(vendor_string);
static ssize_t product_string_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_control *control = to_gb_control(dev);
connection = gb_connection_create_control(intf);
if (IS_ERR(connection)) {
dev_err(&intf->dev,
- "failed to create control connection: %ld\n",
- PTR_ERR(connection));
+ "failed to create control connection: %ld\n",
+ PTR_ERR(connection));
kfree(control);
return ERR_CAST(connection);
}
ret = gb_connection_enable_tx(control->connection);
if (ret) {
dev_err(&control->connection->intf->dev,
- "failed to enable control connection: %d\n",
- ret);
+ "failed to enable control connection: %d\n",
+ ret);
return ret;
}
ret = device_add(&control->dev);
if (ret) {
dev_err(&control->dev,
- "failed to register control device: %d\n",
- ret);
+ "failed to register control device: %d\n",
+ ret);
return ret;
}
}
static int output(struct gb_host_device *hd, void *req, u16 size, u8 cmd,
- bool async)
+ bool async)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
}
static int es2_cport_in_enable(struct es2_ap_dev *es2,
- struct es2_cport_in *cport_in)
+ struct es2_cport_in *cport_in)
{
struct urb *urb;
int ret;
ret = usb_submit_urb(urb, GFP_KERNEL);
if (ret) {
dev_err(&es2->usb_dev->dev,
- "failed to submit in-urb: %d\n", ret);
+ "failed to submit in-urb: %d\n", ret);
goto err_kill_urbs;
}
}
}
static void es2_cport_in_disable(struct es2_ap_dev *es2,
- struct es2_cport_in *cport_in)
+ struct es2_cport_in *cport_in)
{
struct urb *urb;
int i;
}
static int es2_cport_allocate(struct gb_host_device *hd, int cport_id,
- unsigned long flags)
+ unsigned long flags)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
struct ida *id_map = &hd->cport_id_map;
}
if (flags & GB_CONNECTION_FLAG_OFFLOADED &&
- flags & GB_CONNECTION_FLAG_CDSI1) {
+ flags & GB_CONNECTION_FLAG_CDSI1) {
if (es2->cdsi1_in_use) {
dev_err(&hd->dev, "CDSI1 already in use\n");
return -EBUSY;
req->flags = cpu_to_le32(connection_flags);
dev_dbg(&hd->dev, "%s - cport = %u, flags = %02x\n", __func__,
- cport_id, connection_flags);
+ cport_id, connection_flags);
ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
- GB_APB_REQUEST_CPORT_FLAGS,
- USB_DIR_OUT | USB_TYPE_VENDOR |
- USB_RECIP_INTERFACE, cport_id, 0,
- req, sizeof(*req), ES2_USB_CTRL_TIMEOUT);
+ GB_APB_REQUEST_CPORT_FLAGS,
+ USB_DIR_OUT | USB_TYPE_VENDOR |
+ USB_RECIP_INTERFACE, cport_id, 0,
+ req, sizeof(*req), ES2_USB_CTRL_TIMEOUT);
if (ret != sizeof(*req)) {
dev_err(&udev->dev, "failed to set cport flags for port %d\n",
- cport_id);
+ cport_id);
if (ret >= 0)
ret = -EIO;
NULL, ES2_ARPC_CPORT_TIMEOUT);
if (ret) {
dev_err(dev, "failed to set connected state for cport %u: %d\n",
- cport_id, ret);
+ cport_id, ret);
return ret;
}
}
static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id,
- u8 phase, unsigned int timeout)
+ u8 phase, unsigned int timeout)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
struct device *dev = &es2->usb_dev->dev;
&result, ES2_ARPC_CPORT_TIMEOUT + timeout);
if (ret) {
dev_err(dev, "failed to send shutdown over cport %u: %d (%d)\n",
- cport_id, ret, result);
+ cport_id, ret, result);
return ret;
}
}
static int es2_cport_quiesce(struct gb_host_device *hd, u16 cport_id,
- size_t peer_space, unsigned int timeout)
+ size_t peer_space, unsigned int timeout)
{
struct es2_ap_dev *es2 = hd_to_es2(hd);
struct device *dev = &es2->usb_dev->dev;
&result, ES2_ARPC_CPORT_TIMEOUT + timeout);
if (ret) {
dev_err(dev, "failed to quiesce cport %u: %d (%d)\n",
- cport_id, ret, result);
+ cport_id, ret, result);
return ret;
}
if (cport_id_valid(hd, cport_id)) {
greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
- urb->actual_length);
+ urb->actual_length);
} else {
dev_err(dev, "invalid cport id %u received\n", cport_id);
}
do {
retval = usb_control_msg(es2->usb_dev,
- usb_rcvctrlpipe(es2->usb_dev, 0),
- GB_APB_REQUEST_LOG,
- USB_DIR_IN | USB_TYPE_VENDOR |
- USB_RECIP_INTERFACE,
- 0x00, 0x00,
- buf,
- APB1_LOG_MSG_SIZE,
- ES2_USB_CTRL_TIMEOUT);
+ usb_rcvctrlpipe(es2->usb_dev, 0),
+ GB_APB_REQUEST_LOG,
+ USB_DIR_IN | USB_TYPE_VENDOR |
+ USB_RECIP_INTERFACE,
+ 0x00, 0x00,
+ buf,
+ APB1_LOG_MSG_SIZE,
+ ES2_USB_CTRL_TIMEOUT);
if (retval > 0)
kfifo_in(&es2->apb_log_fifo, buf, retval);
} while (retval > 0);
}
static ssize_t apb_log_read(struct file *f, char __user *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
struct es2_ap_dev *es2 = file_inode(f)->i_private;
ssize_t ret;
return;
/* XXX We will need to rename this per APB */
es2->apb_log_dentry = debugfs_create_file("apb_log", 0444,
- gb_debugfs_get(), es2,
- &apb_log_fops);
+ gb_debugfs_get(), es2,
+ &apb_log_fops);
}
static void usb_log_disable(struct es2_ap_dev *es2)
}
static ssize_t apb_log_enable_read(struct file *f, char __user *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
struct es2_ap_dev *es2 = file_inode(f)->i_private;
int enable = !IS_ERR_OR_NULL(es2->apb_log_task);
}
static ssize_t apb_log_enable_write(struct file *f, const char __user *buf,
- size_t count, loff_t *ppos)
+ size_t count, loff_t *ppos)
{
int enable;
ssize_t retval;
}
hd = gb_hd_create(&es2_driver, &udev->dev, ES2_GBUF_MSG_SIZE_MAX,
- num_cports);
+ num_cports);
if (IS_ERR(hd)) {
usb_put_dev(udev);
return PTR_ERR(hd);
/* XXX We will need to rename this per APB */
es2->apb_log_enable_dentry = debugfs_create_file("apb_log_enable",
- 0644,
- gb_debugfs_get(), es2,
- &apb_log_enable_fops);
+ 0644,
+ gb_debugfs_get(), es2,
+ &apb_log_enable_fops);
INIT_LIST_HEAD(&es2->arpcs);
spin_lock_init(&es2->arpc_lock);
request.which = which;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_ACTIVATE,
- &request, sizeof(request), NULL, 0);
+ &request, sizeof(request), NULL, 0);
if (ret) {
gbphy_runtime_put_autosuspend(gbphy_dev);
return ret;
}
static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
- u8 which)
+ u8 which)
{
struct gbphy_device *gbphy_dev = ggc->gbphy_dev;
struct device *dev = &gbphy_dev->dev;
request.which = which;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_DEACTIVATE,
- &request, sizeof(request), NULL, 0);
+ &request, sizeof(request), NULL, 0);
if (ret) {
dev_err(dev, "failed to deactivate gpio %u\n", which);
goto out_pm_put;
}
static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc,
- u8 which)
+ u8 which)
{
struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_direction_request request;
}
static int gb_gpio_direction_in_operation(struct gb_gpio_controller *ggc,
- u8 which)
+ u8 which)
{
struct gb_gpio_direction_in_request request;
int ret;
}
static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc,
- u8 which, bool value_high)
+ u8 which, bool value_high)
{
struct gb_gpio_direction_out_request request;
int ret;
}
static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc,
- u8 which)
+ u8 which)
{
struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_value_request request;
}
static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc,
- u8 which, u16 debounce_usec)
+ u8 which, u16 debounce_usec)
{
struct gb_gpio_set_debounce_request request;
int ret;
}
static void _gb_gpio_irq_set_type(struct gb_gpio_controller *ggc,
- u8 hwirq, u8 type)
+ u8 hwirq, u8 type)
{
struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_irq_type_request request;
* before calling this function.
*/
static int gb_gpio_irqchip_add(struct gpio_chip *chip,
- struct irq_chip *irqchip,
- unsigned int first_irq,
- irq_flow_handler_t handler,
- unsigned int type)
+ struct irq_chip *irqchip,
+ unsigned int first_irq,
+ irq_flow_handler_t handler,
+ unsigned int type)
{
struct gb_gpio_controller *ggc;
unsigned int offset;
ggc->irq_handler = handler;
ggc->irq_default_type = type;
ggc->irqdomain = irq_domain_add_simple(NULL,
- ggc->line_max + 1, first_irq,
- &gb_gpio_domain_ops, chip);
+ ggc->line_max + 1, first_irq,
+ &gb_gpio_domain_ops, chip);
if (!ggc->irqdomain) {
ggc->irqchip = NULL;
return -EINVAL;
if (!ggc)
return -ENOMEM;
- connection = gb_connection_create(gbphy_dev->bundle,
- le16_to_cpu(gbphy_dev->cport_desc->id),
- gb_gpio_request_handler);
+ connection =
+ gb_connection_create(gbphy_dev->bundle,
+ le16_to_cpu(gbphy_dev->cport_desc->id),
+ gb_gpio_request_handler);
if (IS_ERR(connection)) {
ret = PTR_ERR(connection);
goto exit_ggc_free;
goto exit_line_free;
ret = gb_gpio_irqchip_add(gpio, irqc, 0,
- handle_level_irq, IRQ_TYPE_NONE);
+ handle_level_irq, IRQ_TYPE_NONE);
if (ret) {
dev_err(&gbphy_dev->dev, "failed to add irq chip: %d\n", ret);
goto exit_line_free;
return ret;
ret = gb_operation_sync(ghid->connection, GB_HID_TYPE_GET_REPORT_DESC,
- NULL, 0, rdesc,
- le16_to_cpu(ghid->hdesc.wReportDescLength));
+ NULL, 0, rdesc,
+ le16_to_cpu(ghid->hdesc.wReportDescLength));
gb_pm_runtime_put_autosuspend(ghid->bundle);
request.report_id = report_id;
ret = gb_operation_sync(ghid->connection, GB_HID_TYPE_GET_REPORT,
- &request, sizeof(request), buf, len);
+ &request, sizeof(request), buf, len);
gb_pm_runtime_put_autosuspend(ghid->bundle);
struct hid_report *report;
list_for_each_entry(report,
- &hid->report_enum[HID_INPUT_REPORT].report_list, list)
+ &hid->report_enum[HID_INPUT_REPORT].report_list,
+ list)
gb_hid_init_report(ghid, report);
list_for_each_entry(report,
- &hid->report_enum[HID_FEATURE_REPORT].report_list, list)
+ &hid->report_enum[HID_FEATURE_REPORT].report_list,
+ list)
gb_hid_init_report(ghid, report);
}
}
static int gb_hid_raw_request(struct hid_device *hid, unsigned char reportnum,
- __u8 *buf, size_t len, unsigned char rtype,
- int reqtype)
+ __u8 *buf, size_t len, unsigned char rtype,
+ int reqtype)
{
switch (reqtype) {
case HID_REQ_GET_REPORT:
return -ENOMEM;
connection = gb_connection_create(bundle, le16_to_cpu(cport_desc->id),
- gb_hid_request_handler);
+ gb_hid_request_handler);
if (IS_ERR(connection)) {
ret = PTR_ERR(connection);
goto err_free_ghid;
/* Response consists only of incoming data */
operation = gb_operation_create(connection, GB_I2C_TYPE_TRANSFER,
- request_size, data_in_size, GFP_KERNEL);
+ request_size, data_in_size, GFP_KERNEL);
if (!operation)
return NULL;
}
static void gb_i2c_decode_response(struct i2c_msg *msgs, u32 msg_count,
- struct gb_i2c_transfer_response *response)
+ struct gb_i2c_transfer_response *response)
{
struct i2c_msg *msg = msgs;
u8 *data;
}
static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev,
- struct i2c_msg *msgs, u32 msg_count)
+ struct i2c_msg *msgs, u32 msg_count)
{
struct gb_connection *connection = gb_i2c_dev->connection;
struct device *dev = &gb_i2c_dev->gbphy_dev->dev;
}
static int gb_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
- int msg_count)
+ int msg_count)
{
struct gb_i2c_device *gb_i2c_dev;
#if 0
/* Later */
static int gb_i2c_smbus_xfer(struct i2c_adapter *adap,
- u16 addr, unsigned short flags, char read_write,
- u8 command, int size, union i2c_smbus_data *data)
+ u16 addr, unsigned short flags, char read_write,
+ u8 command, int size, union i2c_smbus_data *data)
{
struct gb_i2c_device *gb_i2c_dev;
}
static int gb_i2c_probe(struct gbphy_device *gbphy_dev,
- const struct gbphy_device_id *id)
+ const struct gbphy_device_id *id)
{
struct gb_connection *connection;
struct gb_i2c_device *gb_i2c_dev;
if (!gb_i2c_dev)
return -ENOMEM;
- connection = gb_connection_create(gbphy_dev->bundle,
- le16_to_cpu(gbphy_dev->cport_desc->id),
- NULL);
+ connection =
+ gb_connection_create(gbphy_dev->bundle,
+ le16_to_cpu(gbphy_dev->cport_desc->id),
+ NULL);
if (IS_ERR(connection)) {
ret = PTR_ERR(connection);
goto exit_i2cdev_free;
#include "greybus.h"
#include "greybus_trace.h"
-
static ssize_t eject_store(struct device *dev,
- struct device_attribute *attr,
- const char *buf, size_t len)
+ struct device_attribute *attr,
+ const char *buf, size_t len)
{
struct gb_module *module = to_gb_module(dev);
struct gb_interface *intf;
static DEVICE_ATTR_WO(eject);
static ssize_t module_id_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_module *module = to_gb_module(dev);
static DEVICE_ATTR_RO(module_id);
static ssize_t num_interfaces_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_module *module = to_gb_module(dev);
};
struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
- size_t num_interfaces)
+ size_t num_interfaces)
{
struct gb_interface *intf;
struct gb_module *module;
intf = gb_interface_create(module, module_id + i);
if (!intf) {
dev_err(&module->dev, "failed to create interface %u\n",
- module_id + i);
+ module_id + i);
goto err_put_interfaces;
}
module->interfaces[i] = intf;
if (ret) {
if (intf->type != GB_INTERFACE_TYPE_DUMMY) {
dev_err(&module->dev,
- "failed to activate interface %u: %d\n",
- intf_id, ret);
+ "failed to activate interface %u: %d\n",
+ intf_id, ret);
}
gb_interface_add(intf);
ret = gb_interface_enable(intf);
if (ret) {
dev_err(&module->dev, "failed to enable interface %u: %d\n",
- intf_id, ret);
+ intf_id, ret);
goto err_interface_deactivate;
}
static DEFINE_SPINLOCK(gb_operations_lock);
static int gb_operation_response_send(struct gb_operation *operation,
- int errno);
+ int errno);
/*
* Increment operation active count and add to connection list unless the
spin_lock_irqsave(&connection->lock, flags);
list_for_each_entry(operation, &connection->operations, links)
if (operation->id == operation_id &&
- !gb_operation_is_incoming(operation)) {
+ !gb_operation_is_incoming(operation)) {
gb_operation_get(operation);
found = true;
break;
}
static void gb_operation_message_init(struct gb_host_device *hd,
- struct gb_message *message, u16 operation_id,
- size_t payload_size, u8 type)
+ struct gb_message *message,
+ u16 operation_id,
+ size_t payload_size, u8 type)
{
struct gb_operation_msg_hdr *header;
*/
static struct gb_message *
gb_operation_message_alloc(struct gb_host_device *hd, u8 type,
- size_t payload_size, gfp_t gfp_flags)
+ size_t payload_size, gfp_t gfp_flags)
{
struct gb_message *message;
struct gb_operation_msg_hdr *header;
if (message_size > hd->buffer_size_max) {
dev_warn(&hd->dev, "requested message size too big (%zu > %zu)\n",
- message_size, hd->buffer_size_max);
+ message_size, hd->buffer_size_max);
return NULL;
}
}
bool gb_operation_response_alloc(struct gb_operation *operation,
- size_t response_size, gfp_t gfp)
+ size_t response_size, gfp_t gfp)
{
struct gb_host_device *hd = operation->connection->hd;
struct gb_operation_msg_hdr *request_header;
*/
static struct gb_operation *
gb_operation_create_common(struct gb_connection *connection, u8 type,
- size_t request_size, size_t response_size,
- unsigned long op_flags, gfp_t gfp_flags)
+ size_t request_size, size_t response_size,
+ unsigned long op_flags, gfp_t gfp_flags)
{
struct gb_host_device *hd = connection->hd;
struct gb_operation *operation;
*/
struct gb_operation *
gb_operation_create_flags(struct gb_connection *connection,
- u8 type, size_t request_size,
- size_t response_size, unsigned long flags,
- gfp_t gfp)
+ u8 type, size_t request_size,
+ size_t response_size, unsigned long flags,
+ gfp_t gfp)
{
struct gb_operation *operation;
flags &= GB_OPERATION_FLAG_USER_MASK;
operation = gb_operation_create_common(connection, type,
- request_size, response_size,
- flags, gfp);
+ request_size, response_size,
+ flags, gfp);
if (operation)
trace_gb_operation_create(operation);
struct gb_operation *
gb_operation_create_core(struct gb_connection *connection,
- u8 type, size_t request_size,
- size_t response_size, unsigned long flags,
- gfp_t gfp)
+ u8 type, size_t request_size,
+ size_t response_size, unsigned long flags,
+ gfp_t gfp)
{
struct gb_operation *operation;
flags |= GB_OPERATION_FLAG_CORE;
operation = gb_operation_create_common(connection, type,
- request_size, response_size,
- flags, gfp);
+ request_size, response_size,
+ flags, gfp);
if (operation)
trace_gb_operation_create_core(operation);
return operation;
}
+
/* Do not export this function. */
size_t gb_operation_get_payload_size_max(struct gb_connection *connection)
static struct gb_operation *
gb_operation_create_incoming(struct gb_connection *connection, u16 id,
- u8 type, void *data, size_t size)
+ u8 type, void *data, size_t size)
{
struct gb_operation *operation;
size_t request_size;
flags |= GB_OPERATION_FLAG_UNIDIRECTIONAL;
operation = gb_operation_create_common(connection, type,
- request_size,
- GB_REQUEST_TYPE_INVALID,
- flags, GFP_ATOMIC);
+ request_size,
+ GB_REQUEST_TYPE_INVALID,
+ flags, GFP_ATOMIC);
if (!operation)
return NULL;
* or a negative errno.
*/
int gb_operation_request_send(struct gb_operation *operation,
- gb_operation_callback callback,
- unsigned int timeout,
- gfp_t gfp)
+ gb_operation_callback callback,
+ unsigned int timeout,
+ gfp_t gfp)
{
struct gb_connection *connection = operation->connection;
struct gb_operation_msg_hdr *header;
* operation.
*/
int gb_operation_request_send_sync_timeout(struct gb_operation *operation,
- unsigned int timeout)
+ unsigned int timeout)
{
int ret;
* allocate the response message if necessary.
*/
static int gb_operation_response_send(struct gb_operation *operation,
- int errno)
+ int errno)
{
struct gb_connection *connection = operation->connection;
int ret;
if (!operation->response &&
- !gb_operation_is_unidirectional(operation)) {
+ !gb_operation_is_unidirectional(operation)) {
if (!gb_operation_response_alloc(operation, 0, GFP_KERNEL))
return -ENOMEM;
}
* This function is called when a message send request has completed.
*/
void greybus_message_sent(struct gb_host_device *hd,
- struct gb_message *message, int status)
+ struct gb_message *message, int status)
{
struct gb_operation *operation = message->operation;
struct gb_connection *connection = operation->connection;
} else if (status || gb_operation_is_unidirectional(operation)) {
if (gb_operation_result_set(operation, status)) {
queue_work(gb_operation_completion_wq,
- &operation->work);
+ &operation->work);
}
}
}
type = header->type;
operation = gb_operation_create_incoming(connection, operation_id,
- type, data, size);
+ type, data, size);
if (!operation) {
dev_err(&connection->hd->dev,
"%s: can't create incoming operation\n",
if (!operation_id) {
dev_err_ratelimited(&connection->hd->dev,
- "%s: invalid response id 0 received\n",
- connection->name);
+ "%s: invalid response id 0 received\n",
+ connection->name);
return;
}
operation = gb_operation_find_outgoing(connection, operation_id);
if (!operation) {
dev_err_ratelimited(&connection->hd->dev,
- "%s: unexpected response id 0x%04x received\n",
- connection->name, operation_id);
+ "%s: unexpected response id 0x%04x received\n",
+ connection->name, operation_id);
return;
}
message_size = sizeof(*header) + message->payload_size;
if (!errno && size > message_size) {
dev_err_ratelimited(&connection->hd->dev,
- "%s: malformed response 0x%02x received (%zu > %zu)\n",
- connection->name, header->type,
- size, message_size);
+ "%s: malformed response 0x%02x received (%zu > %zu)\n",
+ connection->name, header->type,
+ size, message_size);
errno = -EMSGSIZE;
} else if (!errno && size < message_size) {
if (gb_operation_short_response_allowed(operation)) {
message->payload_size = size - sizeof(*header);
} else {
dev_err_ratelimited(&connection->hd->dev,
- "%s: short response 0x%02x received (%zu < %zu)\n",
- connection->name, header->type,
- size, message_size);
+ "%s: short response 0x%02x received (%zu < %zu)\n",
+ connection->name, header->type,
+ size, message_size);
errno = -EMSGSIZE;
}
}
* with, it's effectively dropped).
*/
void gb_connection_recv(struct gb_connection *connection,
- void *data, size_t size)
+ void *data, size_t size)
{
struct gb_operation_msg_hdr header;
struct device *dev = &connection->hd->dev;
size_t msg_size;
if (connection->state == GB_CONNECTION_STATE_DISABLED ||
- gb_connection_is_offloaded(connection)) {
+ gb_connection_is_offloaded(connection)) {
dev_warn_ratelimited(dev, "%s: dropping %zu received bytes\n",
- connection->name, size);
+ connection->name, size);
return;
}
if (size < sizeof(header)) {
dev_err_ratelimited(dev, "%s: short message received\n",
- connection->name);
+ connection->name);
return;
}
msg_size = le16_to_cpu(header.size);
if (size < msg_size) {
dev_err_ratelimited(dev,
- "%s: incomplete message 0x%04x of type 0x%02x received (%zu < %zu)\n",
- connection->name,
- le16_to_cpu(header.operation_id),
- header.type, size, msg_size);
+ "%s: incomplete message 0x%04x of type 0x%02x received (%zu < %zu)\n",
+ connection->name,
+ le16_to_cpu(header.operation_id),
+ header.type, size, msg_size);
return; /* XXX Should still complete operation */
}
if (header.type & GB_MESSAGE_TYPE_RESPONSE) {
gb_connection_recv_response(connection, &header, data,
- msg_size);
+ msg_size);
} else {
gb_connection_recv_request(connection, &header, data,
- msg_size);
+ msg_size);
}
}
atomic_inc(&operation->waiters);
wait_event(gb_operation_cancellation_queue,
- !gb_operation_is_active(operation));
+ !gb_operation_is_active(operation));
atomic_dec(&operation->waiters);
}
EXPORT_SYMBOL_GPL(gb_operation_cancel);
atomic_inc(&operation->waiters);
wait_event(gb_operation_cancellation_queue,
- !gb_operation_is_active(operation));
+ !gb_operation_is_active(operation));
atomic_dec(&operation->waiters);
}
* If there is an error, the response buffer is left alone.
*/
int gb_operation_sync_timeout(struct gb_connection *connection, int type,
- void *request, int request_size,
- void *response, int response_size,
- unsigned int timeout)
+ void *request, int request_size,
+ void *response, int response_size,
+ unsigned int timeout)
{
struct gb_operation *operation;
int ret;
* the request as actually reached the remote end of the connection.
*/
int gb_operation_unidirectional_timeout(struct gb_connection *connection,
- int type, void *request, int request_size,
- unsigned int timeout)
+ int type, void *request,
+ int request_size,
+ unsigned int timeout)
{
struct gb_operation *operation;
int ret;
return -EINVAL;
operation = gb_operation_create_flags(connection, type,
- request_size, 0,
- GB_OPERATION_FLAG_UNIDIRECTIONAL,
- GFP_KERNEL);
+ request_size, 0,
+ GB_OPERATION_FLAG_UNIDIRECTIONAL,
+ GFP_KERNEL);
if (!operation)
return -ENOMEM;
int __init gb_operation_init(void)
{
gb_message_cache = kmem_cache_create("gb_message_cache",
- sizeof(struct gb_message), 0, 0, NULL);
+ sizeof(struct gb_message), 0, 0,
+ NULL);
if (!gb_message_cache)
return -ENOMEM;
gb_operation_cache = kmem_cache_create("gb_operation_cache",
- sizeof(struct gb_operation), 0, 0, NULL);
+ sizeof(struct gb_operation), 0,
+ 0, NULL);
if (!gb_operation_cache)
goto err_destroy_message_cache;
gb_operation_completion_wq = alloc_workqueue("greybus_completion",
- 0, 0);
+ 0, 0);
if (!gb_operation_completion_wq)
goto err_destroy_operation_cache;
struct gb_operation *operation;
};
-
static int gb_svc_queue_deferred_request(struct gb_operation *operation);
static ssize_t endo_id_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_svc *svc = to_gb_svc(dev);
static DEVICE_ATTR_RO(endo_id);
static ssize_t ap_intf_id_show(struct device *dev,
- struct device_attribute *attr, char *buf)
+ struct device_attribute *attr, char *buf)
{
struct gb_svc *svc = to_gb_svc(dev);
type = GB_SVC_TYPE_INTF_VSYS_DISABLE;
ret = gb_operation_sync(svc->connection, type,
- &request, sizeof(request),
- &response, sizeof(response));
+ &request, sizeof(request),
+ &response, sizeof(response));
if (ret < 0)
return ret;
if (response.result_code != GB_SVC_INTF_VSYS_OK)
type = GB_SVC_TYPE_INTF_REFCLK_DISABLE;
ret = gb_operation_sync(svc->connection, type,
- &request, sizeof(request),
- &response, sizeof(response));
+ &request, sizeof(request),
+ &response, sizeof(response));
if (ret < 0)
return ret;
if (response.result_code != GB_SVC_INTF_REFCLK_OK)
type = GB_SVC_TYPE_INTF_UNIPRO_DISABLE;
ret = gb_operation_sync(svc->connection, type,
- &request, sizeof(request),
- &response, sizeof(response));
+ &request, sizeof(request),
+ &response, sizeof(response));
if (ret < 0)
return ret;
if (response.result_code != GB_SVC_INTF_UNIPRO_OK)
request.intf_id = intf_id;
ret = gb_operation_sync_timeout(svc->connection,
- GB_SVC_TYPE_INTF_ACTIVATE,
- &request, sizeof(request),
- &response, sizeof(response),
- SVC_INTF_ACTIVATE_TIMEOUT);
+ GB_SVC_TYPE_INTF_ACTIVATE,
+ &request, sizeof(request),
+ &response, sizeof(response),
+ SVC_INTF_ACTIVATE_TIMEOUT);
if (ret < 0)
return ret;
if (response.status != GB_SVC_OP_SUCCESS) {
dev_err(&svc->dev, "failed to activate interface %u: %u\n",
- intf_id, response.status);
+ intf_id, response.status);
return -EREMOTEIO;
}
&response, sizeof(response));
if (ret) {
dev_err(&svc->dev, "failed to get DME attribute (%u 0x%04x %u): %d\n",
- intf_id, attr, selector, ret);
+ intf_id, attr, selector, ret);
return ret;
}
result = le16_to_cpu(response.result_code);
if (result) {
dev_err(&svc->dev, "UniPro error while getting DME attribute (%u 0x%04x %u): %u\n",
- intf_id, attr, selector, result);
+ intf_id, attr, selector, result);
return -EREMOTEIO;
}
&response, sizeof(response));
if (ret) {
dev_err(&svc->dev, "failed to set DME attribute (%u 0x%04x %u %u): %d\n",
- intf_id, attr, selector, value, ret);
+ intf_id, attr, selector, value, ret);
return ret;
}
result = le16_to_cpu(response.result_code);
if (result) {
dev_err(&svc->dev, "UniPro error while setting DME attribute (%u 0x%04x %u %u): %u\n",
- intf_id, attr, selector, value, result);
+ intf_id, attr, selector, value, result);
return -EREMOTEIO;
}
}
int gb_svc_connection_create(struct gb_svc *svc,
- u8 intf1_id, u16 cport1_id,
- u8 intf2_id, u16 cport2_id,
- u8 cport_flags)
+ u8 intf1_id, u16 cport1_id,
+ u8 intf2_id, u16 cport2_id,
+ u8 cport_flags)
{
struct gb_svc_conn_create_request request;
&request, sizeof(request), NULL, 0);
if (ret) {
dev_err(&svc->dev, "failed to destroy connection (%u:%u %u:%u): %d\n",
- intf1_id, cport1_id, intf2_id, cport2_id, ret);
+ intf1_id, cport1_id, intf2_id, cport2_id, ret);
}
}
/* Creates bi-directional routes between the devices */
int gb_svc_route_create(struct gb_svc *svc, u8 intf1_id, u8 dev1_id,
- u8 intf2_id, u8 dev2_id)
+ u8 intf2_id, u8 dev2_id)
{
struct gb_svc_route_create_request request;
&request, sizeof(request), NULL, 0);
if (ret) {
dev_err(&svc->dev, "failed to destroy route (%u %u): %d\n",
- intf1_id, intf2_id, ret);
+ intf1_id, intf2_id, ret);
}
}
if (op->request->payload_size < sizeof(*request)) {
dev_err(&svc->dev, "short version request (%zu < %zu)\n",
- op->request->payload_size,
- sizeof(*request));
+ op->request->payload_size,
+ sizeof(*request));
return -EINVAL;
}
if (request->major > GB_SVC_VERSION_MAJOR) {
dev_warn(&svc->dev, "unsupported major version (%u > %u)\n",
- request->major, GB_SVC_VERSION_MAJOR);
+ request->major, GB_SVC_VERSION_MAJOR);
return -ENOTSUPP;
}
if (op->request->payload_size < sizeof(*hello_request)) {
dev_warn(&svc->dev, "short hello request (%zu < %zu)\n",
- op->request->payload_size,
- sizeof(*hello_request));
+ op->request->payload_size,
+ sizeof(*hello_request));
return -EINVAL;
}
}
static struct gb_interface *gb_svc_interface_lookup(struct gb_svc *svc,
- u8 intf_id)
+ u8 intf_id)
{
struct gb_host_device *hd = svc->hd;
struct gb_module *module;
num_interfaces = module->num_interfaces;
if (intf_id >= module_id &&
- intf_id < module_id + num_interfaces) {
+ intf_id < module_id + num_interfaces) {
return module->interfaces[intf_id - module_id];
}
}
if (ret)
dev_warn(&svc->dev,
- "power mode change failed on AP to switch link: %d\n",
- ret);
+ "power mode change failed on AP to switch link: %d\n",
+ ret);
}
static void gb_svc_process_module_inserted(struct gb_operation *operation)
flags = le16_to_cpu(request->flags);
dev_dbg(&svc->dev, "%s - id = %u, num_interfaces = %zu, flags = 0x%04x\n",
- __func__, module_id, num_interfaces, flags);
+ __func__, module_id, num_interfaces, flags);
if (flags & GB_SVC_MODULE_INSERTED_FLAG_NO_PRIMARY) {
dev_warn(&svc->dev, "no primary interface detected on module %u\n",
- module_id);
+ module_id);
}
module = gb_svc_module_lookup(svc, module_id);
if (module) {
dev_warn(&svc->dev, "unexpected module-inserted event %u\n",
- module_id);
+ module_id);
return;
}
module = gb_svc_module_lookup(svc, module_id);
if (!module) {
dev_warn(&svc->dev, "unexpected module-removed event %u\n",
- module_id);
+ module_id);
return;
}
mailbox = le32_to_cpu(request->mailbox);
dev_dbg(&svc->dev, "%s - id = %u, result = 0x%04x, mailbox = 0x%08x\n",
- __func__, intf_id, result_code, mailbox);
+ __func__, intf_id, result_code, mailbox);
intf = gb_svc_interface_lookup(svc, intf_id);
if (!intf) {
if (request->payload_size < sizeof(*reset)) {
dev_warn(&svc->dev, "short reset request received (%zu < %zu)\n",
- request->payload_size, sizeof(*reset));
+ request->payload_size, sizeof(*reset));
return -EINVAL;
}
reset = request->payload;
if (op->request->payload_size < sizeof(*request)) {
dev_warn(&svc->dev, "short module-inserted request received (%zu < %zu)\n",
- op->request->payload_size, sizeof(*request));
+ op->request->payload_size, sizeof(*request));
return -EINVAL;
}
request = op->request->payload;
dev_dbg(&svc->dev, "%s - id = %u\n", __func__,
- request->primary_intf_id);
+ request->primary_intf_id);
return gb_svc_queue_deferred_request(op);
}
if (op->request->payload_size < sizeof(*request)) {
dev_warn(&svc->dev, "short module-removed request received (%zu < %zu)\n",
- op->request->payload_size, sizeof(*request));
+ op->request->payload_size, sizeof(*request));
return -EINVAL;
}
request = op->request->payload;
dev_dbg(&svc->dev, "%s - id = %u\n", __func__,
- request->primary_intf_id);
+ request->primary_intf_id);
return gb_svc_queue_deferred_request(op);
}
if (op->request->payload_size < sizeof(*request)) {
dev_warn(&svc->dev, "short mailbox request received (%zu < %zu)\n",
- op->request->payload_size, sizeof(*request));
+ op->request->payload_size, sizeof(*request));
return -EINVAL;
}
if (ret) {
dev_warn(&svc->dev, "unexpected request 0x%02x received (state %u)\n",
- type, svc->state);
+ type, svc->state);
return ret;
}
svc->hd = hd;
svc->connection = gb_connection_create_static(hd, GB_SVC_CPORT_ID,
- gb_svc_request_handler);
+ gb_svc_request_handler);
if (IS_ERR(svc->connection)) {
dev_err(&svc->dev, "failed to create connection: %ld\n",
- PTR_ERR(svc->connection));
+ PTR_ERR(svc->connection));
goto err_put_device;
}