Commit 0db32a6d authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: some more renames

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 877b1ee8
......@@ -53,7 +53,7 @@ static int svc_msg_send(struct svc_msg *svc_msg, struct greybus_host_device *hd)
// 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;
......@@ -294,7 +294,7 @@ static void ap_process_event(struct work_struct *work)
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;
......@@ -326,7 +326,7 @@ int gb_new_ap_msg(u8 *data, int size, struct greybus_host_device *hd)
return 0;
}
EXPORT_SYMBOL_GPL(gb_new_ap_msg);
EXPORT_SYMBOL_GPL(greybus_svc_in);
int gb_ap_init(void)
{
......
......@@ -315,7 +315,7 @@ static int create_cport(struct greybus_module *gmod,
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;
......
......@@ -113,7 +113,7 @@ static int alloc_gbuf_data(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
* 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;
......@@ -139,7 +139,7 @@ static void free_gbuf_data(struct gbuf *gbuf)
}
#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;
......@@ -223,7 +223,7 @@ static struct greybus_host_driver es1_driver = {
.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,
};
......@@ -268,7 +268,7 @@ static void svc_in_callback(struct urb *urb)
/* 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 */
......@@ -307,7 +307,7 @@ static void cport_in_callback(struct urb *urb)
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 */
......
......@@ -156,36 +156,36 @@ static struct gb_cport_handler cport_handler[MAX_CPORTS];
// 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;
}
......@@ -216,7 +216,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
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)
......
......@@ -91,9 +91,9 @@
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
*/
......@@ -102,7 +102,7 @@
struct gbuf;
struct gmod_cport {
u16 number;
u16 id;
u16 size;
u8 speed; // valid???
// FIXME, what else?
......@@ -169,7 +169,7 @@ struct greybus_host_driver {
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);
......@@ -187,7 +187,7 @@ struct greybus_host_device {
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);
......@@ -289,7 +289,7 @@ void gb_add_module(struct greybus_host_device *hd, u8 module_id,
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);
......@@ -298,9 +298,9 @@ int gb_gbuf_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[];
......
......@@ -70,7 +70,7 @@ struct greybus_descriptor_string {
};
struct greybus_descriptor_cport {
__le16 number;
__le16 id;
__le16 size;
__u8 speed; // FIXME
__u8 reserved;
......
......@@ -16,9 +16,9 @@ struct test_device {
};
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);
......
......@@ -34,7 +34,7 @@
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;
......
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