This patch renames of symbols, for better clarity and consistency.
cport -> cport_id (when it represents a cport *number*)
send_svc_msg -> submit_svc (like submit_gbuf)
greybus_cport_in_data -> greybus_cport_in
gb_new_ap_msg -> greybus_svc_in (like greybus_cport_in)
cport->number -> cport->id (like cport_id)
Making the svc and cport message stuff more similar is done with an
eye toward having SVC messages and messages exchanged with other
modules use some more common communication mechanisms.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
// FIXME - Do we need to do more than just pass it to the hd and then
// free it?
- retval = hd->driver->send_svc_msg(svc_msg, hd);
+ retval = hd->driver->submit_svc(svc_msg, hd);
svc_msg_free(svc_msg);
return retval;
kfree(ap_msg);
}
-int gb_new_ap_msg(u8 *data, int size, struct greybus_host_device *hd)
+int greybus_svc_in(u8 *data, int size, struct greybus_host_device *hd)
{
struct ap_msg *ap_msg;
return 0;
}
-EXPORT_SYMBOL_GPL(gb_new_ap_msg);
+EXPORT_SYMBOL_GPL(greybus_svc_in);
int gb_ap_init(void)
{
if (!gmod_cport)
return -ENOMEM;
- gmod_cport->number = le16_to_cpu(cport->number);
+ gmod_cport->id = le16_to_cpu(cport->id);
gmod_cport->size = le16_to_cpu(cport->size);
gmod_cport->speed = cport->speed;
* we will encode the cport number in the first byte of the buffer, so
* set the second byte to be the "transfer buffer"
*/
- buffer[0] = gbuf->cport->number;
+ buffer[0] = gbuf->cport->id;
gbuf->transfer_buffer = &buffer[1];
gbuf->transfer_buffer_length = size;
gbuf->actual_length = size;
}
#define ES1_TIMEOUT 500 /* 500 ms for the SVC to do something */
-static int send_svc_msg(struct svc_msg *svc_msg, struct greybus_host_device *hd)
+static int submit_svc(struct svc_msg *svc_msg, struct greybus_host_device *hd)
{
struct es1_ap_dev *es1 = hd_to_es1(hd);
int retval;
.hd_priv_size = sizeof(struct es1_ap_dev),
.alloc_gbuf_data = alloc_gbuf_data,
.free_gbuf_data = free_gbuf_data,
- .send_svc_msg = send_svc_msg,
+ .submit_svc = submit_svc,
.submit_gbuf = submit_gbuf,
};
/* We have a message, create a new message structure, add it to the
* list, and wake up our thread that will process the messages.
*/
- gb_new_ap_msg(urb->transfer_buffer, urb->actual_length, es1->hd);
+ greybus_svc_in(urb->transfer_buffer, urb->actual_length, es1->hd);
exit:
/* resubmit the urb to get more messages */
data = &data[1];
/* Pass this data to the greybus core */
- greybus_cport_in_data(es1->hd, cport, data, urb->actual_length - 1);
+ greybus_cport_in(es1->hd, cport, data, urb->actual_length - 1);
exit:
/* put our urb back in the request pool */
// need it, we don't have a dynamic system...
int gb_register_cport_complete(struct greybus_module *gmod,
- gbuf_complete_t handler, int cport,
+ gbuf_complete_t handler, int cport_id,
void *context)
{
- if (cport_handler[cport].handler)
+ if (cport_handler[cport_id].handler)
return -EINVAL;
- cport_handler[cport].context = context;
- cport_handler[cport].gmod = gmod;
- cport_handler[cport].cport.number = cport;
- cport_handler[cport].handler = handler;
+ cport_handler[cport_id].context = context;
+ cport_handler[cport_id].gmod = gmod;
+ cport_handler[cport_id].cport.id = cport_id;
+ cport_handler[cport_id].handler = handler;
return 0;
}
-void gb_deregister_cport_complete(int cport)
+void gb_deregister_cport_complete(int cport_id)
{
- cport_handler[cport].handler = NULL;
+ cport_handler[cport_id].handler = NULL;
}
-void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
+void greybus_cport_in(struct greybus_host_device *hd, int cport_id, u8 *data,
size_t length)
{
struct gb_cport_handler *ch;
struct gbuf *gbuf;
/* first check to see if we have a cport handler for this cport */
- ch = &cport_handler[cport];
+ ch = &cport_handler[cport_id];
if (!ch->handler) {
/* Ugh, drop the data on the floor, after logging it... */
dev_err(hd->parent,
"Received data for cport %d, but no handler!\n",
- cport);
+ cport_id);
return;
}
queue_work(gbuf_workqueue, &gbuf->event);
}
-EXPORT_SYMBOL_GPL(greybus_cport_in_data);
+EXPORT_SYMBOL_GPL(greybus_cport_in);
/* Can be called in interrupt context, do the work and get out of here */
void greybus_gbuf_finished(struct gbuf *gbuf)
Submit a SVC message to the hardware
the host controller function send_svc_msg is called
Receive gbuf messages
- the host controller driver must call greybus_cport_in_data() with the data
+ the host controller driver must call greybus_cport_in() with the data
Reveive SVC messages from the hardware
- The host controller driver must call gb_new_ap_msg
+ The host controller driver must call greybus_svc_in
*/
struct gbuf;
struct gmod_cport {
- u16 number;
+ u16 id;
u16 size;
u8 speed; // valid???
// FIXME, what else?
int (*alloc_gbuf_data)(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask);
void (*free_gbuf_data)(struct gbuf *gbuf);
- int (*send_svc_msg)(struct svc_msg *svc_msg,
+ int (*submit_svc)(struct svc_msg *svc_msg,
struct greybus_host_device *hd);
int (*submit_gbuf)(struct gbuf *gbuf, struct greybus_host_device *hd,
gfp_t gfp_mask);
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *host_driver,
struct device *parent);
void greybus_remove_hd(struct greybus_host_device *hd);
-void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
+void greybus_cport_in(struct greybus_host_device *hd, int cport_id, u8 *data,
size_t length);
void greybus_gbuf_finished(struct gbuf *gbuf);
u8 *data, int size);
void gb_remove_module(struct greybus_host_device *hd, u8 module_id);
-int gb_new_ap_msg(u8 *data, int length, struct greybus_host_device *hd);
+int greybus_svc_in(u8 *data, int length, struct greybus_host_device *hd);
int gb_ap_init(void);
void gb_ap_exit(void);
int gb_debugfs_init(void);
void gb_gbuf_exit(void);
int gb_register_cport_complete(struct greybus_module *gmod,
- gbuf_complete_t handler, int cport,
+ gbuf_complete_t handler, int cport_id,
void *context);
-void gb_deregister_cport_complete(int cport);
+void gb_deregister_cport_complete(int cport_id);
extern const struct attribute_group *greybus_module_groups[];
};
struct greybus_descriptor_cport {
- __le16 number;
+ __le16 id;
__le16 size;
__u8 speed; // FIXME
__u8 reserved;
};
int gb_register_cport_complete(struct greybus_module *gmod,
- gbuf_complete_t handler, int cport,
+ gbuf_complete_t handler, int cport_id,
void *context);
-void gb_deregister_cport_complete(int cport);
+void gb_deregister_cport_complete(int cport_id);
struct gb_tty {
struct tty_port port;
struct greybus_module *gmod;
- int cport;
+ int cport_id;
unsigned int minor;
unsigned char clocal;
unsigned int throttled:1;