Commit 8478c35a authored by Cristian Sicilia's avatar Cristian Sicilia Committed by Greg Kroah-Hartman

staging: greybus: Parenthesis alignment

Some parameters are aligned with parentheses.
Some parentheses was opened at end of line.
Signed-off-by: default avatarCristian Sicilia <sicilia.cristian@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 2f5496d8
...@@ -25,8 +25,8 @@ struct gb_audio_manager_module_attribute { ...@@ -25,8 +25,8 @@ struct gb_audio_manager_module_attribute {
const char *buf, size_t count); const char *buf, size_t count);
}; };
static ssize_t gb_audio_module_attr_show( static ssize_t gb_audio_module_attr_show(struct kobject *kobj,
struct kobject *kobj, struct attribute *attr, char *buf) struct attribute *attr, char *buf)
{ {
struct gb_audio_manager_module_attribute *attribute; struct gb_audio_manager_module_attribute *attribute;
struct gb_audio_manager_module *module; struct gb_audio_manager_module *module;
......
...@@ -11,9 +11,9 @@ ...@@ -11,9 +11,9 @@
#include "audio_manager.h" #include "audio_manager.h"
#include "audio_manager_private.h" #include "audio_manager_private.h"
static ssize_t manager_sysfs_add_store( static ssize_t manager_sysfs_add_store(struct kobject *kobj,
struct kobject *kobj, struct kobj_attribute *attr, struct kobj_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
struct gb_audio_manager_module_descriptor desc = { {0} }; struct gb_audio_manager_module_descriptor desc = { {0} };
...@@ -36,9 +36,9 @@ static ssize_t manager_sysfs_add_store( ...@@ -36,9 +36,9 @@ static ssize_t manager_sysfs_add_store(
static struct kobj_attribute manager_add_attribute = static struct kobj_attribute manager_add_attribute =
__ATTR(add, 0664, NULL, manager_sysfs_add_store); __ATTR(add, 0664, NULL, manager_sysfs_add_store);
static ssize_t manager_sysfs_remove_store( static ssize_t manager_sysfs_remove_store(struct kobject *kobj,
struct kobject *kobj, struct kobj_attribute *attr, struct kobj_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int id; int id;
...@@ -57,9 +57,9 @@ static ssize_t manager_sysfs_remove_store( ...@@ -57,9 +57,9 @@ static ssize_t manager_sysfs_remove_store(
static struct kobj_attribute manager_remove_attribute = static struct kobj_attribute manager_remove_attribute =
__ATTR(remove, 0664, NULL, manager_sysfs_remove_store); __ATTR(remove, 0664, NULL, manager_sysfs_remove_store);
static ssize_t manager_sysfs_dump_store( static ssize_t manager_sysfs_dump_store(struct kobject *kobj,
struct kobject *kobj, struct kobj_attribute *attr, struct kobj_attribute *attr,
const char *buf, size_t count) const char *buf, size_t count)
{ {
int id; int id;
...@@ -81,8 +81,8 @@ static ssize_t manager_sysfs_dump_store( ...@@ -81,8 +81,8 @@ static ssize_t manager_sysfs_dump_store(
static struct kobj_attribute manager_dump_attribute = static struct kobj_attribute manager_dump_attribute =
__ATTR(dump, 0664, NULL, manager_sysfs_dump_store); __ATTR(dump, 0664, NULL, manager_sysfs_dump_store);
static void manager_sysfs_init_attribute( static void manager_sysfs_init_attribute(struct kobject *kobj,
struct kobject *kobj, struct kobj_attribute *kattr) struct kobj_attribute *kattr)
{ {
int err; int err;
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
*/ */
static int gbaudio_request_jack(struct gbaudio_module_info *module, 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; int report;
struct snd_jack *jack = module->headset_jack.jack; struct snd_jack *jack = module->headset_jack.jack;
...@@ -26,8 +26,8 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module, ...@@ -26,8 +26,8 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module,
if (!jack) { if (!jack) {
dev_err_ratelimited(module->dev, dev_err_ratelimited(module->dev,
"Invalid jack event received:type: %u, event: %u\n", "Invalid jack event received:type: %u, event: %u\n",
req->jack_attribute, req->event); req->jack_attribute, req->event);
return -EINVAL; return -EINVAL;
} }
...@@ -50,8 +50,8 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module, ...@@ -50,8 +50,8 @@ static int gbaudio_request_jack(struct gbaudio_module_info *module,
report = req->jack_attribute & module->jack_mask; report = req->jack_attribute & module->jack_mask;
if (!report) { if (!report) {
dev_err_ratelimited(module->dev, dev_err_ratelimited(module->dev,
"Invalid jack event received:type: %u, event: %u\n", "Invalid jack event received:type: %u, event: %u\n",
req->jack_attribute, req->event); req->jack_attribute, req->event);
return -EINVAL; return -EINVAL;
} }
...@@ -74,8 +74,8 @@ static int gbaudio_request_button(struct gbaudio_module_info *module, ...@@ -74,8 +74,8 @@ static int gbaudio_request_button(struct gbaudio_module_info *module,
if (!btn_jack) { if (!btn_jack) {
dev_err_ratelimited(module->dev, dev_err_ratelimited(module->dev,
"Invalid button event received:type: %u, event: %u\n", "Invalid button event received:type: %u, event: %u\n",
req->button_id, req->event); req->button_id, req->event);
return -EINVAL; return -EINVAL;
} }
...@@ -210,8 +210,8 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule, ...@@ -210,8 +210,8 @@ static int gb_audio_add_data_connection(struct gbaudio_module_info *gbmodule,
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create_offloaded(bundle, connection = gb_connection_create_offloaded(bundle,
le16_to_cpu(cport_desc->id), le16_to_cpu(cport_desc->id),
GB_CONNECTION_FLAG_CSD); GB_CONNECTION_FLAG_CSD);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
devm_kfree(gbmodule->dev, dai); devm_kfree(gbmodule->dev, dai);
return PTR_ERR(connection); return PTR_ERR(connection);
...@@ -317,7 +317,7 @@ static int gb_audio_probe(struct gb_bundle *bundle, ...@@ -317,7 +317,7 @@ static int gb_audio_probe(struct gb_bundle *bundle,
ret = gbaudio_tplg_parse_data(gbmodule, topology); ret = gbaudio_tplg_parse_data(gbmodule, topology);
if (ret) { if (ret) {
dev_err(dev, "%d:Error while parsing topology data\n", dev_err(dev, "%d:Error while parsing topology data\n",
ret); ret);
goto free_topology; goto free_topology;
} }
gbmodule->topology = topology; gbmodule->topology = topology;
......
...@@ -158,7 +158,7 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb, ...@@ -158,7 +158,7 @@ static const char **gb_generate_enum_strings(struct gbaudio_module_info *gb,
} }
static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, 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; unsigned int max;
const char *name; const char *name;
...@@ -209,7 +209,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol, ...@@ -209,7 +209,7 @@ static int gbcodec_mixer_ctl_info(struct snd_kcontrol *kcontrol,
} }
static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol) struct snd_ctl_elem_value *ucontrol)
{ {
int ret; int ret;
struct gb_audio_ctl_elem_info *info; struct gb_audio_ctl_elem_info *info;
...@@ -271,7 +271,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol, ...@@ -271,7 +271,7 @@ static int gbcodec_mixer_ctl_get(struct snd_kcontrol *kcontrol,
} }
static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, 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; int ret = 0;
struct gb_audio_ctl_elem_info *info; struct gb_audio_ctl_elem_info *info;
...@@ -347,7 +347,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -347,7 +347,7 @@ static int gbcodec_mixer_ctl_put(struct snd_kcontrol *kcontrol,
* of DAPM related sequencing, etc. * of DAPM related sequencing, etc.
*/ */
static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol, 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; int platform_max, platform_min;
struct gbaudio_ctl_pvt *data; struct gbaudio_ctl_pvt *data;
...@@ -378,7 +378,7 @@ static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol, ...@@ -378,7 +378,7 @@ static int gbcodec_mixer_dapm_ctl_info(struct snd_kcontrol *kcontrol,
} }
static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, 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; int ret;
struct gb_audio_ctl_elem_info *info; struct gb_audio_ctl_elem_info *info;
...@@ -427,7 +427,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol, ...@@ -427,7 +427,7 @@ static int gbcodec_mixer_dapm_ctl_get(struct snd_kcontrol *kcontrol,
} }
static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, 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; int ret, wi, max, connect;
unsigned int mask, val; unsigned int mask, val;
...@@ -501,7 +501,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol, ...@@ -501,7 +501,7 @@ static int gbcodec_mixer_dapm_ctl_put(struct snd_kcontrol *kcontrol,
.private_value = (unsigned long)data} .private_value = (unsigned long)data}
static int gbcodec_event_spk(struct snd_soc_dapm_widget *w, 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 */ /* Ensure GB speaker is connected */
...@@ -509,7 +509,7 @@ static int gbcodec_event_spk(struct snd_soc_dapm_widget *w, ...@@ -509,7 +509,7 @@ static int gbcodec_event_spk(struct snd_soc_dapm_widget *w,
} }
static int gbcodec_event_hp(struct snd_soc_dapm_widget *w, 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 */ /* Ensure GB module supports jack slot */
...@@ -517,7 +517,7 @@ static int gbcodec_event_hp(struct snd_soc_dapm_widget *w, ...@@ -517,7 +517,7 @@ static int gbcodec_event_hp(struct snd_soc_dapm_widget *w,
} }
static int gbcodec_event_int_mic(struct snd_soc_dapm_widget *w, 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 */ /* Ensure GB module supports jack slot */
...@@ -664,7 +664,7 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb, ...@@ -664,7 +664,7 @@ static int gbaudio_tplg_create_enum_kctl(struct gbaudio_module_info *gb,
/* debug enum info */ /* debug enum info */
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, 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++) for (i = 0; i < gbe->max; i++)
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]); dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
...@@ -873,7 +873,7 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, ...@@ -873,7 +873,7 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb,
/* debug enum info */ /* debug enum info */
dev_dbg(gb->dev, "Max:%d, name_length:%d\n", gbe->max, 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++) for (i = 0; i < gbe->max; i++)
dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]); dev_dbg(gb->dev, "src[%d]: %s\n", i, gbe->texts[i]);
...@@ -884,8 +884,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb, ...@@ -884,8 +884,8 @@ static int gbaudio_tplg_create_enum_ctl(struct gbaudio_module_info *gb,
} }
static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb, static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb,
struct snd_kcontrol_new *kctl, struct snd_kcontrol_new *kctl,
struct gb_audio_control *ctl) struct gb_audio_control *ctl)
{ {
struct gbaudio_ctl_pvt *ctldata; struct gbaudio_ctl_pvt *ctldata;
...@@ -905,8 +905,8 @@ static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb, ...@@ -905,8 +905,8 @@ static int gbaudio_tplg_create_mixer_ctl(struct gbaudio_module_info *gb,
} }
static int gbaudio_tplg_create_wcontrol(struct gbaudio_module_info *gb, static int gbaudio_tplg_create_wcontrol(struct gbaudio_module_info *gb,
struct snd_kcontrol_new *kctl, struct snd_kcontrol_new *kctl,
struct gb_audio_control *ctl) struct gb_audio_control *ctl)
{ {
int ret; int ret;
...@@ -1086,9 +1086,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, ...@@ -1086,9 +1086,10 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module,
case snd_soc_dapm_switch: case snd_soc_dapm_switch:
*dw = (struct snd_soc_dapm_widget) *dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_SWITCH_E(w->name, SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_SWITCH_E(w->name, SND_SOC_NOPM, 0, 0,
widget_kctls, gbaudio_widget_event, widget_kctls,
SND_SOC_DAPM_PRE_PMU | gbaudio_widget_event,
SND_SOC_DAPM_POST_PMD); SND_SOC_DAPM_PRE_PMU |
SND_SOC_DAPM_POST_PMD);
break; break;
case snd_soc_dapm_pga: case snd_soc_dapm_pga:
*dw = (struct snd_soc_dapm_widget) *dw = (struct snd_soc_dapm_widget)
...@@ -1100,16 +1101,16 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, ...@@ -1100,16 +1101,16 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module,
case snd_soc_dapm_mixer: case snd_soc_dapm_mixer:
*dw = (struct snd_soc_dapm_widget) *dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_MIXER_E(w->name, SND_SOC_NOPM, 0, 0, NULL, SND_SOC_DAPM_MIXER_E(w->name, SND_SOC_NOPM, 0, 0, NULL,
0, gbaudio_widget_event, 0, gbaudio_widget_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMU |
SND_SOC_DAPM_POST_PMD); SND_SOC_DAPM_POST_PMD);
break; break;
case snd_soc_dapm_mux: case snd_soc_dapm_mux:
*dw = (struct snd_soc_dapm_widget) *dw = (struct snd_soc_dapm_widget)
SND_SOC_DAPM_MUX_E(w->name, SND_SOC_NOPM, 0, 0, SND_SOC_DAPM_MUX_E(w->name, SND_SOC_NOPM, 0, 0,
widget_kctls, gbaudio_widget_event, widget_kctls, gbaudio_widget_event,
SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_PRE_PMU |
SND_SOC_DAPM_POST_PMD); SND_SOC_DAPM_POST_PMD);
break; break;
case snd_soc_dapm_aif_in: case snd_soc_dapm_aif_in:
*dw = (struct snd_soc_dapm_widget) *dw = (struct snd_soc_dapm_widget)
...@@ -1145,7 +1146,7 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module, ...@@ -1145,7 +1146,7 @@ static int gbaudio_tplg_create_widget(struct gbaudio_module_info *module,
} }
static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, 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; int i, csize, ret;
struct snd_kcontrol_new *dapm_kctls; struct snd_kcontrol_new *dapm_kctls;
...@@ -1215,7 +1216,7 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module, ...@@ -1215,7 +1216,7 @@ static int gbaudio_tplg_process_kcontrols(struct gbaudio_module_info *module,
} }
static int gbaudio_tplg_process_widgets(struct gbaudio_module_info *module, 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; int i, ret, w_size;
struct snd_soc_dapm_widget *dapm_widgets; struct snd_soc_dapm_widget *dapm_widgets;
...@@ -1264,7 +1265,7 @@ static int gbaudio_tplg_process_widgets(struct gbaudio_module_info *module, ...@@ -1264,7 +1265,7 @@ static int gbaudio_tplg_process_widgets(struct gbaudio_module_info *module,
} }
static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module, static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module,
struct gb_audio_route *routes) struct gb_audio_route *routes)
{ {
int i, ret; int i, ret;
struct snd_soc_dapm_route *dapm_routes; struct snd_soc_dapm_route *dapm_routes;
...@@ -1300,8 +1301,8 @@ static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module, ...@@ -1300,8 +1301,8 @@ static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module,
} }
dapm_routes->control = dapm_routes->control =
gbaudio_map_controlid(module, gbaudio_map_controlid(module,
curr->control_id, curr->control_id,
curr->index); curr->index);
if ((curr->control_id != GBAUDIO_INVALID_ID) && if ((curr->control_id != GBAUDIO_INVALID_ID) &&
!dapm_routes->control) { !dapm_routes->control) {
dev_err(module->dev, "%d:%d:%d:%d - Invalid control\n", dev_err(module->dev, "%d:%d:%d:%d - Invalid control\n",
...@@ -1325,7 +1326,7 @@ static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module, ...@@ -1325,7 +1326,7 @@ static int gbaudio_tplg_process_routes(struct gbaudio_module_info *module,
} }
static int gbaudio_tplg_process_header(struct gbaudio_module_info *module, 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 */ /* fetch no. of kcontrols, widgets & routes */
module->num_controls = tplg_data->num_controls; module->num_controls = tplg_data->num_controls;
...@@ -1351,7 +1352,7 @@ static int gbaudio_tplg_process_header(struct gbaudio_module_info *module, ...@@ -1351,7 +1352,7 @@ static int gbaudio_tplg_process_header(struct gbaudio_module_info *module,
} }
int gbaudio_tplg_parse_data(struct gbaudio_module_info *module, int gbaudio_tplg_parse_data(struct gbaudio_module_info *module,
struct gb_audio_topology *tplg_data) struct gb_audio_topology *tplg_data)
{ {
int ret; int ret;
struct gb_audio_control *controls; struct gb_audio_control *controls;
......
...@@ -86,7 +86,8 @@ static void gb_bootrom_timedout(struct work_struct *work) ...@@ -86,7 +86,8 @@ static void gb_bootrom_timedout(struct work_struct *work)
} }
static void gb_bootrom_set_timeout(struct gb_bootrom *bootrom, 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; bootrom->next_request = next;
schedule_delayed_work(&bootrom->dwork, msecs_to_jiffies(timeout)); schedule_delayed_work(&bootrom->dwork, msecs_to_jiffies(timeout));
...@@ -175,7 +176,7 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 stage) ...@@ -175,7 +176,7 @@ static int find_firmware(struct gb_bootrom *bootrom, u8 stage)
firmware_name); firmware_name);
rc = request_firmware(&bootrom->fw, firmware_name, rc = request_firmware(&bootrom->fw, firmware_name,
&connection->bundle->dev); &connection->bundle->dev);
if (rc) { if (rc) {
dev_err(&connection->bundle->dev, dev_err(&connection->bundle->dev,
"failed to find %s firmware (%d)\n", firmware_name, rc); "failed to find %s firmware (%d)\n", firmware_name, rc);
...@@ -274,7 +275,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op) ...@@ -274,7 +275,7 @@ static int gb_bootrom_get_firmware(struct gb_operation *op)
if (offset >= fw->size || size > fw->size - offset) { if (offset >= fw->size || size > fw->size - offset) {
dev_warn(dev, "bad firmware request (offs = %u, size = %u)\n", dev_warn(dev, "bad firmware request (offs = %u, size = %u)\n",
offset, size); offset, size);
ret = -EINVAL; ret = -EINVAL;
goto unlock; goto unlock;
} }
...@@ -387,15 +388,15 @@ static int gb_bootrom_get_version(struct gb_bootrom *bootrom) ...@@ -387,15 +388,15 @@ static int gb_bootrom_get_version(struct gb_bootrom *bootrom)
sizeof(response)); sizeof(response));
if (ret) { if (ret) {
dev_err(&bundle->dev, dev_err(&bundle->dev,
"failed to get protocol version: %d\n", "failed to get protocol version: %d\n",
ret); ret);
return ret; return ret;
} }
if (response.major > request.major) { if (response.major > request.major) {
dev_err(&bundle->dev, dev_err(&bundle->dev,
"unsupported major protocol version (%u > %u)\n", "unsupported major protocol version (%u > %u)\n",
response.major, request.major); response.major, request.major);
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -403,13 +404,13 @@ static int gb_bootrom_get_version(struct gb_bootrom *bootrom) ...@@ -403,13 +404,13 @@ static int gb_bootrom_get_version(struct gb_bootrom *bootrom)
bootrom->protocol_minor = response.minor; bootrom->protocol_minor = response.minor;
dev_dbg(&bundle->dev, "%s - %u.%u\n", __func__, response.major, dev_dbg(&bundle->dev, "%s - %u.%u\n", __func__, response.major,
response.minor); response.minor);
return 0; return 0;
} }
static int gb_bootrom_probe(struct gb_bundle *bundle, 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 greybus_descriptor_cport *cport_desc;
struct gb_connection *connection; struct gb_connection *connection;
...@@ -428,8 +429,8 @@ static int gb_bootrom_probe(struct gb_bundle *bundle, ...@@ -428,8 +429,8 @@ static int gb_bootrom_probe(struct gb_bundle *bundle,
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(bundle, connection = gb_connection_create(bundle,
le16_to_cpu(cport_desc->id), le16_to_cpu(cport_desc->id),
gb_bootrom_request_handler); gb_bootrom_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
goto err_free_bootrom; goto err_free_bootrom;
...@@ -466,7 +467,7 @@ static int gb_bootrom_probe(struct gb_bundle *bundle, ...@@ -466,7 +467,7 @@ static int gb_bootrom_probe(struct gb_bundle *bundle,
NULL, 0); NULL, 0);
if (ret) { if (ret) {
dev_err(&connection->bundle->dev, 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; goto err_cancel_timeout;
} }
......
...@@ -841,8 +841,8 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams, ...@@ -841,8 +841,8 @@ static int gb_camera_op_configure_streams(void *priv, unsigned int *nstreams,
} }
static int gb_camera_op_capture(void *priv, u32 request_id, static int gb_camera_op_capture(void *priv, u32 request_id,
unsigned int streams, unsigned int num_frames, unsigned int streams, unsigned int num_frames,
size_t settings_size, const void *settings) size_t settings_size, const void *settings)
{ {
struct gb_camera *gcam = priv; struct gb_camera *gcam = priv;
...@@ -869,7 +869,7 @@ static const struct gb_camera_ops gb_cam_ops = { ...@@ -869,7 +869,7 @@ static const struct gb_camera_ops gb_cam_ops = {
*/ */
static ssize_t gb_camera_debugfs_capabilities(struct gb_camera *gcam, 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 = struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_CAPABILITIES]; &gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_CAPABILITIES];
...@@ -905,7 +905,7 @@ static ssize_t gb_camera_debugfs_capabilities(struct gb_camera *gcam, ...@@ -905,7 +905,7 @@ static ssize_t gb_camera_debugfs_capabilities(struct gb_camera *gcam,
} }
static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam, 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 = struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_STREAMS]; &gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_STREAMS];
...@@ -999,7 +999,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam, ...@@ -999,7 +999,7 @@ static ssize_t gb_camera_debugfs_configure_streams(struct gb_camera *gcam,
}; };
static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam, 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 request_id;
unsigned int streams_mask; unsigned int streams_mask;
...@@ -1040,7 +1040,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam, ...@@ -1040,7 +1040,7 @@ static ssize_t gb_camera_debugfs_capture(struct gb_camera *gcam,
} }
static ssize_t gb_camera_debugfs_flush(struct gb_camera *gcam, 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 = struct gb_camera_debugfs_buffer *buffer =
&gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_FLUSH]; &gcam->debugfs.buffers[GB_CAMERA_DEBUGFS_BUFFER_FLUSH];
......
...@@ -26,7 +26,7 @@ static bool gb_connection_cport_in_use(struct gb_interface *intf, u16 cport_id) ...@@ -26,7 +26,7 @@ static bool gb_connection_cport_in_use(struct gb_interface *intf, u16 cport_id)
list_for_each_entry(connection, &hd->connections, hd_links) { list_for_each_entry(connection, &hd->connections, hd_links) {
if (connection->intf == intf && if (connection->intf == intf &&
connection->intf_cport_id == cport_id) connection->intf_cport_id == cport_id)
return true; return true;
} }
...@@ -74,7 +74,7 @@ gb_connection_hd_find(struct gb_host_device *hd, u16 cport_id) ...@@ -74,7 +74,7 @@ gb_connection_hd_find(struct gb_host_device *hd, u16 cport_id)
* received on the bundle. * received on the bundle.
*/ */
void greybus_data_rcvd(struct gb_host_device *hd, u16 cport_id, 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; struct gb_connection *connection;
...@@ -114,7 +114,7 @@ static void gb_connection_init_name(struct gb_connection *connection) ...@@ -114,7 +114,7 @@ static void gb_connection_init_name(struct gb_connection *connection)
} }
snprintf(connection->name, sizeof(connection->name), 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);
} }
/* /*
...@@ -142,10 +142,10 @@ static void gb_connection_init_name(struct gb_connection *connection) ...@@ -142,10 +142,10 @@ static void gb_connection_init_name(struct gb_connection *connection)
*/ */
static struct gb_connection * static struct gb_connection *
_gb_connection_create(struct gb_host_device *hd, int hd_cport_id, _gb_connection_create(struct gb_host_device *hd, int hd_cport_id,
struct gb_interface *intf, struct gb_interface *intf,
struct gb_bundle *bundle, int cport_id, struct gb_bundle *bundle, int cport_id,
gb_request_handler_t handler, gb_request_handler_t handler,
unsigned long flags) unsigned long flags)
{ {
struct gb_connection *connection; struct gb_connection *connection;
int ret; int ret;
...@@ -226,35 +226,35 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id, ...@@ -226,35 +226,35 @@ _gb_connection_create(struct gb_host_device *hd, int hd_cport_id,
struct gb_connection * struct gb_connection *
gb_connection_create_static(struct gb_host_device *hd, u16 hd_cport_id, 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, 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 * struct gb_connection *
gb_connection_create_control(struct gb_interface *intf) gb_connection_create_control(struct gb_interface *intf)
{ {
return _gb_connection_create(intf->hd, -1, intf, NULL, 0, NULL, return _gb_connection_create(intf->hd, -1, intf, NULL, 0, NULL,
GB_CONNECTION_FLAG_CONTROL | GB_CONNECTION_FLAG_CONTROL |
GB_CONNECTION_FLAG_HIGH_PRIO); GB_CONNECTION_FLAG_HIGH_PRIO);
} }
struct gb_connection * struct gb_connection *
gb_connection_create(struct gb_bundle *bundle, u16 cport_id, 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; struct gb_interface *intf = bundle->intf;
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id, return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
handler, 0); handler, 0);
} }
EXPORT_SYMBOL_GPL(gb_connection_create); EXPORT_SYMBOL_GPL(gb_connection_create);
struct gb_connection * struct gb_connection *
gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id, gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id,
gb_request_handler_t handler, gb_request_handler_t handler,
unsigned long flags) unsigned long flags)
{ {
struct gb_interface *intf = bundle->intf; struct gb_interface *intf = bundle->intf;
...@@ -262,13 +262,13 @@ gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id, ...@@ -262,13 +262,13 @@ gb_connection_create_flags(struct gb_bundle *bundle, u16 cport_id,
flags &= ~GB_CONNECTION_FLAG_CORE_MASK; flags &= ~GB_CONNECTION_FLAG_CORE_MASK;
return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id, return _gb_connection_create(intf->hd, -1, intf, bundle, cport_id,
handler, flags); handler, flags);
} }
EXPORT_SYMBOL_GPL(gb_connection_create_flags); EXPORT_SYMBOL_GPL(gb_connection_create_flags);
struct gb_connection * struct gb_connection *
gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id, gb_connection_create_offloaded(struct gb_bundle *bundle, u16 cport_id,
unsigned long flags) unsigned long flags)
{ {
flags |= GB_CONNECTION_FLAG_OFFLOADED; flags |= GB_CONNECTION_FLAG_OFFLOADED;
...@@ -285,10 +285,10 @@ static int gb_connection_hd_cport_enable(struct gb_connection *connection) ...@@ -285,10 +285,10 @@ static int gb_connection_hd_cport_enable(struct gb_connection *connection)
return 0; return 0;
ret = hd->driver->cport_enable(hd, connection->hd_cport_id, ret = hd->driver->cport_enable(hd, connection->hd_cport_id,
connection->flags); connection->flags);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to enable host cport: %d\n", dev_err(&hd->dev, "%s: failed to enable host cport: %d\n",
connection->name, ret); connection->name, ret);
return ret; return ret;
} }
...@@ -306,7 +306,7 @@ static void gb_connection_hd_cport_disable(struct gb_connection *connection) ...@@ -306,7 +306,7 @@ static void gb_connection_hd_cport_disable(struct gb_connection *connection)
ret = hd->driver->cport_disable(hd, connection->hd_cport_id); ret = hd->driver->cport_disable(hd, connection->hd_cport_id);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to disable host cport: %d\n", dev_err(&hd->dev, "%s: failed to disable host cport: %d\n",
connection->name, ret); connection->name, ret);
} }
} }
...@@ -321,7 +321,7 @@ static int gb_connection_hd_cport_connected(struct gb_connection *connection) ...@@ -321,7 +321,7 @@ static int gb_connection_hd_cport_connected(struct gb_connection *connection)
ret = hd->driver->cport_connected(hd, connection->hd_cport_id); ret = hd->driver->cport_connected(hd, connection->hd_cport_id);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to set connected state: %d\n", dev_err(&hd->dev, "%s: failed to set connected state: %d\n",
connection->name, ret); connection->name, ret);
return ret; return ret;
} }
...@@ -339,7 +339,7 @@ static int gb_connection_hd_cport_flush(struct gb_connection *connection) ...@@ -339,7 +339,7 @@ static int gb_connection_hd_cport_flush(struct gb_connection *connection)
ret = hd->driver->cport_flush(hd, connection->hd_cport_id); ret = hd->driver->cport_flush(hd, connection->hd_cport_id);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to flush host cport: %d\n", dev_err(&hd->dev, "%s: failed to flush host cport: %d\n",
connection->name, ret); connection->name, ret);
return ret; return ret;
} }
...@@ -369,7 +369,7 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection) ...@@ -369,7 +369,7 @@ static int gb_connection_hd_cport_quiesce(struct gb_connection *connection)
GB_CONNECTION_CPORT_QUIESCE_TIMEOUT); GB_CONNECTION_CPORT_QUIESCE_TIMEOUT);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to quiesce host cport: %d\n", dev_err(&hd->dev, "%s: failed to quiesce host cport: %d\n",
connection->name, ret); connection->name, ret);
return ret; return ret;
} }
...@@ -387,7 +387,7 @@ static int gb_connection_hd_cport_clear(struct gb_connection *connection) ...@@ -387,7 +387,7 @@ static int gb_connection_hd_cport_clear(struct gb_connection *connection)
ret = hd->driver->cport_clear(hd, connection->hd_cport_id); ret = hd->driver->cport_clear(hd, connection->hd_cport_id);
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to clear host cport: %d\n", dev_err(&hd->dev, "%s: failed to clear host cport: %d\n",
connection->name, ret); connection->name, ret);
return ret; return ret;
} }
...@@ -423,11 +423,11 @@ gb_connection_svc_connection_create(struct gb_connection *connection) ...@@ -423,11 +423,11 @@ gb_connection_svc_connection_create(struct gb_connection *connection)
} }
ret = gb_svc_connection_create(hd->svc, ret = gb_svc_connection_create(hd->svc,
hd->svc->ap_intf_id, hd->svc->ap_intf_id,
connection->hd_cport_id, connection->hd_cport_id,
intf->interface_id, intf->interface_id,
connection->intf_cport_id, connection->intf_cport_id,
cport_flags); cport_flags);
if (ret) { if (ret) {
dev_err(&connection->hd->dev, dev_err(&connection->hd->dev,
"%s: failed to create svc connection: %d\n", "%s: failed to create svc connection: %d\n",
...@@ -491,8 +491,8 @@ gb_connection_control_disconnecting(struct gb_connection *connection) ...@@ -491,8 +491,8 @@ gb_connection_control_disconnecting(struct gb_connection *connection)
ret = gb_control_disconnecting_operation(control, cport_id); ret = gb_control_disconnecting_operation(control, cport_id);
if (ret) { if (ret) {
dev_err(&connection->hd->dev, dev_err(&connection->hd->dev,
"%s: failed to send disconnecting: %d\n", "%s: failed to send disconnecting: %d\n",
connection->name, ret); connection->name, ret);
} }
} }
...@@ -531,16 +531,16 @@ gb_connection_control_disconnected(struct gb_connection *connection) ...@@ -531,16 +531,16 @@ gb_connection_control_disconnected(struct gb_connection *connection)
} }
static int gb_connection_shutdown_operation(struct gb_connection *connection, static int gb_connection_shutdown_operation(struct gb_connection *connection,
u8 phase) u8 phase)
{ {
struct gb_cport_shutdown_request *req; struct gb_cport_shutdown_request *req;
struct gb_operation *operation; struct gb_operation *operation;
int ret; int ret;
operation = gb_operation_create_core(connection, operation = gb_operation_create_core(connection,
GB_REQUEST_TYPE_CPORT_SHUTDOWN, GB_REQUEST_TYPE_CPORT_SHUTDOWN,
sizeof(*req), 0, 0, sizeof(*req), 0, 0,
GFP_KERNEL); GFP_KERNEL);
if (!operation) if (!operation)
return -ENOMEM; return -ENOMEM;
...@@ -569,14 +569,14 @@ static int gb_connection_cport_shutdown(struct gb_connection *connection, ...@@ -569,14 +569,14 @@ static int gb_connection_cport_shutdown(struct gb_connection *connection,
return 0; return 0;
ret = drv->cport_shutdown(hd, connection->hd_cport_id, phase, ret = drv->cport_shutdown(hd, connection->hd_cport_id, phase,
GB_OPERATION_TIMEOUT_DEFAULT); GB_OPERATION_TIMEOUT_DEFAULT);
} else { } else {
ret = gb_connection_shutdown_operation(connection, phase); ret = gb_connection_shutdown_operation(connection, phase);
} }
if (ret) { if (ret) {
dev_err(&hd->dev, "%s: failed to send cport shutdown (phase %d): %d\n", dev_err(&hd->dev, "%s: failed to send cport shutdown (phase %d): %d\n",
connection->name, phase, ret); connection->name, phase, ret);
return ret; return ret;
} }
...@@ -602,14 +602,14 @@ gb_connection_cport_shutdown_phase_2(struct gb_connection *connection) ...@@ -602,14 +602,14 @@ gb_connection_cport_shutdown_phase_2(struct gb_connection *connection)
* DISCONNECTING. * DISCONNECTING.
*/ */
static void gb_connection_cancel_operations(struct gb_connection *connection, static void gb_connection_cancel_operations(struct gb_connection *connection,
int errno) int errno)
__must_hold(&connection->lock) __must_hold(&connection->lock)
{ {
struct gb_operation *operation; struct gb_operation *operation;
while (!list_empty(&connection->operations)) { while (!list_empty(&connection->operations)) {
operation = list_last_entry(&connection->operations, operation = list_last_entry(&connection->operations,
struct gb_operation, links); struct gb_operation, links);
gb_operation_get(operation); gb_operation_get(operation);
spin_unlock_irq(&connection->lock); spin_unlock_irq(&connection->lock);
...@@ -631,7 +631,7 @@ static void gb_connection_cancel_operations(struct gb_connection *connection, ...@@ -631,7 +631,7 @@ static void gb_connection_cancel_operations(struct gb_connection *connection,
*/ */
static void static void
gb_connection_flush_incoming_operations(struct gb_connection *connection, gb_connection_flush_incoming_operations(struct gb_connection *connection,
int errno) int errno)
__must_hold(&connection->lock) __must_hold(&connection->lock)
{ {
struct gb_operation *operation; struct gb_operation *operation;
...@@ -640,7 +640,7 @@ gb_connection_flush_incoming_operations(struct gb_connection *connection, ...@@ -640,7 +640,7 @@ gb_connection_flush_incoming_operations(struct gb_connection *connection,
while (!list_empty(&connection->operations)) { while (!list_empty(&connection->operations)) {
incoming = false; incoming = false;
list_for_each_entry(operation, &connection->operations, list_for_each_entry(operation, &connection->operations,
links) { links) {
if (gb_operation_is_incoming(operation)) { if (gb_operation_is_incoming(operation)) {
gb_operation_get(operation); gb_operation_get(operation);
incoming = true; incoming = true;
......
...@@ -32,15 +32,15 @@ static int gb_control_get_version(struct gb_control *control) ...@@ -32,15 +32,15 @@ static int gb_control_get_version(struct gb_control *control)
sizeof(response)); sizeof(response));
if (ret) { if (ret) {
dev_err(&intf->dev, dev_err(&intf->dev,
"failed to get control-protocol version: %d\n", "failed to get control-protocol version: %d\n",
ret); ret);
return ret; return ret;
} }
if (response.major > request.major) { if (response.major > request.major) {
dev_err(&intf->dev, dev_err(&intf->dev,
"unsupported major control-protocol version (%u > %u)\n", "unsupported major control-protocol version (%u > %u)\n",
response.major, request.major); response.major, request.major);
return -ENOTSUPP; return -ENOTSUPP;
} }
...@@ -48,13 +48,13 @@ static int gb_control_get_version(struct gb_control *control) ...@@ -48,13 +48,13 @@ static int gb_control_get_version(struct gb_control *control)
control->protocol_minor = response.minor; control->protocol_minor = response.minor;
dev_dbg(&intf->dev, "%s - %u.%u\n", __func__, response.major, dev_dbg(&intf->dev, "%s - %u.%u\n", __func__, response.major,
response.minor); response.minor);
return 0; return 0;
} }
static int gb_control_get_bundle_version(struct gb_control *control, 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_interface *intf = control->connection->intf;
struct gb_control_bundle_version_request request; struct gb_control_bundle_version_request request;
...@@ -69,8 +69,8 @@ static int gb_control_get_bundle_version(struct gb_control *control, ...@@ -69,8 +69,8 @@ static int gb_control_get_bundle_version(struct gb_control *control,
&response, sizeof(response)); &response, sizeof(response));
if (ret) { if (ret) {
dev_err(&intf->dev, dev_err(&intf->dev,
"failed to get bundle %u class version: %d\n", "failed to get bundle %u class version: %d\n",
bundle->id, ret); bundle->id, ret);
return ret; return ret;
} }
...@@ -78,7 +78,7 @@ static int gb_control_get_bundle_version(struct gb_control *control, ...@@ -78,7 +78,7 @@ static int gb_control_get_bundle_version(struct gb_control *control,
bundle->class_minor = response.minor; bundle->class_minor = response.minor;
dev_dbg(&intf->dev, "%s - %u: %u.%u\n", __func__, bundle->id, dev_dbg(&intf->dev, "%s - %u: %u.%u\n", __func__, bundle->id,
response.major, response.minor); response.major, response.minor);
return 0; return 0;
} }
...@@ -112,7 +112,7 @@ int gb_control_get_manifest_size_operation(struct gb_interface *intf) ...@@ -112,7 +112,7 @@ int gb_control_get_manifest_size_operation(struct gb_interface *intf)
NULL, 0, &response, sizeof(response)); NULL, 0, &response, sizeof(response));
if (ret) { if (ret) {
dev_err(&connection->intf->dev, dev_err(&connection->intf->dev,
"failed to get manifest size: %d\n", ret); "failed to get manifest size: %d\n", ret);
return ret; return ret;
} }
...@@ -149,16 +149,16 @@ int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id) ...@@ -149,16 +149,16 @@ int gb_control_disconnected_operation(struct gb_control *control, u16 cport_id)
} }
int gb_control_disconnecting_operation(struct gb_control *control, int gb_control_disconnecting_operation(struct gb_control *control,
u16 cport_id) u16 cport_id)
{ {
struct gb_control_disconnecting_request *request; struct gb_control_disconnecting_request *request;
struct gb_operation *operation; struct gb_operation *operation;
int ret; int ret;
operation = gb_operation_create_core(control->connection, operation = gb_operation_create_core(control->connection,
GB_CONTROL_TYPE_DISCONNECTING, GB_CONTROL_TYPE_DISCONNECTING,
sizeof(*request), 0, 0, sizeof(*request), 0, 0,
GFP_KERNEL); GFP_KERNEL);
if (!operation) if (!operation)
return -ENOMEM; return -ENOMEM;
...@@ -168,7 +168,7 @@ int gb_control_disconnecting_operation(struct gb_control *control, ...@@ -168,7 +168,7 @@ int gb_control_disconnecting_operation(struct gb_control *control,
ret = gb_operation_request_send_sync(operation); ret = gb_operation_request_send_sync(operation);
if (ret) { if (ret) {
dev_err(&control->dev, "failed to send disconnecting: %d\n", dev_err(&control->dev, "failed to send disconnecting: %d\n",
ret); ret);
} }
gb_operation_put(operation); gb_operation_put(operation);
...@@ -182,9 +182,10 @@ int gb_control_mode_switch_operation(struct gb_control *control) ...@@ -182,9 +182,10 @@ int gb_control_mode_switch_operation(struct gb_control *control)
int ret; int ret;
operation = gb_operation_create_core(control->connection, operation = gb_operation_create_core(control->connection,
GB_CONTROL_TYPE_MODE_SWITCH, GB_CONTROL_TYPE_MODE_SWITCH,
0, 0, GB_OPERATION_FLAG_UNIDIRECTIONAL, 0, 0,
GFP_KERNEL); GB_OPERATION_FLAG_UNIDIRECTIONAL,
GFP_KERNEL);
if (!operation) if (!operation)
return -ENOMEM; return -ENOMEM;
...@@ -400,7 +401,7 @@ int gb_control_interface_hibernate_abort(struct gb_control *control) ...@@ -400,7 +401,7 @@ int gb_control_interface_hibernate_abort(struct gb_control *control)
} }
static ssize_t vendor_string_show(struct device *dev, 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); struct gb_control *control = to_gb_control(dev);
...@@ -409,7 +410,7 @@ static ssize_t vendor_string_show(struct device *dev, ...@@ -409,7 +410,7 @@ static ssize_t vendor_string_show(struct device *dev,
static DEVICE_ATTR_RO(vendor_string); static DEVICE_ATTR_RO(vendor_string);
static ssize_t product_string_show(struct device *dev, 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); struct gb_control *control = to_gb_control(dev);
...@@ -455,8 +456,8 @@ struct gb_control *gb_control_create(struct gb_interface *intf) ...@@ -455,8 +456,8 @@ struct gb_control *gb_control_create(struct gb_interface *intf)
connection = gb_connection_create_control(intf); connection = gb_connection_create_control(intf);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
dev_err(&intf->dev, dev_err(&intf->dev,
"failed to create control connection: %ld\n", "failed to create control connection: %ld\n",
PTR_ERR(connection)); PTR_ERR(connection));
kfree(control); kfree(control);
return ERR_CAST(connection); return ERR_CAST(connection);
} }
...@@ -485,8 +486,8 @@ int gb_control_enable(struct gb_control *control) ...@@ -485,8 +486,8 @@ int gb_control_enable(struct gb_control *control)
ret = gb_connection_enable_tx(control->connection); ret = gb_connection_enable_tx(control->connection);
if (ret) { if (ret) {
dev_err(&control->connection->intf->dev, dev_err(&control->connection->intf->dev,
"failed to enable control connection: %d\n", "failed to enable control connection: %d\n",
ret); ret);
return ret; return ret;
} }
...@@ -547,8 +548,8 @@ int gb_control_add(struct gb_control *control) ...@@ -547,8 +548,8 @@ int gb_control_add(struct gb_control *control)
ret = device_add(&control->dev); ret = device_add(&control->dev);
if (ret) { if (ret) {
dev_err(&control->dev, dev_err(&control->dev,
"failed to register control device: %d\n", "failed to register control device: %d\n",
ret); ret);
return ret; return ret;
} }
......
...@@ -216,7 +216,7 @@ static int output_async(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd) ...@@ -216,7 +216,7 @@ static int output_async(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd)
} }
static int output(struct gb_host_device *hd, void *req, u16 size, u8 cmd, 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); struct es2_ap_dev *es2 = hd_to_es2(hd);
...@@ -227,7 +227,7 @@ static int output(struct gb_host_device *hd, void *req, u16 size, u8 cmd, ...@@ -227,7 +227,7 @@ static int output(struct gb_host_device *hd, void *req, u16 size, u8 cmd,
} }
static int es2_cport_in_enable(struct es2_ap_dev *es2, 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; struct urb *urb;
int ret; int ret;
...@@ -239,7 +239,7 @@ static int es2_cport_in_enable(struct es2_ap_dev *es2, ...@@ -239,7 +239,7 @@ static int es2_cport_in_enable(struct es2_ap_dev *es2,
ret = usb_submit_urb(urb, GFP_KERNEL); ret = usb_submit_urb(urb, GFP_KERNEL);
if (ret) { if (ret) {
dev_err(&es2->usb_dev->dev, 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; goto err_kill_urbs;
} }
} }
...@@ -256,7 +256,7 @@ static int es2_cport_in_enable(struct es2_ap_dev *es2, ...@@ -256,7 +256,7 @@ static int es2_cport_in_enable(struct es2_ap_dev *es2,
} }
static void es2_cport_in_disable(struct es2_ap_dev *es2, 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; struct urb *urb;
int i; int i;
...@@ -487,7 +487,7 @@ static void message_cancel(struct gb_message *message) ...@@ -487,7 +487,7 @@ static void message_cancel(struct gb_message *message)
} }
static int es2_cport_allocate(struct gb_host_device *hd, int cport_id, 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 es2_ap_dev *es2 = hd_to_es2(hd);
struct ida *id_map = &hd->cport_id_map; struct ida *id_map = &hd->cport_id_map;
...@@ -501,7 +501,7 @@ static int es2_cport_allocate(struct gb_host_device *hd, int cport_id, ...@@ -501,7 +501,7 @@ static int es2_cport_allocate(struct gb_host_device *hd, int cport_id,
} }
if (flags & GB_CONNECTION_FLAG_OFFLOADED && if (flags & GB_CONNECTION_FLAG_OFFLOADED &&
flags & GB_CONNECTION_FLAG_CDSI1) { flags & GB_CONNECTION_FLAG_CDSI1) {
if (es2->cdsi1_in_use) { if (es2->cdsi1_in_use) {
dev_err(&hd->dev, "CDSI1 already in use\n"); dev_err(&hd->dev, "CDSI1 already in use\n");
return -EBUSY; return -EBUSY;
...@@ -561,16 +561,16 @@ static int cport_enable(struct gb_host_device *hd, u16 cport_id, ...@@ -561,16 +561,16 @@ static int cport_enable(struct gb_host_device *hd, u16 cport_id,
req->flags = cpu_to_le32(connection_flags); req->flags = cpu_to_le32(connection_flags);
dev_dbg(&hd->dev, "%s - cport = %u, flags = %02x\n", __func__, 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), ret = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
GB_APB_REQUEST_CPORT_FLAGS, GB_APB_REQUEST_CPORT_FLAGS,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_DIR_OUT | USB_TYPE_VENDOR |
USB_RECIP_INTERFACE, cport_id, 0, USB_RECIP_INTERFACE, cport_id, 0,
req, sizeof(*req), ES2_USB_CTRL_TIMEOUT); req, sizeof(*req), ES2_USB_CTRL_TIMEOUT);
if (ret != sizeof(*req)) { if (ret != sizeof(*req)) {
dev_err(&udev->dev, "failed to set cport flags for port %d\n", dev_err(&udev->dev, "failed to set cport flags for port %d\n",
cport_id); cport_id);
if (ret >= 0) if (ret >= 0)
ret = -EIO; ret = -EIO;
...@@ -596,7 +596,7 @@ static int es2_cport_connected(struct gb_host_device *hd, u16 cport_id) ...@@ -596,7 +596,7 @@ static int es2_cport_connected(struct gb_host_device *hd, u16 cport_id)
NULL, ES2_ARPC_CPORT_TIMEOUT); NULL, ES2_ARPC_CPORT_TIMEOUT);
if (ret) { if (ret) {
dev_err(dev, "failed to set connected state for cport %u: %d\n", dev_err(dev, "failed to set connected state for cport %u: %d\n",
cport_id, ret); cport_id, ret);
return ret; return ret;
} }
...@@ -622,7 +622,7 @@ static int es2_cport_flush(struct gb_host_device *hd, u16 cport_id) ...@@ -622,7 +622,7 @@ static int es2_cport_flush(struct gb_host_device *hd, u16 cport_id)
} }
static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id, 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 es2_ap_dev *es2 = hd_to_es2(hd);
struct device *dev = &es2->usb_dev->dev; struct device *dev = &es2->usb_dev->dev;
...@@ -640,7 +640,7 @@ static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id, ...@@ -640,7 +640,7 @@ static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id,
&result, ES2_ARPC_CPORT_TIMEOUT + timeout); &result, ES2_ARPC_CPORT_TIMEOUT + timeout);
if (ret) { if (ret) {
dev_err(dev, "failed to send shutdown over cport %u: %d (%d)\n", dev_err(dev, "failed to send shutdown over cport %u: %d (%d)\n",
cport_id, ret, result); cport_id, ret, result);
return ret; return ret;
} }
...@@ -648,7 +648,7 @@ static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id, ...@@ -648,7 +648,7 @@ static int es2_cport_shutdown(struct gb_host_device *hd, u16 cport_id,
} }
static int es2_cport_quiesce(struct gb_host_device *hd, u16 cport_id, 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 es2_ap_dev *es2 = hd_to_es2(hd);
struct device *dev = &es2->usb_dev->dev; struct device *dev = &es2->usb_dev->dev;
...@@ -669,7 +669,7 @@ static int es2_cport_quiesce(struct gb_host_device *hd, u16 cport_id, ...@@ -669,7 +669,7 @@ static int es2_cport_quiesce(struct gb_host_device *hd, u16 cport_id,
&result, ES2_ARPC_CPORT_TIMEOUT + timeout); &result, ES2_ARPC_CPORT_TIMEOUT + timeout);
if (ret) { if (ret) {
dev_err(dev, "failed to quiesce cport %u: %d (%d)\n", dev_err(dev, "failed to quiesce cport %u: %d (%d)\n",
cport_id, ret, result); cport_id, ret, result);
return ret; return ret;
} }
...@@ -846,7 +846,7 @@ static void cport_in_callback(struct urb *urb) ...@@ -846,7 +846,7 @@ static void cport_in_callback(struct urb *urb)
if (cport_id_valid(hd, cport_id)) { if (cport_id_valid(hd, cport_id)) {
greybus_data_rcvd(hd, cport_id, urb->transfer_buffer, greybus_data_rcvd(hd, cport_id, urb->transfer_buffer,
urb->actual_length); urb->actual_length);
} else { } else {
dev_err(dev, "invalid cport id %u received\n", cport_id); dev_err(dev, "invalid cport id %u received\n", cport_id);
} }
...@@ -1083,14 +1083,14 @@ static void apb_log_get(struct es2_ap_dev *es2, char *buf) ...@@ -1083,14 +1083,14 @@ static void apb_log_get(struct es2_ap_dev *es2, char *buf)
do { do {
retval = usb_control_msg(es2->usb_dev, retval = usb_control_msg(es2->usb_dev,
usb_rcvctrlpipe(es2->usb_dev, 0), usb_rcvctrlpipe(es2->usb_dev, 0),
GB_APB_REQUEST_LOG, GB_APB_REQUEST_LOG,
USB_DIR_IN | USB_TYPE_VENDOR | USB_DIR_IN | USB_TYPE_VENDOR |
USB_RECIP_INTERFACE, USB_RECIP_INTERFACE,
0x00, 0x00, 0x00, 0x00,
buf, buf,
APB1_LOG_MSG_SIZE, APB1_LOG_MSG_SIZE,
ES2_USB_CTRL_TIMEOUT); ES2_USB_CTRL_TIMEOUT);
if (retval > 0) if (retval > 0)
kfifo_in(&es2->apb_log_fifo, buf, retval); kfifo_in(&es2->apb_log_fifo, buf, retval);
} while (retval > 0); } while (retval > 0);
...@@ -1116,7 +1116,7 @@ static int apb_log_poll(void *data) ...@@ -1116,7 +1116,7 @@ static int apb_log_poll(void *data)
} }
static ssize_t apb_log_read(struct file *f, char __user *buf, 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; struct es2_ap_dev *es2 = file_inode(f)->i_private;
ssize_t ret; ssize_t ret;
...@@ -1153,8 +1153,8 @@ static void usb_log_enable(struct es2_ap_dev *es2) ...@@ -1153,8 +1153,8 @@ static void usb_log_enable(struct es2_ap_dev *es2)
return; return;
/* XXX We will need to rename this per APB */ /* XXX We will need to rename this per APB */
es2->apb_log_dentry = debugfs_create_file("apb_log", 0444, es2->apb_log_dentry = debugfs_create_file("apb_log", 0444,
gb_debugfs_get(), es2, gb_debugfs_get(), es2,
&apb_log_fops); &apb_log_fops);
} }
static void usb_log_disable(struct es2_ap_dev *es2) static void usb_log_disable(struct es2_ap_dev *es2)
...@@ -1170,7 +1170,7 @@ static void usb_log_disable(struct es2_ap_dev *es2) ...@@ -1170,7 +1170,7 @@ static void usb_log_disable(struct es2_ap_dev *es2)
} }
static ssize_t apb_log_enable_read(struct file *f, char __user *buf, 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; struct es2_ap_dev *es2 = file_inode(f)->i_private;
int enable = !IS_ERR_OR_NULL(es2->apb_log_task); int enable = !IS_ERR_OR_NULL(es2->apb_log_task);
...@@ -1181,7 +1181,7 @@ static ssize_t apb_log_enable_read(struct file *f, char __user *buf, ...@@ -1181,7 +1181,7 @@ static ssize_t apb_log_enable_read(struct file *f, char __user *buf,
} }
static ssize_t apb_log_enable_write(struct file *f, const char __user *buf, 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; int enable;
ssize_t retval; ssize_t retval;
...@@ -1274,7 +1274,7 @@ static int ap_probe(struct usb_interface *interface, ...@@ -1274,7 +1274,7 @@ static int ap_probe(struct usb_interface *interface,
} }
hd = gb_hd_create(&es2_driver, &udev->dev, ES2_GBUF_MSG_SIZE_MAX, hd = gb_hd_create(&es2_driver, &udev->dev, ES2_GBUF_MSG_SIZE_MAX,
num_cports); num_cports);
if (IS_ERR(hd)) { if (IS_ERR(hd)) {
usb_put_dev(udev); usb_put_dev(udev);
return PTR_ERR(hd); return PTR_ERR(hd);
...@@ -1409,9 +1409,9 @@ static int ap_probe(struct usb_interface *interface, ...@@ -1409,9 +1409,9 @@ static int ap_probe(struct usb_interface *interface,
/* XXX We will need to rename this per APB */ /* XXX We will need to rename this per APB */
es2->apb_log_enable_dentry = debugfs_create_file("apb_log_enable", es2->apb_log_enable_dentry = debugfs_create_file("apb_log_enable",
0644, 0644,
gb_debugfs_get(), es2, gb_debugfs_get(), es2,
&apb_log_enable_fops); &apb_log_enable_fops);
INIT_LIST_HEAD(&es2->arpcs); INIT_LIST_HEAD(&es2->arpcs);
spin_lock_init(&es2->arpc_lock); spin_lock_init(&es2->arpc_lock);
......
...@@ -74,7 +74,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which) ...@@ -74,7 +74,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which)
request.which = which; request.which = which;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_ACTIVATE, ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_ACTIVATE,
&request, sizeof(request), NULL, 0); &request, sizeof(request), NULL, 0);
if (ret) { if (ret) {
gbphy_runtime_put_autosuspend(gbphy_dev); gbphy_runtime_put_autosuspend(gbphy_dev);
return ret; return ret;
...@@ -86,7 +86,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which) ...@@ -86,7 +86,7 @@ static int gb_gpio_activate_operation(struct gb_gpio_controller *ggc, u8 which)
} }
static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc, static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct gbphy_device *gbphy_dev = ggc->gbphy_dev; struct gbphy_device *gbphy_dev = ggc->gbphy_dev;
struct device *dev = &gbphy_dev->dev; struct device *dev = &gbphy_dev->dev;
...@@ -95,7 +95,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc, ...@@ -95,7 +95,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
request.which = which; request.which = which;
ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_DEACTIVATE, ret = gb_operation_sync(ggc->connection, GB_GPIO_TYPE_DEACTIVATE,
&request, sizeof(request), NULL, 0); &request, sizeof(request), NULL, 0);
if (ret) { if (ret) {
dev_err(dev, "failed to deactivate gpio %u\n", which); dev_err(dev, "failed to deactivate gpio %u\n", which);
goto out_pm_put; goto out_pm_put;
...@@ -108,7 +108,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc, ...@@ -108,7 +108,7 @@ static void gb_gpio_deactivate_operation(struct gb_gpio_controller *ggc,
} }
static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc, static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct device *dev = &ggc->gbphy_dev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_direction_request request; struct gb_gpio_get_direction_request request;
...@@ -133,7 +133,7 @@ static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc, ...@@ -133,7 +133,7 @@ static int gb_gpio_get_direction_operation(struct gb_gpio_controller *ggc,
} }
static int gb_gpio_direction_in_operation(struct gb_gpio_controller *ggc, static int gb_gpio_direction_in_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct gb_gpio_direction_in_request request; struct gb_gpio_direction_in_request request;
int ret; int ret;
...@@ -147,7 +147,7 @@ static int gb_gpio_direction_in_operation(struct gb_gpio_controller *ggc, ...@@ -147,7 +147,7 @@ static int gb_gpio_direction_in_operation(struct gb_gpio_controller *ggc,
} }
static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc, 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; struct gb_gpio_direction_out_request request;
int ret; int ret;
...@@ -162,7 +162,7 @@ static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc, ...@@ -162,7 +162,7 @@ static int gb_gpio_direction_out_operation(struct gb_gpio_controller *ggc,
} }
static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc, static int gb_gpio_get_value_operation(struct gb_gpio_controller *ggc,
u8 which) u8 which)
{ {
struct device *dev = &ggc->gbphy_dev->dev; struct device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_get_value_request request; struct gb_gpio_get_value_request request;
...@@ -214,7 +214,7 @@ static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc, ...@@ -214,7 +214,7 @@ static void gb_gpio_set_value_operation(struct gb_gpio_controller *ggc,
} }
static int gb_gpio_set_debounce_operation(struct gb_gpio_controller *ggc, 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; struct gb_gpio_set_debounce_request request;
int ret; int ret;
...@@ -257,7 +257,7 @@ static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq) ...@@ -257,7 +257,7 @@ static void _gb_gpio_irq_unmask(struct gb_gpio_controller *ggc, u8 hwirq)
} }
static void _gb_gpio_irq_set_type(struct gb_gpio_controller *ggc, 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 device *dev = &ggc->gbphy_dev->dev;
struct gb_gpio_irq_type_request request; struct gb_gpio_irq_type_request request;
...@@ -589,10 +589,10 @@ static void gb_gpio_irqchip_remove(struct gb_gpio_controller *ggc) ...@@ -589,10 +589,10 @@ static void gb_gpio_irqchip_remove(struct gb_gpio_controller *ggc)
* before calling this function. * before calling this function.
*/ */
static int gb_gpio_irqchip_add(struct gpio_chip *chip, static int gb_gpio_irqchip_add(struct gpio_chip *chip,
struct irq_chip *irqchip, struct irq_chip *irqchip,
unsigned int first_irq, unsigned int first_irq,
irq_flow_handler_t handler, irq_flow_handler_t handler,
unsigned int type) unsigned int type)
{ {
struct gb_gpio_controller *ggc; struct gb_gpio_controller *ggc;
unsigned int offset; unsigned int offset;
...@@ -607,8 +607,8 @@ static int gb_gpio_irqchip_add(struct gpio_chip *chip, ...@@ -607,8 +607,8 @@ static int gb_gpio_irqchip_add(struct gpio_chip *chip,
ggc->irq_handler = handler; ggc->irq_handler = handler;
ggc->irq_default_type = type; ggc->irq_default_type = type;
ggc->irqdomain = irq_domain_add_simple(NULL, ggc->irqdomain = irq_domain_add_simple(NULL,
ggc->line_max + 1, first_irq, ggc->line_max + 1, first_irq,
&gb_gpio_domain_ops, chip); &gb_gpio_domain_ops, chip);
if (!ggc->irqdomain) { if (!ggc->irqdomain) {
ggc->irqchip = NULL; ggc->irqchip = NULL;
return -EINVAL; return -EINVAL;
...@@ -648,9 +648,10 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev, ...@@ -648,9 +648,10 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
if (!ggc) if (!ggc)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gbphy_dev->bundle, connection =
le16_to_cpu(gbphy_dev->cport_desc->id), gb_connection_create(gbphy_dev->bundle,
gb_gpio_request_handler); le16_to_cpu(gbphy_dev->cport_desc->id),
gb_gpio_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
goto exit_ggc_free; goto exit_ggc_free;
...@@ -703,7 +704,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev, ...@@ -703,7 +704,7 @@ static int gb_gpio_probe(struct gbphy_device *gbphy_dev,
goto exit_line_free; goto exit_line_free;
ret = gb_gpio_irqchip_add(gpio, irqc, 0, ret = gb_gpio_irqchip_add(gpio, irqc, 0,
handle_level_irq, IRQ_TYPE_NONE); handle_level_irq, IRQ_TYPE_NONE);
if (ret) { if (ret) {
dev_err(&gbphy_dev->dev, "failed to add irq chip: %d\n", ret); dev_err(&gbphy_dev->dev, "failed to add irq chip: %d\n", ret);
goto exit_line_free; goto exit_line_free;
......
...@@ -49,8 +49,8 @@ static int gb_hid_get_report_desc(struct gb_hid *ghid, char *rdesc) ...@@ -49,8 +49,8 @@ static int gb_hid_get_report_desc(struct gb_hid *ghid, char *rdesc)
return ret; return ret;
ret = gb_operation_sync(ghid->connection, GB_HID_TYPE_GET_REPORT_DESC, ret = gb_operation_sync(ghid->connection, GB_HID_TYPE_GET_REPORT_DESC,
NULL, 0, rdesc, NULL, 0, rdesc,
le16_to_cpu(ghid->hdesc.wReportDescLength)); le16_to_cpu(ghid->hdesc.wReportDescLength));
gb_pm_runtime_put_autosuspend(ghid->bundle); gb_pm_runtime_put_autosuspend(ghid->bundle);
...@@ -86,7 +86,7 @@ static int gb_hid_get_report(struct gb_hid *ghid, u8 report_type, u8 report_id, ...@@ -86,7 +86,7 @@ static int gb_hid_get_report(struct gb_hid *ghid, u8 report_type, u8 report_id,
request.report_id = report_id; request.report_id = report_id;
ret = gb_operation_sync(ghid->connection, GB_HID_TYPE_GET_REPORT, 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); gb_pm_runtime_put_autosuspend(ghid->bundle);
...@@ -211,11 +211,13 @@ static void gb_hid_init_reports(struct gb_hid *ghid) ...@@ -211,11 +211,13 @@ static void gb_hid_init_reports(struct gb_hid *ghid)
struct hid_report *report; struct hid_report *report;
list_for_each_entry(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); gb_hid_init_report(ghid, report);
list_for_each_entry(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); gb_hid_init_report(ghid, report);
} }
...@@ -259,8 +261,8 @@ static int __gb_hid_output_raw_report(struct hid_device *hid, __u8 *buf, ...@@ -259,8 +261,8 @@ static int __gb_hid_output_raw_report(struct hid_device *hid, __u8 *buf,
} }
static int gb_hid_raw_request(struct hid_device *hid, unsigned char reportnum, static int gb_hid_raw_request(struct hid_device *hid, unsigned char reportnum,
__u8 *buf, size_t len, unsigned char rtype, __u8 *buf, size_t len, unsigned char rtype,
int reqtype) int reqtype)
{ {
switch (reqtype) { switch (reqtype) {
case HID_REQ_GET_REPORT: case HID_REQ_GET_REPORT:
...@@ -440,7 +442,7 @@ static int gb_hid_probe(struct gb_bundle *bundle, ...@@ -440,7 +442,7 @@ static int gb_hid_probe(struct gb_bundle *bundle,
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(bundle, le16_to_cpu(cport_desc->id), connection = gb_connection_create(bundle, le16_to_cpu(cport_desc->id),
gb_hid_request_handler); gb_hid_request_handler);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
goto err_free_ghid; goto err_free_ghid;
......
...@@ -107,7 +107,7 @@ gb_i2c_operation_create(struct gb_connection *connection, ...@@ -107,7 +107,7 @@ gb_i2c_operation_create(struct gb_connection *connection,
/* Response consists only of incoming data */ /* Response consists only of incoming data */
operation = gb_operation_create(connection, GB_I2C_TYPE_TRANSFER, 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) if (!operation)
return NULL; return NULL;
...@@ -137,7 +137,7 @@ gb_i2c_operation_create(struct gb_connection *connection, ...@@ -137,7 +137,7 @@ gb_i2c_operation_create(struct gb_connection *connection,
} }
static void gb_i2c_decode_response(struct i2c_msg *msgs, u32 msg_count, 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; struct i2c_msg *msg = msgs;
u8 *data; u8 *data;
...@@ -164,7 +164,7 @@ static bool gb_i2c_expected_transfer_error(int errno) ...@@ -164,7 +164,7 @@ static bool gb_i2c_expected_transfer_error(int errno)
} }
static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, 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 gb_connection *connection = gb_i2c_dev->connection;
struct device *dev = &gb_i2c_dev->gbphy_dev->dev; struct device *dev = &gb_i2c_dev->gbphy_dev->dev;
...@@ -199,7 +199,7 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev, ...@@ -199,7 +199,7 @@ static int gb_i2c_transfer_operation(struct gb_i2c_device *gb_i2c_dev,
} }
static int gb_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, 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; struct gb_i2c_device *gb_i2c_dev;
...@@ -211,8 +211,8 @@ static int gb_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, ...@@ -211,8 +211,8 @@ static int gb_i2c_master_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs,
#if 0 #if 0
/* Later */ /* Later */
static int gb_i2c_smbus_xfer(struct i2c_adapter *adap, static int gb_i2c_smbus_xfer(struct i2c_adapter *adap,
u16 addr, unsigned short flags, char read_write, u16 addr, unsigned short flags, char read_write,
u8 command, int size, union i2c_smbus_data *data) u8 command, int size, union i2c_smbus_data *data)
{ {
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
...@@ -249,7 +249,7 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev) ...@@ -249,7 +249,7 @@ static int gb_i2c_device_setup(struct gb_i2c_device *gb_i2c_dev)
} }
static int gb_i2c_probe(struct gbphy_device *gbphy_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_connection *connection;
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
...@@ -260,9 +260,10 @@ static int gb_i2c_probe(struct gbphy_device *gbphy_dev, ...@@ -260,9 +260,10 @@ static int gb_i2c_probe(struct gbphy_device *gbphy_dev,
if (!gb_i2c_dev) if (!gb_i2c_dev)
return -ENOMEM; return -ENOMEM;
connection = gb_connection_create(gbphy_dev->bundle, connection =
le16_to_cpu(gbphy_dev->cport_desc->id), gb_connection_create(gbphy_dev->bundle,
NULL); le16_to_cpu(gbphy_dev->cport_desc->id),
NULL);
if (IS_ERR(connection)) { if (IS_ERR(connection)) {
ret = PTR_ERR(connection); ret = PTR_ERR(connection);
goto exit_i2cdev_free; goto exit_i2cdev_free;
......
...@@ -9,10 +9,9 @@ ...@@ -9,10 +9,9 @@
#include "greybus.h" #include "greybus.h"
#include "greybus_trace.h" #include "greybus_trace.h"
static ssize_t eject_store(struct device *dev, static ssize_t eject_store(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
const char *buf, size_t len) const char *buf, size_t len)
{ {
struct gb_module *module = to_gb_module(dev); struct gb_module *module = to_gb_module(dev);
struct gb_interface *intf; struct gb_interface *intf;
...@@ -48,7 +47,7 @@ static ssize_t eject_store(struct device *dev, ...@@ -48,7 +47,7 @@ static ssize_t eject_store(struct device *dev,
static DEVICE_ATTR_WO(eject); static DEVICE_ATTR_WO(eject);
static ssize_t module_id_show(struct device *dev, 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); struct gb_module *module = to_gb_module(dev);
...@@ -57,7 +56,7 @@ static ssize_t module_id_show(struct device *dev, ...@@ -57,7 +56,7 @@ static ssize_t module_id_show(struct device *dev,
static DEVICE_ATTR_RO(module_id); static DEVICE_ATTR_RO(module_id);
static ssize_t num_interfaces_show(struct device *dev, 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 *module = to_gb_module(dev);
...@@ -88,7 +87,7 @@ struct device_type greybus_module_type = { ...@@ -88,7 +87,7 @@ struct device_type greybus_module_type = {
}; };
struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id, 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_interface *intf;
struct gb_module *module; struct gb_module *module;
...@@ -117,7 +116,7 @@ struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id, ...@@ -117,7 +116,7 @@ struct gb_module *gb_module_create(struct gb_host_device *hd, u8 module_id,
intf = gb_interface_create(module, module_id + i); intf = gb_interface_create(module, module_id + i);
if (!intf) { if (!intf) {
dev_err(&module->dev, "failed to create interface %u\n", dev_err(&module->dev, "failed to create interface %u\n",
module_id + i); module_id + i);
goto err_put_interfaces; goto err_put_interfaces;
} }
module->interfaces[i] = intf; module->interfaces[i] = intf;
...@@ -149,8 +148,8 @@ static void gb_module_register_interface(struct gb_interface *intf) ...@@ -149,8 +148,8 @@ static void gb_module_register_interface(struct gb_interface *intf)
if (ret) { if (ret) {
if (intf->type != GB_INTERFACE_TYPE_DUMMY) { if (intf->type != GB_INTERFACE_TYPE_DUMMY) {
dev_err(&module->dev, dev_err(&module->dev,
"failed to activate interface %u: %d\n", "failed to activate interface %u: %d\n",
intf_id, ret); intf_id, ret);
} }
gb_interface_add(intf); gb_interface_add(intf);
...@@ -164,7 +163,7 @@ static void gb_module_register_interface(struct gb_interface *intf) ...@@ -164,7 +163,7 @@ static void gb_module_register_interface(struct gb_interface *intf)
ret = gb_interface_enable(intf); ret = gb_interface_enable(intf);
if (ret) { if (ret) {
dev_err(&module->dev, "failed to enable interface %u: %d\n", dev_err(&module->dev, "failed to enable interface %u: %d\n",
intf_id, ret); intf_id, ret);
goto err_interface_deactivate; goto err_interface_deactivate;
} }
......
This diff is collapsed.
This diff is collapsed.
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