greybus: hd: rename host-device structure

Rename host-device structure gb_host_device to match our other
structures.

Signed-off-by: Johan Hovold <johan@hovoldconsulting.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
This commit is contained in:
Johan Hovold 2015-11-03 18:03:23 +01:00 committed by Greg Kroah-Hartman
parent 7bc6faaca7
commit 2537636aba
18 changed files with 90 additions and 91 deletions

View File

@ -17,7 +17,7 @@ static DEFINE_SPINLOCK(gb_connections_lock);
static struct gb_connection * static struct gb_connection *
gb_connection_intf_find(struct gb_interface *intf, u16 cport_id) gb_connection_intf_find(struct gb_interface *intf, u16 cport_id)
{ {
struct greybus_host_device *hd = intf->hd; struct gb_host_device *hd = intf->hd;
struct gb_connection *connection; struct gb_connection *connection;
list_for_each_entry(connection, &hd->connections, hd_links) list_for_each_entry(connection, &hd->connections, hd_links)
@ -28,7 +28,7 @@ gb_connection_intf_find(struct gb_interface *intf, u16 cport_id)
} }
static struct gb_connection * static struct gb_connection *
gb_connection_hd_find(struct greybus_host_device *hd, u16 cport_id) gb_connection_hd_find(struct gb_host_device *hd, u16 cport_id)
{ {
struct gb_connection *connection; struct gb_connection *connection;
unsigned long flags; unsigned long flags;
@ -48,7 +48,7 @@ found:
* Callback from the host driver to let us know that data has been * Callback from the host driver to let us know that data has been
* received on the bundle. * received on the bundle.
*/ */
void greybus_data_rcvd(struct greybus_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;
@ -105,7 +105,7 @@ int svc_update_connection(struct gb_interface *intf,
* pointer otherwise. * pointer otherwise.
*/ */
struct gb_connection * struct gb_connection *
gb_connection_create_range(struct greybus_host_device *hd, gb_connection_create_range(struct gb_host_device *hd,
struct gb_bundle *bundle, struct device *parent, struct gb_bundle *bundle, struct device *parent,
u16 cport_id, u8 protocol_id, u32 ida_start, u16 cport_id, u8 protocol_id, u32 ida_start,
u32 ida_end) u32 ida_end)
@ -188,7 +188,7 @@ err_remove_ida:
static int gb_connection_hd_cport_enable(struct gb_connection *connection) static int gb_connection_hd_cport_enable(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
int ret; int ret;
if (!hd->driver->cport_enable) if (!hd->driver->cport_enable)
@ -206,7 +206,7 @@ static int gb_connection_hd_cport_enable(struct gb_connection *connection)
static void gb_connection_hd_cport_disable(struct gb_connection *connection) static void gb_connection_hd_cport_disable(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
if (!hd->driver->cport_disable) if (!hd->driver->cport_disable)
return; return;
@ -258,7 +258,7 @@ static void gb_connection_cancel_operations(struct gb_connection *connection,
static int static int
gb_connection_svc_connection_create(struct gb_connection *connection) gb_connection_svc_connection_create(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
struct gb_protocol *protocol = connection->protocol; struct gb_protocol *protocol = connection->protocol;
struct gb_interface *intf; struct gb_interface *intf;
int ret; int ret;
@ -459,7 +459,7 @@ void gb_connection_destroy(struct gb_connection *connection)
void gb_connection_latency_tag_enable(struct gb_connection *connection) void gb_connection_latency_tag_enable(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
int ret; int ret;
if (!hd->driver->latency_tag_enable) if (!hd->driver->latency_tag_enable)
@ -475,7 +475,7 @@ EXPORT_SYMBOL_GPL(gb_connection_latency_tag_enable);
void gb_connection_latency_tag_disable(struct gb_connection *connection) void gb_connection_latency_tag_disable(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
int ret; int ret;
if (!hd->driver->latency_tag_disable) if (!hd->driver->latency_tag_disable)

View File

@ -22,7 +22,7 @@ enum gb_connection_state {
}; };
struct gb_connection { struct gb_connection {
struct greybus_host_device *hd; struct gb_host_device *hd;
struct gb_bundle *bundle; struct gb_bundle *bundle;
struct kref kref; struct kref kref;
u16 hd_cport_id; u16 hd_cport_id;
@ -53,13 +53,13 @@ int svc_update_connection(struct gb_interface *intf,
struct gb_connection *connection); struct gb_connection *connection);
struct gb_connection *gb_connection_create(struct gb_bundle *bundle, struct gb_connection *gb_connection_create(struct gb_bundle *bundle,
u16 cport_id, u8 protocol_id); u16 cport_id, u8 protocol_id);
struct gb_connection *gb_connection_create_range(struct greybus_host_device *hd, struct gb_connection *gb_connection_create_range(struct gb_host_device *hd,
struct gb_bundle *bundle, struct device *parent, struct gb_bundle *bundle, struct device *parent,
u16 cport_id, u8 protocol_id, u32 ida_start, u16 cport_id, u8 protocol_id, u32 ida_start,
u32 ida_end); u32 ida_end);
void gb_connection_destroy(struct gb_connection *connection); void gb_connection_destroy(struct gb_connection *connection);
void greybus_data_rcvd(struct greybus_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);
int gb_connection_bind_protocol(struct gb_connection *connection); int gb_connection_bind_protocol(struct gb_connection *connection);

View File

@ -191,7 +191,7 @@ static bool single_cross_rib(u8 left_ribs, u8 right_ribs)
* - Bit 1: 2nd rib location from top, i.e. between interface 2 and 3. * - Bit 1: 2nd rib location from top, i.e. between interface 2 and 3.
* - Bit 2: 3rd rib location from top, i.e. between interface 3 and 4. * - Bit 2: 3rd rib location from top, i.e. between interface 3 and 4.
*/ */
static bool validate_front_ribs(struct greybus_host_device *hd, static bool validate_front_ribs(struct gb_host_device *hd,
struct endo_layout *layout, bool mini, struct endo_layout *layout, bool mini,
u16 endo_id) u16 endo_id)
{ {
@ -254,7 +254,7 @@ static bool validate_front_ribs(struct greybus_host_device *hd,
* its rotational orientation. We define one canonical id to represent a * its rotational orientation. We define one canonical id to represent a
* particular endo configuration. * particular endo configuration.
*/ */
static bool validate_back_ribs(struct greybus_host_device *hd, static bool validate_back_ribs(struct gb_host_device *hd,
struct endo_layout *layout, u16 endo_id) struct endo_layout *layout, u16 endo_id)
{ {
u8 max_ribs = layout->max_ribs; u8 max_ribs = layout->max_ribs;
@ -320,7 +320,7 @@ static bool validate_back_ribs(struct greybus_host_device *hd,
* Validate the endo-id passed from SVC. Error out if its not a valid Endo, * Validate the endo-id passed from SVC. Error out if its not a valid Endo,
* else return structure representing ribs positions on front and back of Endo. * else return structure representing ribs positions on front and back of Endo.
*/ */
static int gb_endo_validate_id(struct greybus_host_device *hd, static int gb_endo_validate_id(struct gb_host_device *hd,
struct endo_layout *layout, u16 endo_id) struct endo_layout *layout, u16 endo_id)
{ {
/* Validate Endo Size */ /* Validate Endo Size */
@ -435,7 +435,7 @@ static int create_modules(struct gb_endo *endo)
return 0; return 0;
} }
static int gb_endo_register(struct greybus_host_device *hd, static int gb_endo_register(struct gb_host_device *hd,
struct gb_endo *endo) struct gb_endo *endo)
{ {
int dev_id; int dev_id;
@ -471,7 +471,7 @@ static int gb_endo_register(struct greybus_host_device *hd,
return retval; return retval;
} }
struct gb_endo *gb_endo_create(struct greybus_host_device *hd, u16 endo_id, struct gb_endo *gb_endo_create(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id) u8 ap_intf_id)
{ {
struct gb_endo *endo; struct gb_endo *endo;
@ -524,7 +524,7 @@ void gb_endo_remove(struct gb_endo *endo)
device_unregister(&endo->dev); device_unregister(&endo->dev);
} }
int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id, int greybus_endo_setup(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id) u8 ap_intf_id)
{ {
struct gb_endo *endo; struct gb_endo *endo;

View File

@ -47,15 +47,15 @@ struct gb_endo {
#define to_gb_endo(d) container_of(d, struct gb_endo, dev) #define to_gb_endo(d) container_of(d, struct gb_endo, dev)
/* Greybus "private" definitions */ /* Greybus "private" definitions */
struct greybus_host_device; struct gb_host_device;
int gb_endo_init(void); int gb_endo_init(void);
void gb_endo_exit(void); void gb_endo_exit(void);
struct gb_endo *gb_endo_create(struct greybus_host_device *hd, struct gb_endo *gb_endo_create(struct gb_host_device *hd,
u16 endo_id, u8 ap_intf_id); u16 endo_id, u8 ap_intf_id);
void gb_endo_remove(struct gb_endo *endo); void gb_endo_remove(struct gb_endo *endo);
int greybus_endo_setup(struct greybus_host_device *hd, u16 endo_id, int greybus_endo_setup(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id); u8 ap_intf_id);
u8 endo_get_module_id(struct gb_endo *endo, u8 interface_id); u8 endo_get_module_id(struct gb_endo *endo, u8 interface_id);

View File

@ -60,7 +60,7 @@ static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE);
* es1_ap_dev - ES1 USB Bridge to AP structure * es1_ap_dev - ES1 USB Bridge to AP structure
* @usb_dev: pointer to the USB device we are. * @usb_dev: pointer to the USB device we are.
* @usb_intf: pointer to the USB interface we are bound to. * @usb_intf: pointer to the USB interface we are bound to.
* @hd: pointer to our greybus_host_device structure * @hd: pointer to our gb_host_device structure
* @cport_in_endpoint: bulk in endpoint for CPort data * @cport_in_endpoint: bulk in endpoint for CPort data
* @cport-out_endpoint: bulk out endpoint for CPort data * @cport-out_endpoint: bulk out endpoint for CPort data
* @cport_in_urb: array of urbs for the CPort in messages * @cport_in_urb: array of urbs for the CPort in messages
@ -75,7 +75,7 @@ static DEFINE_KFIFO(apb1_log_fifo, char, APB1_LOG_SIZE);
struct es1_ap_dev { struct es1_ap_dev {
struct usb_device *usb_dev; struct usb_device *usb_dev;
struct usb_interface *usb_intf; struct usb_interface *usb_intf;
struct greybus_host_device *hd; struct gb_host_device *hd;
__u8 cport_in_endpoint; __u8 cport_in_endpoint;
__u8 cport_out_endpoint; __u8 cport_out_endpoint;
@ -88,7 +88,7 @@ struct es1_ap_dev {
spinlock_t cport_out_urb_lock; spinlock_t cport_out_urb_lock;
}; };
static inline struct es1_ap_dev *hd_to_es1(struct greybus_host_device *hd) static inline struct es1_ap_dev *hd_to_es1(struct gb_host_device *hd)
{ {
return (struct es1_ap_dev *)&hd->hd_priv; return (struct es1_ap_dev *)&hd->hd_priv;
} }
@ -181,7 +181,7 @@ static u16 gb_message_cport_unpack(struct gb_operation_msg_hdr *header)
* Returns zero if the message was successfully queued, or a negative errno * Returns zero if the message was successfully queued, or a negative errno
* otherwise. * otherwise.
*/ */
static int message_send(struct greybus_host_device *hd, u16 cport_id, static int message_send(struct gb_host_device *hd, u16 cport_id,
struct gb_message *message, gfp_t gfp_mask) struct gb_message *message, gfp_t gfp_mask)
{ {
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
@ -244,7 +244,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id,
*/ */
static void message_cancel(struct gb_message *message) static void message_cancel(struct gb_message *message)
{ {
struct greybus_host_device *hd = message->operation->connection->hd; struct gb_host_device *hd = message->operation->connection->hd;
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
struct urb *urb; struct urb *urb;
int i; int i;
@ -277,7 +277,7 @@ static void message_cancel(struct gb_message *message)
usb_free_urb(urb); usb_free_urb(urb);
} }
static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id) static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{ {
int retval; int retval;
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
@ -301,7 +301,7 @@ static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id)
return retval; return retval;
} }
static int latency_tag_disable(struct greybus_host_device *hd, u16 cport_id) static int latency_tag_disable(struct gb_host_device *hd, u16 cport_id)
{ {
int retval; int retval;
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
@ -403,7 +403,7 @@ static void ap_disconnect(struct usb_interface *interface)
static void cport_in_callback(struct urb *urb) static void cport_in_callback(struct urb *urb)
{ {
struct greybus_host_device *hd = urb->context; struct gb_host_device *hd = urb->context;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
struct gb_operation_msg_hdr *header; struct gb_operation_msg_hdr *header;
int status = check_urb_status(urb); int status = check_urb_status(urb);
@ -443,7 +443,7 @@ exit:
static void cport_out_callback(struct urb *urb) static void cport_out_callback(struct urb *urb)
{ {
struct gb_message *message = urb->context; struct gb_message *message = urb->context;
struct greybus_host_device *hd = message->operation->connection->hd; struct gb_host_device *hd = message->operation->connection->hd;
struct es1_ap_dev *es1 = hd_to_es1(hd); struct es1_ap_dev *es1 = hd_to_es1(hd);
int status = check_urb_status(urb); int status = check_urb_status(urb);
unsigned long flags; unsigned long flags;
@ -599,7 +599,7 @@ static int ap_probe(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct es1_ap_dev *es1; struct es1_ap_dev *es1;
struct greybus_host_device *hd; struct gb_host_device *hd;
struct usb_device *udev; struct usb_device *udev;
struct usb_host_interface *iface_desc; struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *endpoint;

View File

@ -83,7 +83,7 @@ struct es2_cport_out {
* es2_ap_dev - ES2 USB Bridge to AP structure * es2_ap_dev - ES2 USB Bridge to AP structure
* @usb_dev: pointer to the USB device we are. * @usb_dev: pointer to the USB device we are.
* @usb_intf: pointer to the USB interface we are bound to. * @usb_intf: pointer to the USB interface we are bound to.
* @hd: pointer to our greybus_host_device structure * @hd: pointer to our gb_host_device structure
* @cport_in: endpoint, urbs and buffer for cport in messages * @cport_in: endpoint, urbs and buffer for cport in messages
* @cport_out: endpoint for for cport out messages * @cport_out: endpoint for for cport out messages
@ -102,7 +102,7 @@ struct es2_cport_out {
struct es2_ap_dev { struct es2_ap_dev {
struct usb_device *usb_dev; struct usb_device *usb_dev;
struct usb_interface *usb_intf; struct usb_interface *usb_intf;
struct greybus_host_device *hd; struct gb_host_device *hd;
struct es2_cport_in cport_in[NUM_BULKS]; struct es2_cport_in cport_in[NUM_BULKS];
struct es2_cport_out cport_out[NUM_BULKS]; struct es2_cport_out cport_out[NUM_BULKS];
@ -131,7 +131,7 @@ struct cport_to_ep {
__u8 endpoint_out; __u8 endpoint_out;
}; };
static inline struct es2_ap_dev *hd_to_es2(struct greybus_host_device *hd) static inline struct es2_ap_dev *hd_to_es2(struct gb_host_device *hd)
{ {
return (struct es2_ap_dev *)&hd->hd_priv; return (struct es2_ap_dev *)&hd->hd_priv;
} }
@ -291,7 +291,7 @@ static u16 gb_message_cport_unpack(struct gb_operation_msg_hdr *header)
* Returns zero if the message was successfully queued, or a negative errno * Returns zero if the message was successfully queued, or a negative errno
* otherwise. * otherwise.
*/ */
static int message_send(struct greybus_host_device *hd, u16 cport_id, static int message_send(struct gb_host_device *hd, u16 cport_id,
struct gb_message *message, gfp_t gfp_mask) struct gb_message *message, gfp_t gfp_mask)
{ {
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
@ -357,7 +357,7 @@ static int message_send(struct greybus_host_device *hd, u16 cport_id,
*/ */
static void message_cancel(struct gb_message *message) static void message_cancel(struct gb_message *message)
{ {
struct greybus_host_device *hd = message->operation->connection->hd; struct gb_host_device *hd = message->operation->connection->hd;
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
struct urb *urb; struct urb *urb;
int i; int i;
@ -390,7 +390,7 @@ static void message_cancel(struct gb_message *message)
usb_free_urb(urb); usb_free_urb(urb);
} }
static int cport_reset(struct greybus_host_device *hd, u16 cport_id) static int cport_reset(struct gb_host_device *hd, u16 cport_id)
{ {
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
struct usb_device *udev = es2->usb_dev; struct usb_device *udev = es2->usb_dev;
@ -410,7 +410,7 @@ static int cport_reset(struct greybus_host_device *hd, u16 cport_id)
return 0; return 0;
} }
static int cport_enable(struct greybus_host_device *hd, u16 cport_id) static int cport_enable(struct gb_host_device *hd, u16 cport_id)
{ {
int retval; int retval;
@ -423,7 +423,7 @@ static int cport_enable(struct greybus_host_device *hd, u16 cport_id)
return 0; return 0;
} }
static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id) static int latency_tag_enable(struct gb_host_device *hd, u16 cport_id)
{ {
int retval; int retval;
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
@ -447,7 +447,7 @@ static int latency_tag_enable(struct greybus_host_device *hd, u16 cport_id)
return retval; return retval;
} }
static int latency_tag_disable(struct greybus_host_device *hd, u16 cport_id) static int latency_tag_disable(struct gb_host_device *hd, u16 cport_id)
{ {
int retval; int retval;
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
@ -556,7 +556,7 @@ static void ap_disconnect(struct usb_interface *interface)
static void cport_in_callback(struct urb *urb) static void cport_in_callback(struct urb *urb)
{ {
struct greybus_host_device *hd = urb->context; struct gb_host_device *hd = urb->context;
struct device *dev = &urb->dev->dev; struct device *dev = &urb->dev->dev;
struct gb_operation_msg_hdr *header; struct gb_operation_msg_hdr *header;
int status = check_urb_status(urb); int status = check_urb_status(urb);
@ -596,7 +596,7 @@ exit:
static void cport_out_callback(struct urb *urb) static void cport_out_callback(struct urb *urb)
{ {
struct gb_message *message = urb->context; struct gb_message *message = urb->context;
struct greybus_host_device *hd = message->operation->connection->hd; struct gb_host_device *hd = message->operation->connection->hd;
struct es2_ap_dev *es2 = hd_to_es2(hd); struct es2_ap_dev *es2 = hd_to_es2(hd);
int status = check_urb_status(urb); int status = check_urb_status(urb);
unsigned long flags; unsigned long flags;
@ -787,7 +787,7 @@ static int ap_probe(struct usb_interface *interface,
const struct usb_device_id *id) const struct usb_device_id *id)
{ {
struct es2_ap_dev *es2; struct es2_ap_dev *es2;
struct greybus_host_device *hd; struct gb_host_device *hd;
struct usb_device *udev; struct usb_device *udev;
struct usb_host_interface *iface_desc; struct usb_host_interface *iface_desc;
struct usb_endpoint_descriptor *endpoint; struct usb_endpoint_descriptor *endpoint;

View File

@ -129,7 +129,7 @@ static inline int is_gb_bundle(const struct device *dev)
return dev->type == &greybus_bundle_type; return dev->type == &greybus_bundle_type;
} }
static inline bool cport_id_valid(struct greybus_host_device *hd, u16 cport_id) static inline bool cport_id_valid(struct gb_host_device *hd, u16 cport_id)
{ {
return cport_id != CPORT_ID_BAD && cport_id < hd->num_cports; return cport_id != CPORT_ID_BAD && cport_id < hd->num_cports;
} }

View File

@ -15,7 +15,7 @@
#include <linux/tracepoint.h> #include <linux/tracepoint.h>
struct gb_message; struct gb_message;
struct greybus_host_device; struct gb_host_device;
DECLARE_EVENT_CLASS(gb_message, DECLARE_EVENT_CLASS(gb_message,
@ -108,7 +108,7 @@ DEFINE_EVENT(gb_message, gb_message_cancel_incoming,
DECLARE_EVENT_CLASS(gb_host_device, DECLARE_EVENT_CLASS(gb_host_device,
TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id, TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size), size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size), TP_ARGS(hd, intf_cport_id, payload_size),
@ -136,7 +136,7 @@ DECLARE_EVENT_CLASS(gb_host_device,
*/ */
DEFINE_EVENT(gb_host_device, gb_host_device_send, DEFINE_EVENT(gb_host_device, gb_host_device_send,
TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id, TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size), size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size) TP_ARGS(hd, intf_cport_id, payload_size)
@ -149,7 +149,7 @@ DEFINE_EVENT(gb_host_device, gb_host_device_send,
*/ */
DEFINE_EVENT(gb_host_device, gb_host_device_recv, DEFINE_EVENT(gb_host_device, gb_host_device_recv,
TP_PROTO(struct greybus_host_device *hd, u16 intf_cport_id, TP_PROTO(struct gb_host_device *hd, u16 intf_cport_id,
size_t payload_size), size_t payload_size),
TP_ARGS(hd, intf_cport_id, payload_size) TP_ARGS(hd, intf_cport_id, payload_size)

View File

@ -19,21 +19,21 @@ static DEFINE_MUTEX(hd_mutex);
static void free_hd(struct kref *kref) static void free_hd(struct kref *kref)
{ {
struct greybus_host_device *hd; struct gb_host_device *hd;
hd = container_of(kref, struct greybus_host_device, kref); hd = container_of(kref, struct gb_host_device, kref);
ida_destroy(&hd->cport_id_map); ida_destroy(&hd->cport_id_map);
kfree(hd); kfree(hd);
mutex_unlock(&hd_mutex); mutex_unlock(&hd_mutex);
} }
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver, struct gb_host_device *greybus_create_hd(struct greybus_host_driver *driver,
struct device *parent, struct device *parent,
size_t buffer_size_max, size_t buffer_size_max,
size_t num_cports) size_t num_cports)
{ {
struct greybus_host_device *hd; struct gb_host_device *hd;
/* /*
* Validate that the driver implements all of the callbacks * Validate that the driver implements all of the callbacks
@ -96,7 +96,7 @@ struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *driver
} }
EXPORT_SYMBOL_GPL(greybus_create_hd); EXPORT_SYMBOL_GPL(greybus_create_hd);
void greybus_remove_hd(struct greybus_host_device *hd) void greybus_remove_hd(struct gb_host_device *hd)
{ {
/* /*
* Tear down all interfaces, modules, and the endo that is associated * Tear down all interfaces, modules, and the endo that is associated

View File

@ -10,7 +10,7 @@
#ifndef __HD_H #ifndef __HD_H
#define __HD_H #define __HD_H
struct greybus_host_device; struct gb_host_device;
struct gb_message; struct gb_message;
/* Greybus "Host driver" structure, needed by a host controller driver to be /* Greybus "Host driver" structure, needed by a host controller driver to be
@ -19,17 +19,16 @@ struct gb_message;
struct greybus_host_driver { struct greybus_host_driver {
size_t hd_priv_size; size_t hd_priv_size;
int (*cport_enable)(struct greybus_host_device *hd, u16 cport_id); int (*cport_enable)(struct gb_host_device *hd, u16 cport_id);
int (*cport_disable)(struct greybus_host_device *hd, u16 cport_id); int (*cport_disable)(struct gb_host_device *hd, u16 cport_id);
int (*message_send)(struct greybus_host_device *hd, u16 dest_cport_id, int (*message_send)(struct gb_host_device *hd, u16 dest_cport_id,
struct gb_message *message, gfp_t gfp_mask); struct gb_message *message, gfp_t gfp_mask);
void (*message_cancel)(struct gb_message *message); void (*message_cancel)(struct gb_message *message);
int (*latency_tag_enable)(struct greybus_host_device *hd, u16 cport_id); int (*latency_tag_enable)(struct gb_host_device *hd, u16 cport_id);
int (*latency_tag_disable)(struct greybus_host_device *hd, int (*latency_tag_disable)(struct gb_host_device *hd, u16 cport_id);
u16 cport_id);
}; };
struct greybus_host_device { struct gb_host_device {
struct kref kref; struct kref kref;
struct device *parent; struct device *parent;
const struct greybus_host_driver *driver; const struct greybus_host_driver *driver;
@ -52,10 +51,10 @@ struct greybus_host_device {
unsigned long hd_priv[0] __aligned(sizeof(s64)); unsigned long hd_priv[0] __aligned(sizeof(s64));
}; };
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd, struct gb_host_device *greybus_create_hd(struct greybus_host_driver *hd,
struct device *parent, struct device *parent,
size_t buffer_size_max, size_t buffer_size_max,
size_t num_cports); size_t num_cports);
void greybus_remove_hd(struct greybus_host_device *hd); void greybus_remove_hd(struct gb_host_device *hd);
#endif /* __HD_H */ #endif /* __HD_H */

View File

@ -44,7 +44,7 @@ static DEFINE_SPINLOCK(gb_interfaces_lock);
// FIXME, odds are you don't want to call this function, rework the caller to // FIXME, odds are you don't want to call this function, rework the caller to
// not need it please. // not need it please.
struct gb_interface *gb_interface_find(struct greybus_host_device *hd, struct gb_interface *gb_interface_find(struct gb_host_device *hd,
u8 interface_id) u8 interface_id)
{ {
struct gb_interface *intf; struct gb_interface *intf;
@ -120,7 +120,7 @@ int gb_create_bundle_connection(struct gb_interface *intf, u8 class)
* Returns a pointer to the new interfce or a null pointer if a * Returns a pointer to the new interfce or a null pointer if a
* failure occurs due to memory exhaustion. * failure occurs due to memory exhaustion.
*/ */
struct gb_interface *gb_interface_create(struct greybus_host_device *hd, struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id) u8 interface_id)
{ {
struct gb_module *module; struct gb_module *module;
@ -199,7 +199,7 @@ void gb_interface_remove(struct gb_interface *intf)
put_device(&module->dev); put_device(&module->dev);
} }
void gb_interfaces_remove(struct greybus_host_device *hd) void gb_interfaces_remove(struct gb_host_device *hd)
{ {
struct gb_interface *intf, *temp; struct gb_interface *intf, *temp;

View File

@ -16,7 +16,7 @@ struct gb_interface {
struct gb_control *control; struct gb_control *control;
struct list_head bundles; struct list_head bundles;
struct list_head links; /* greybus_host_device->interfaces */ struct list_head links; /* gb_host_device->interfaces */
struct list_head manifest_descs; struct list_head manifest_descs;
u8 interface_id; /* Physical location within the Endo */ u8 interface_id; /* Physical location within the Endo */
u8 device_id; /* Device id allocated for the interface block by the SVC */ u8 device_id; /* Device id allocated for the interface block by the SVC */
@ -35,7 +35,7 @@ struct gb_interface {
u32 ara_prod_id; u32 ara_prod_id;
struct gb_module *module; struct gb_module *module;
struct greybus_host_device *hd; struct gb_host_device *hd;
/* The interface needs to boot over unipro */ /* The interface needs to boot over unipro */
bool boot_over_unipro; bool boot_over_unipro;
@ -55,15 +55,15 @@ static inline void *gb_interface_get_drvdata(struct gb_interface *intf)
/* Greybus "private" definitions */ /* Greybus "private" definitions */
struct gb_interface *gb_interface_find(struct greybus_host_device *hd, struct gb_interface *gb_interface_find(struct gb_host_device *hd,
u8 interface_id); u8 interface_id);
struct gb_interface *gb_interface_create(struct greybus_host_device *hd, struct gb_interface *gb_interface_create(struct gb_host_device *hd,
u8 interface_id); u8 interface_id);
void gb_interface_destroy(struct gb_interface *intf); void gb_interface_destroy(struct gb_interface *intf);
int gb_interface_init(struct gb_interface *intf, u8 device_id); int gb_interface_init(struct gb_interface *intf, u8 device_id);
void gb_interface_remove(struct gb_interface *intf); void gb_interface_remove(struct gb_interface *intf);
void gb_interfaces_remove(struct greybus_host_device *hd); void gb_interfaces_remove(struct gb_host_device *hd);
int gb_create_bundle_connection(struct gb_interface *intf, u8 class); int gb_create_bundle_connection(struct gb_interface *intf, u8 class);
#endif /* __INTERFACE_H */ #endif /* __INTERFACE_H */

View File

@ -108,7 +108,7 @@ static int module_find(struct device *dev, void *data)
* Search the list of modules in the system. If one is found, return it, with * Search the list of modules in the system. If one is found, return it, with
* the reference count incremented. * the reference count incremented.
*/ */
struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id) struct gb_module *gb_module_find(struct gb_host_device *hd, u8 module_id)
{ {
struct device *dev; struct device *dev;
struct gb_module *module = NULL; struct gb_module *module = NULL;

View File

@ -16,10 +16,10 @@ struct gb_module {
}; };
#define to_gb_module(d) container_of(d, struct gb_module, dev) #define to_gb_module(d) container_of(d, struct gb_module, dev)
struct greybus_host_device; struct gb_host_device;
/* Greybus "private" definitions */ /* Greybus "private" definitions */
struct gb_module *gb_module_find(struct greybus_host_device *hd, u8 module_id); struct gb_module *gb_module_find(struct gb_host_device *hd, u8 module_id);
struct gb_module *gb_module_create(struct device *parent, u8 module_id); struct gb_module *gb_module_create(struct device *parent, u8 module_id);
void gb_module_remove_all(struct gb_endo *endo); void gb_module_remove_all(struct gb_endo *endo);

View File

@ -210,7 +210,7 @@ static int gb_message_send(struct gb_message *message, gfp_t gfp)
*/ */
static void gb_message_cancel(struct gb_message *message) static void gb_message_cancel(struct gb_message *message)
{ {
struct greybus_host_device *hd = message->operation->connection->hd; struct gb_host_device *hd = message->operation->connection->hd;
hd->driver->message_cancel(message); hd->driver->message_cancel(message);
} }
@ -269,7 +269,7 @@ static void gb_operation_work(struct work_struct *work)
gb_operation_put(operation); gb_operation_put(operation);
} }
static void gb_operation_message_init(struct greybus_host_device *hd, static void gb_operation_message_init(struct gb_host_device *hd,
struct gb_message *message, u16 operation_id, struct gb_message *message, u16 operation_id,
size_t payload_size, u8 type) size_t payload_size, u8 type)
{ {
@ -320,7 +320,7 @@ static void gb_operation_message_init(struct greybus_host_device *hd,
* message payload / the message size * message payload / the message size
*/ */
static struct gb_message * static struct gb_message *
gb_operation_message_alloc(struct greybus_host_device *hd, u8 type, gb_operation_message_alloc(struct gb_host_device *hd, u8 type,
size_t payload_size, gfp_t gfp_flags) size_t payload_size, gfp_t gfp_flags)
{ {
struct gb_message *message; struct gb_message *message;
@ -430,7 +430,7 @@ static u8 gb_operation_errno_map(int errno)
bool gb_operation_response_alloc(struct gb_operation *operation, bool gb_operation_response_alloc(struct gb_operation *operation,
size_t response_size, gfp_t gfp) size_t response_size, gfp_t gfp)
{ {
struct greybus_host_device *hd = operation->connection->hd; struct gb_host_device *hd = operation->connection->hd;
struct gb_operation_msg_hdr *request_header; struct gb_operation_msg_hdr *request_header;
struct gb_message *response; struct gb_message *response;
u8 type; u8 type;
@ -482,7 +482,7 @@ gb_operation_create_common(struct gb_connection *connection, u8 type,
size_t request_size, size_t response_size, size_t request_size, size_t response_size,
unsigned long op_flags, gfp_t gfp_flags) unsigned long op_flags, gfp_t gfp_flags)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
struct gb_operation *operation; struct gb_operation *operation;
operation = kmem_cache_zalloc(gb_operation_cache, gfp_flags); operation = kmem_cache_zalloc(gb_operation_cache, gfp_flags);
@ -548,7 +548,7 @@ EXPORT_SYMBOL_GPL(gb_operation_create);
size_t gb_operation_get_payload_size_max(struct gb_connection *connection) size_t gb_operation_get_payload_size_max(struct gb_connection *connection)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
return hd->buffer_size_max - sizeof(struct gb_operation_msg_hdr); return hd->buffer_size_max - sizeof(struct gb_operation_msg_hdr);
} }
@ -777,7 +777,7 @@ err_put:
/* /*
* This function is called when a message send request has completed. * This function is called when a message send request has completed.
*/ */
void greybus_message_sent(struct greybus_host_device *hd, void greybus_message_sent(struct gb_host_device *hd,
struct gb_message *message, int status) struct gb_message *message, int status)
{ {
struct gb_operation *operation = message->operation; struct gb_operation *operation = message->operation;

View File

@ -150,7 +150,7 @@ gb_operation_request_send_sync(struct gb_operation *operation)
void gb_operation_cancel(struct gb_operation *operation, int errno); void gb_operation_cancel(struct gb_operation *operation, int errno);
void gb_operation_cancel_incoming(struct gb_operation *operation, int errno); void gb_operation_cancel_incoming(struct gb_operation *operation, int errno);
void greybus_message_sent(struct greybus_host_device *hd, void greybus_message_sent(struct gb_host_device *hd,
struct gb_message *message, int status); struct gb_message *message, int status);
int gb_operation_sync_timeout(struct gb_connection *connection, int type, int gb_operation_sync_timeout(struct gb_connection *connection, int type,

View File

@ -42,7 +42,7 @@ struct svc_hotplug {
* This is a temporary connection, used only at initial bootup. * This is a temporary connection, used only at initial bootup.
*/ */
struct gb_connection * struct gb_connection *
gb_ap_svc_connection_create(struct greybus_host_device *hd) gb_ap_svc_connection_create(struct gb_host_device *hd)
{ {
struct gb_connection *connection; struct gb_connection *connection;
@ -61,7 +61,7 @@ gb_ap_svc_connection_create(struct greybus_host_device *hd)
* 'partially' initialized one svc connection. * 'partially' initialized one svc connection.
*/ */
static struct gb_interface * static struct gb_interface *
gb_ap_interface_create(struct greybus_host_device *hd, gb_ap_interface_create(struct gb_host_device *hd,
struct gb_connection *connection, u8 interface_id) struct gb_connection *connection, u8 interface_id)
{ {
struct gb_interface *intf; struct gb_interface *intf;
@ -183,7 +183,7 @@ EXPORT_SYMBOL_GPL(gb_svc_dme_peer_set);
*/ */
static int gb_svc_read_and_clear_module_boot_status(struct gb_interface *intf) static int gb_svc_read_and_clear_module_boot_status(struct gb_interface *intf)
{ {
struct greybus_host_device *hd = intf->hd; struct gb_host_device *hd = intf->hd;
int ret; int ret;
u32 value; u32 value;
@ -338,7 +338,7 @@ static int gb_svc_version_request(struct gb_operation *op)
static int gb_svc_hello(struct gb_operation *op) static int gb_svc_hello(struct gb_operation *op)
{ {
struct gb_connection *connection = op->connection; struct gb_connection *connection = op->connection;
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
struct gb_svc_hello_request *hello_request; struct gb_svc_hello_request *hello_request;
struct gb_interface *intf; struct gb_interface *intf;
u16 endo_id; u16 endo_id;
@ -381,7 +381,7 @@ static int gb_svc_hello(struct gb_operation *op)
static void svc_intf_remove(struct gb_connection *connection, static void svc_intf_remove(struct gb_connection *connection,
struct gb_interface *intf) struct gb_interface *intf)
{ {
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
struct gb_svc *svc = connection->private; struct gb_svc *svc = connection->private;
u8 intf_id = intf->interface_id; u8 intf_id = intf->interface_id;
u8 device_id; u8 device_id;
@ -408,7 +408,7 @@ static void svc_process_hotplug(struct work_struct *work)
struct gb_svc_intf_hotplug_request *hotplug = &svc_hotplug->data; struct gb_svc_intf_hotplug_request *hotplug = &svc_hotplug->data;
struct gb_connection *connection = svc_hotplug->connection; struct gb_connection *connection = svc_hotplug->connection;
struct gb_svc *svc = connection->private; struct gb_svc *svc = connection->private;
struct greybus_host_device *hd = connection->hd; struct gb_host_device *hd = connection->hd;
struct gb_interface *intf; struct gb_interface *intf;
u8 intf_id, device_id; u8 intf_id, device_id;
int ret; int ret;
@ -552,7 +552,7 @@ static int gb_svc_intf_hot_unplug_recv(struct gb_operation *op)
{ {
struct gb_message *request = op->request; struct gb_message *request = op->request;
struct gb_svc_intf_hot_unplug_request *hot_unplug = request->payload; struct gb_svc_intf_hot_unplug_request *hot_unplug = request->payload;
struct greybus_host_device *hd = op->connection->hd; struct gb_host_device *hd = op->connection->hd;
struct gb_interface *intf; struct gb_interface *intf;
u8 intf_id; u8 intf_id;

View File

@ -25,6 +25,6 @@ int gb_svc_dme_peer_set(struct gb_svc *svc, u8 intf_id, u16 attr, u16 selector,
int gb_svc_protocol_init(void); int gb_svc_protocol_init(void);
void gb_svc_protocol_exit(void); void gb_svc_protocol_exit(void);
struct gb_connection * struct gb_connection *gb_ap_svc_connection_create(struct gb_host_device *hd);
gb_ap_svc_connection_create(struct greybus_host_device *hd);
#endif /* __SVC_H */ #endif /* __SVC_H */