Commit 772149b6 authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

greybus: fix hd init sequence of setting up parent and driver pointers properly

parent 13c8d9cd
...@@ -68,7 +68,7 @@ static void svc_handshake(struct svc_function_handshake *handshake, ...@@ -68,7 +68,7 @@ static void svc_handshake(struct svc_function_handshake *handshake,
/* A new SVC communication channel, let's verify it was for us */ /* A new SVC communication channel, let's verify it was for us */
if (handshake->handshake_type != SVC_HANDSHAKE_SVC_HELLO) { if (handshake->handshake_type != SVC_HANDSHAKE_SVC_HELLO) {
/* we don't know what to do with this, log it and return */ /* we don't know what to do with this, log it and return */
dev_dbg(&hd->dev, "received invalid handshake type %d\n", dev_dbg(hd->parent, "received invalid handshake type %d\n",
handshake->handshake_type); handshake->handshake_type);
return; return;
} }
...@@ -86,7 +86,7 @@ static void svc_management(struct svc_function_unipro_management *management, ...@@ -86,7 +86,7 @@ static void svc_management(struct svc_function_unipro_management *management,
struct greybus_host_device *hd) struct greybus_host_device *hd)
{ {
/* What? An AP should not get this message */ /* What? An AP should not get this message */
dev_err(&hd->dev, "Got an svc management message???\n"); dev_err(hd->parent, "Got an svc management message???\n");
} }
static void svc_hotplug(struct svc_function_hotplug *hotplug, static void svc_hotplug(struct svc_function_hotplug *hotplug,
...@@ -96,17 +96,18 @@ static void svc_hotplug(struct svc_function_hotplug *hotplug, ...@@ -96,17 +96,18 @@ static void svc_hotplug(struct svc_function_hotplug *hotplug,
switch (hotplug->hotplug_event) { switch (hotplug->hotplug_event) {
case SVC_HOTPLUG_EVENT: case SVC_HOTPLUG_EVENT:
dev_dbg(&hd->dev, "module id %d added\n", module_id); dev_dbg(hd->parent, "module id %d added\n", module_id);
// FIXME - add the module to the system // FIXME - add the module to the system
break; break;
case SVC_HOTUNPLUG_EVENT: case SVC_HOTUNPLUG_EVENT:
dev_dbg(&hd->dev, "module id %d removed\n", module_id); dev_dbg(hd->parent, "module id %d removed\n", module_id);
// FIXME - remove the module from the system // FIXME - remove the module from the system
break; break;
default: default:
dev_err(&hd->dev, "received invalid hotplug message type %d\n", dev_err(hd->parent,
"received invalid hotplug message type %d\n",
hotplug->hotplug_event); hotplug->hotplug_event);
break; break;
} }
...@@ -116,7 +117,7 @@ static void svc_ddb(struct svc_function_ddb *ddb, ...@@ -116,7 +117,7 @@ static void svc_ddb(struct svc_function_ddb *ddb,
struct greybus_host_device *hd) struct greybus_host_device *hd)
{ {
/* What? An AP should not get this message */ /* What? An AP should not get this message */
dev_err(&hd->dev, "Got an svc DDB message???\n"); dev_err(hd->parent, "Got an svc DDB message???\n");
} }
static void svc_power(struct svc_function_power *power, static void svc_power(struct svc_function_power *power,
...@@ -125,12 +126,12 @@ static void svc_power(struct svc_function_power *power, ...@@ -125,12 +126,12 @@ static void svc_power(struct svc_function_power *power,
u8 module_id = power->module_id; u8 module_id = power->module_id;
if (power->power_type != SVC_POWER_BATTERY_STATUS) { if (power->power_type != SVC_POWER_BATTERY_STATUS) {
dev_err(&hd->dev, "received invalid power type %d\n", dev_err(hd->parent, "received invalid power type %d\n",
power->power_type); power->power_type);
return; return;
} }
dev_dbg(&hd->dev, "power status for module id %d is %d\n", dev_dbg(hd->parent, "power status for module id %d is %d\n",
module_id, power->status.status); module_id, power->status.status);
// FIXME - do something with the power information, like update our // FIXME - do something with the power information, like update our
...@@ -141,14 +142,14 @@ static void svc_epm(struct svc_function_epm *epm, ...@@ -141,14 +142,14 @@ static void svc_epm(struct svc_function_epm *epm,
struct greybus_host_device *hd) struct greybus_host_device *hd)
{ {
/* What? An AP should not get this message */ /* What? An AP should not get this message */
dev_err(&hd->dev, "Got an EPM message???\n"); dev_err(hd->parent, "Got an EPM message???\n");
} }
static void svc_suspend(struct svc_function_suspend *suspend, static void svc_suspend(struct svc_function_suspend *suspend,
struct greybus_host_device *hd) struct greybus_host_device *hd)
{ {
/* What? An AP should not get this message */ /* What? An AP should not get this message */
dev_err(&hd->dev, "Got an suspend message???\n"); dev_err(hd->parent, "Got an suspend message???\n");
} }
static struct svc_msg *convert_ap_message(struct ap_msg *ap_msg) static struct svc_msg *convert_ap_message(struct ap_msg *ap_msg)
...@@ -209,7 +210,7 @@ static void ap_process_event(struct work_struct *work) ...@@ -209,7 +210,7 @@ static void ap_process_event(struct work_struct *work)
svc_suspend(&svc_msg->suspend, hd); svc_suspend(&svc_msg->suspend, hd);
break; break;
default: default:
dev_err(&hd->dev, "received invalid SVC message type %d\n", dev_err(hd->parent, "received invalid SVC message type %d\n",
svc_msg->header.type); svc_msg->header.type);
} }
......
...@@ -499,6 +499,8 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver ...@@ -499,6 +499,8 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
return NULL; return NULL;
kref_init(&hd->kref); kref_init(&hd->kref);
hd->parent = parent;
hd->driver = driver;
return hd; return hd;
} }
......
...@@ -197,7 +197,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data, ...@@ -197,7 +197,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
ch = &cport_handler[cport]; ch = &cport_handler[cport];
if (!ch->handler) { if (!ch->handler) {
/* Ugh, drop the data on the floor, after logging it... */ /* Ugh, drop the data on the floor, after logging it... */
dev_err(&hd->dev, dev_err(hd->parent,
"Received data for cport %d, but no handler!\n", "Received data for cport %d, but no handler!\n",
cport); cport);
return; return;
......
...@@ -105,7 +105,6 @@ struct svc_msg; ...@@ -105,7 +105,6 @@ struct svc_msg;
struct greybus_host_driver { struct greybus_host_driver {
size_t hd_priv_size; size_t hd_priv_size;
int (*start)(struct greybus_host_device *hd);
int (*alloc_gbuf)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask); int (*alloc_gbuf)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask);
void (*free_gbuf)(struct gbuf *gbuf); void (*free_gbuf)(struct gbuf *gbuf);
int (*send_svc_msg)(struct svc_msg *svc_msg, struct greybus_host_device *hd); int (*send_svc_msg)(struct svc_msg *svc_msg, struct greybus_host_device *hd);
...@@ -114,10 +113,9 @@ struct greybus_host_driver { ...@@ -114,10 +113,9 @@ struct greybus_host_driver {
}; };
struct greybus_host_device { struct greybus_host_device {
struct device dev;
struct kref kref; struct kref kref;
struct device *parent;
const struct greybus_host_driver *driver; const struct greybus_host_driver *driver;
unsigned long hd_priv_size;
/* Private data for the host driver */ /* Private data for the host driver */
unsigned long hd_priv[0] __attribute__ ((aligned(sizeof(s64)))); unsigned long hd_priv[0] __attribute__ ((aligned(sizeof(s64))));
......
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