Commit 778c69c9 authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

greybus: rename struct greybus_device

The greybus_device structure represents an Ara phone module.
It does *not* (necessarily) represent a UniPro device, nor any
device (like an i2c adapter) that might reside on an Ara module.

As such, rename struct greybus_device to be struct greybus_module.
Rename all symbols having that type to be "gmod" rather than "gdev".
Signed-off-by: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 69f93abf
...@@ -18,7 +18,7 @@ struct gb_battery { ...@@ -18,7 +18,7 @@ struct gb_battery {
// we will want to keep the battery stats in here as we will be getting // we will want to keep the battery stats in here as we will be getting
// updates from the SVC "on the fly" so we don't have to always go ask // updates from the SVC "on the fly" so we don't have to always go ask
// the battery for some information. Hopefully... // the battery for some information. Hopefully...
struct greybus_device *gdev; struct greybus_module *gmod;
}; };
#define to_gb_battery(x) container_of(x, struct gb_battery, bat) #define to_gb_battery(x) container_of(x, struct gb_battery, bat)
...@@ -100,7 +100,7 @@ static enum power_supply_property battery_props[] = { ...@@ -100,7 +100,7 @@ static enum power_supply_property battery_props[] = {
POWER_SUPPLY_PROP_VOLTAGE_NOW, POWER_SUPPLY_PROP_VOLTAGE_NOW,
}; };
int gb_battery_probe(struct greybus_device *gdev, int gb_battery_probe(struct greybus_module *gmod,
const struct greybus_module_id *id) const struct greybus_module_id *id)
{ {
struct gb_battery *gb; struct gb_battery *gb;
...@@ -120,21 +120,21 @@ int gb_battery_probe(struct greybus_device *gdev, ...@@ -120,21 +120,21 @@ int gb_battery_probe(struct greybus_device *gdev,
b->num_properties = ARRAY_SIZE(battery_props), b->num_properties = ARRAY_SIZE(battery_props),
b->get_property = get_property, b->get_property = get_property,
retval = power_supply_register(&gdev->dev, b); retval = power_supply_register(&gmod->dev, b);
if (retval) { if (retval) {
kfree(gb); kfree(gb);
return retval; return retval;
} }
gdev->gb_battery = gb; gmod->gb_battery = gb;
return 0; return 0;
} }
void gb_battery_disconnect(struct greybus_device *gdev) void gb_battery_disconnect(struct greybus_module *gmod)
{ {
struct gb_battery *gb; struct gb_battery *gb;
gb = gdev->gb_battery; gb = gmod->gb_battery;
power_supply_unregister(&gb->bat); power_supply_unregister(&gb->bat);
......
This diff is collapsed.
...@@ -92,7 +92,7 @@ static void cport_out_callback(struct urb *urb); ...@@ -92,7 +92,7 @@ static void cport_out_callback(struct urb *urb);
*/ */
static int alloc_gbuf_data(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask) static int alloc_gbuf_data(struct gbuf *gbuf, unsigned int size, gfp_t gfp_mask)
{ {
struct es1_ap_dev *es1 = hd_to_es1(gbuf->gdev->hd); struct es1_ap_dev *es1 = hd_to_es1(gbuf->gmod->hd);
u8 *buffer; u8 *buffer;
if (size > ES1_GBUF_MSG_SIZE) { if (size > ES1_GBUF_MSG_SIZE) {
......
...@@ -22,8 +22,8 @@ ...@@ -22,8 +22,8 @@
static struct kmem_cache *gbuf_head_cache; static struct kmem_cache *gbuf_head_cache;
static struct gbuf *__alloc_gbuf(struct greybus_device *gdev, static struct gbuf *__alloc_gbuf(struct greybus_module *gmod,
struct gdev_cport *cport, struct gmod_cport *cport,
gbuf_complete_t complete, gbuf_complete_t complete,
gfp_t gfp_mask, gfp_t gfp_mask,
void *context) void *context)
...@@ -35,7 +35,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev, ...@@ -35,7 +35,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
return NULL; return NULL;
kref_init(&gbuf->kref); kref_init(&gbuf->kref);
gbuf->gdev = gdev; gbuf->gmod = gmod;
gbuf->cport = cport; gbuf->cport = cport;
gbuf->complete = complete; gbuf->complete = complete;
gbuf->context = context; gbuf->context = context;
...@@ -46,7 +46,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev, ...@@ -46,7 +46,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
/** /**
* greybus_alloc_gbuf - allocate a greybus buffer * greybus_alloc_gbuf - allocate a greybus buffer
* *
* @gdev: greybus device that wants to allocate this * @gmod: greybus device that wants to allocate this
* @cport: cport to send the data to * @cport: cport to send the data to
* @complete: callback when the gbuf is finished with * @complete: callback when the gbuf is finished with
* @size: size of the buffer * @size: size of the buffer
...@@ -58,8 +58,8 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev, ...@@ -58,8 +58,8 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
* that the driver can then fill up with the data to be sent out. Curse * that the driver can then fill up with the data to be sent out. Curse
* hardware designers for this issue... * hardware designers for this issue...
*/ */
struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev, struct gbuf *greybus_alloc_gbuf(struct greybus_module *gmod,
struct gdev_cport *cport, struct gmod_cport *cport,
gbuf_complete_t complete, gbuf_complete_t complete,
unsigned int size, unsigned int size,
gfp_t gfp_mask, gfp_t gfp_mask,
...@@ -68,14 +68,14 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev, ...@@ -68,14 +68,14 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev,
struct gbuf *gbuf; struct gbuf *gbuf;
int retval; int retval;
gbuf = __alloc_gbuf(gdev, cport, complete, gfp_mask, context); gbuf = __alloc_gbuf(gmod, cport, complete, gfp_mask, context);
if (!gbuf) if (!gbuf)
return NULL; return NULL;
gbuf->direction = GBUF_DIRECTION_OUT; gbuf->direction = GBUF_DIRECTION_OUT;
/* Host controller specific allocation for the actual buffer */ /* Host controller specific allocation for the actual buffer */
retval = gbuf->gdev->hd->driver->alloc_gbuf_data(gbuf, size, gfp_mask); retval = gbuf->gmod->hd->driver->alloc_gbuf_data(gbuf, size, gfp_mask);
if (retval) { if (retval) {
greybus_free_gbuf(gbuf); greybus_free_gbuf(gbuf);
return NULL; return NULL;
...@@ -93,7 +93,7 @@ static void free_gbuf(struct kref *kref) ...@@ -93,7 +93,7 @@ static void free_gbuf(struct kref *kref)
/* If the direction is "out" then the host controller frees the data */ /* If the direction is "out" then the host controller frees the data */
if (gbuf->direction == GBUF_DIRECTION_OUT) { if (gbuf->direction == GBUF_DIRECTION_OUT) {
gbuf->gdev->hd->driver->free_gbuf_data(gbuf); gbuf->gmod->hd->driver->free_gbuf_data(gbuf);
} else { } else {
/* we "own" this in data, so free it ourselves */ /* we "own" this in data, so free it ourselves */
kfree(gbuf->transfer_buffer); kfree(gbuf->transfer_buffer);
...@@ -120,7 +120,7 @@ EXPORT_SYMBOL_GPL(greybus_get_gbuf); ...@@ -120,7 +120,7 @@ EXPORT_SYMBOL_GPL(greybus_get_gbuf);
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask) int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
{ {
return gbuf->gdev->hd->driver->submit_gbuf(gbuf, gbuf->gdev->hd, gfp_mask); return gbuf->gmod->hd->driver->submit_gbuf(gbuf, gbuf->gmod->hd, gfp_mask);
} }
int greybus_kill_gbuf(struct gbuf *gbuf) int greybus_kill_gbuf(struct gbuf *gbuf)
...@@ -169,8 +169,8 @@ static void cport_create_event(struct gbuf *gbuf) ...@@ -169,8 +169,8 @@ static void cport_create_event(struct gbuf *gbuf)
#define MAX_CPORTS 1024 #define MAX_CPORTS 1024
struct gb_cport_handler { struct gb_cport_handler {
gbuf_complete_t handler; gbuf_complete_t handler;
struct gdev_cport cport; struct gmod_cport cport;
struct greybus_device *gdev; struct greybus_module *gmod;
void *context; void *context;
}; };
...@@ -178,14 +178,14 @@ static struct gb_cport_handler cport_handler[MAX_CPORTS]; ...@@ -178,14 +178,14 @@ static struct gb_cport_handler cport_handler[MAX_CPORTS];
// FIXME - use a lock for this list of handlers, but really, for now we don't // FIXME - use a lock for this list of handlers, but really, for now we don't
// need it, we don't have a dynamic system... // need it, we don't have a dynamic system...
int gb_register_cport_complete(struct greybus_device *gdev, int gb_register_cport_complete(struct greybus_module *gmod,
gbuf_complete_t handler, int cport, gbuf_complete_t handler, int cport,
void *context) void *context)
{ {
if (cport_handler[cport].handler) if (cport_handler[cport].handler)
return -EINVAL; return -EINVAL;
cport_handler[cport].context = context; cport_handler[cport].context = context;
cport_handler[cport].gdev = gdev; cport_handler[cport].gmod = gmod;
cport_handler[cport].cport.number = cport; cport_handler[cport].cport.number = cport;
cport_handler[cport].handler = handler; cport_handler[cport].handler = handler;
return 0; return 0;
...@@ -212,7 +212,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data, ...@@ -212,7 +212,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
return; return;
} }
gbuf = __alloc_gbuf(ch->gdev, &ch->cport, ch->handler, GFP_ATOMIC, gbuf = __alloc_gbuf(ch->gmod, &ch->cport, ch->handler, GFP_ATOMIC,
ch->context); ch->context);
if (!gbuf) { if (!gbuf) {
/* Again, something bad went wrong, log it... */ /* Again, something bad went wrong, log it... */
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
struct gb_gpio_device { struct gb_gpio_device {
struct gpio_chip chip; struct gpio_chip chip;
struct greybus_device *gdev; struct greybus_module *gmod;
struct gpio_chip *gpio; struct gpio_chip *gpio;
// FIXME - some lock? // FIXME - some lock?
}; };
...@@ -49,18 +49,18 @@ static void gpio_set(struct gpio_chip *gpio, unsigned nr, int val) ...@@ -49,18 +49,18 @@ static void gpio_set(struct gpio_chip *gpio, unsigned nr, int val)
// FIXME - do something there // FIXME - do something there
} }
int gb_gpio_probe(struct greybus_device *gdev, int gb_gpio_probe(struct greybus_module *gmod,
const struct greybus_module_id *id) const struct greybus_module_id *id)
{ {
struct gb_gpio_device *gb_gpio; struct gb_gpio_device *gb_gpio;
struct gpio_chip *gpio; struct gpio_chip *gpio;
struct device *dev = &gdev->dev; struct device *dev = &gmod->dev;
int retval; int retval;
gb_gpio = kzalloc(sizeof(*gb_gpio), GFP_KERNEL); gb_gpio = kzalloc(sizeof(*gb_gpio), GFP_KERNEL);
if (!gb_gpio) if (!gb_gpio)
return -ENOMEM; return -ENOMEM;
gb_gpio->gdev = gdev; gb_gpio->gmod = gmod;
gpio = &gb_gpio->chip; gpio = &gb_gpio->chip;
...@@ -75,7 +75,7 @@ int gb_gpio_probe(struct greybus_device *gdev, ...@@ -75,7 +75,7 @@ int gb_gpio_probe(struct greybus_device *gdev,
gpio->ngpio = 42; // FIXME!!! gpio->ngpio = 42; // FIXME!!!
gpio->can_sleep = false; // FIXME!!! gpio->can_sleep = false; // FIXME!!!
gdev->gb_gpio_dev = gb_gpio; gmod->gb_gpio_dev = gb_gpio;
retval = gpiochip_add(gpio); retval = gpiochip_add(gpio);
if (retval) { if (retval) {
...@@ -86,12 +86,12 @@ int gb_gpio_probe(struct greybus_device *gdev, ...@@ -86,12 +86,12 @@ int gb_gpio_probe(struct greybus_device *gdev,
return 0; return 0;
} }
void gb_gpio_disconnect(struct greybus_device *gdev) void gb_gpio_disconnect(struct greybus_module *gmod)
{ {
struct gb_gpio_device *gb_gpio_dev; struct gb_gpio_device *gb_gpio_dev;
int retval; int retval;
gb_gpio_dev = gdev->gb_gpio_dev; gb_gpio_dev = gmod->gb_gpio_dev;
retval = gpiochip_remove(&gb_gpio_dev->chip); retval = gpiochip_remove(&gb_gpio_dev->chip);
kfree(gb_gpio_dev); kfree(gb_gpio_dev);
......
...@@ -101,14 +101,14 @@ ...@@ -101,14 +101,14 @@
struct gbuf; struct gbuf;
struct gdev_cport { struct gmod_cport {
u16 number; u16 number;
u16 size; u16 size;
u8 speed; // valid??? u8 speed; // valid???
// FIXME, what else? // FIXME, what else?
}; };
struct gdev_string { struct gmod_string {
u16 length; u16 length;
u8 id; u8 id;
u8 string[0]; u8 string[0];
...@@ -120,8 +120,8 @@ struct gbuf { ...@@ -120,8 +120,8 @@ struct gbuf {
struct kref kref; struct kref kref;
void *hdpriv; void *hdpriv;
struct greybus_device *gdev; struct greybus_module *gmod;
struct gdev_cport *cport; struct gmod_cport *cport;
int status; int status;
void *transfer_buffer; void *transfer_buffer;
u32 transfer_flags; /* flags for the transfer buffer */ u32 transfer_flags; /* flags for the transfer buffer */
...@@ -148,7 +148,7 @@ struct gbuf { ...@@ -148,7 +148,7 @@ struct gbuf {
* same module as the gpio pins, etc.) * same module as the gpio pins, etc.)
* *
* So, put the "private" data structures here in greybus.h and link to them off * So, put the "private" data structures here in greybus.h and link to them off
* of the "main" greybus_device structure. * of the "main" greybus_module structure.
*/ */
struct gb_i2c_device; struct gb_i2c_device;
...@@ -195,7 +195,7 @@ void greybus_gbuf_finished(struct gbuf *gbuf); ...@@ -195,7 +195,7 @@ void greybus_gbuf_finished(struct gbuf *gbuf);
#define MAX_CPORTS_PER_MODULE 10 #define MAX_CPORTS_PER_MODULE 10
#define MAX_STRINGS_PER_MODULE 10 #define MAX_STRINGS_PER_MODULE 10
struct greybus_device { struct greybus_module {
struct device dev; struct device dev;
u16 module_number; u16 module_number;
struct greybus_descriptor_function function; struct greybus_descriptor_function function;
...@@ -203,8 +203,8 @@ struct greybus_device { ...@@ -203,8 +203,8 @@ struct greybus_device {
struct greybus_descriptor_serial_number serial_number; struct greybus_descriptor_serial_number serial_number;
int num_cports; int num_cports;
int num_strings; int num_strings;
struct gdev_cport *cport[MAX_CPORTS_PER_MODULE]; struct gmod_cport *cport[MAX_CPORTS_PER_MODULE];
struct gdev_string *string[MAX_STRINGS_PER_MODULE]; struct gmod_string *string[MAX_STRINGS_PER_MODULE];
struct greybus_host_device *hd; struct greybus_host_device *hd;
...@@ -215,10 +215,10 @@ struct greybus_device { ...@@ -215,10 +215,10 @@ struct greybus_device {
struct gb_usb_device *gb_usb_dev; struct gb_usb_device *gb_usb_dev;
struct gb_battery *gb_battery; struct gb_battery *gb_battery;
}; };
#define to_greybus_device(d) container_of(d, struct greybus_device, dev) #define to_greybus_module(d) container_of(d, struct greybus_module, dev)
struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev, struct gbuf *greybus_alloc_gbuf(struct greybus_module *gmod,
struct gdev_cport *cport, struct gmod_cport *cport,
gbuf_complete_t complete, gbuf_complete_t complete,
unsigned int size, unsigned int size,
gfp_t gfp_mask, gfp_t gfp_mask,
...@@ -234,12 +234,12 @@ int greybus_kill_gbuf(struct gbuf *gbuf); ...@@ -234,12 +234,12 @@ int greybus_kill_gbuf(struct gbuf *gbuf);
struct greybus_driver { struct greybus_driver {
const char *name; const char *name;
int (*probe)(struct greybus_device *gdev, int (*probe)(struct greybus_module *gmod,
const struct greybus_module_id *id); const struct greybus_module_id *id);
void (*disconnect)(struct greybus_device *gdev); void (*disconnect)(struct greybus_module *gmod);
int (*suspend)(struct greybus_device *gdev, pm_message_t message); int (*suspend)(struct greybus_module *gmod, pm_message_t message);
int (*resume)(struct greybus_device *gdev); int (*resume)(struct greybus_module *gmod);
const struct greybus_module_id *id_table; const struct greybus_module_id *id_table;
...@@ -247,14 +247,14 @@ struct greybus_driver { ...@@ -247,14 +247,14 @@ struct greybus_driver {
}; };
#define to_greybus_driver(d) container_of(d, struct greybus_driver, driver) #define to_greybus_driver(d) container_of(d, struct greybus_driver, driver)
static inline void greybus_set_drvdata(struct greybus_device *gdev, void *data) static inline void greybus_set_drvdata(struct greybus_module *gmod, void *data)
{ {
dev_set_drvdata(&gdev->dev, data); dev_set_drvdata(&gmod->dev, data);
} }
static inline void *greybus_get_drvdata(struct greybus_device *gdev) static inline void *greybus_get_drvdata(struct greybus_module *gmod)
{ {
return dev_get_drvdata(&gdev->dev); return dev_get_drvdata(&gmod->dev);
} }
/* Don't call these directly, use the module_greybus_driver() macro instead */ /* Don't call these directly, use the module_greybus_driver() macro instead */
...@@ -279,9 +279,9 @@ void greybus_deregister(struct greybus_driver *driver); ...@@ -279,9 +279,9 @@ void greybus_deregister(struct greybus_driver *driver);
int greybus_disabled(void); int greybus_disabled(void);
void greybus_remove_device(struct greybus_device *gdev); void greybus_remove_device(struct greybus_module *gmod);
const u8 *greybus_string(struct greybus_device *gdev, int id); const u8 *greybus_string(struct greybus_module *gmod, int id);
/* Internal functions to gb module, move to internal .h file eventually. */ /* Internal functions to gb module, move to internal .h file eventually. */
...@@ -297,7 +297,7 @@ void gb_debugfs_cleanup(void); ...@@ -297,7 +297,7 @@ void gb_debugfs_cleanup(void);
int gb_gbuf_init(void); int gb_gbuf_init(void);
void gb_gbuf_exit(void); void gb_gbuf_exit(void);
int gb_register_cport_complete(struct greybus_device *gdev, int gb_register_cport_complete(struct greybus_module *gmod,
gbuf_complete_t handler, int cport, gbuf_complete_t handler, int cport,
void *context); void *context);
void gb_deregister_cport_complete(int cport); void gb_deregister_cport_complete(int cport);
...@@ -309,16 +309,16 @@ extern const struct attribute_group *greybus_module_groups[]; ...@@ -309,16 +309,16 @@ extern const struct attribute_group *greybus_module_groups[];
* we have static functions for this, not "dynamic" drivers like we really * we have static functions for this, not "dynamic" drivers like we really
* should in the end. * should in the end.
*/ */
int gb_i2c_probe(struct greybus_device *gdev, const struct greybus_module_id *id); int gb_i2c_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_i2c_disconnect(struct greybus_device *gdev); void gb_i2c_disconnect(struct greybus_module *gmod);
int gb_gpio_probe(struct greybus_device *gdev, const struct greybus_module_id *id); int gb_gpio_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_gpio_disconnect(struct greybus_device *gdev); void gb_gpio_disconnect(struct greybus_module *gmod);
int gb_sdio_probe(struct greybus_device *gdev, const struct greybus_module_id *id); int gb_sdio_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_sdio_disconnect(struct greybus_device *gdev); void gb_sdio_disconnect(struct greybus_module *gmod);
int gb_tty_probe(struct greybus_device *gdev, const struct greybus_module_id *id); int gb_tty_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_tty_disconnect(struct greybus_device *gdev); void gb_tty_disconnect(struct greybus_module *gmod);
int gb_battery_probe(struct greybus_device *gdev, const struct greybus_module_id *id); int gb_battery_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_battery_disconnect(struct greybus_device *gdev); void gb_battery_disconnect(struct greybus_module *gmod);
int gb_tty_init(void); int gb_tty_init(void);
void gb_tty_exit(void); void gb_tty_exit(void);
......
...@@ -19,7 +19,7 @@ struct greybus_module_id { ...@@ -19,7 +19,7 @@ struct greybus_module_id {
__attribute__((aligned(sizeof(kernel_ulong_t)))); __attribute__((aligned(sizeof(kernel_ulong_t))));
}; };
/* Used to match the greybus_device_id */ /* Used to match the greybus_module_id */
#define GREYBUS_DEVICE_ID_MATCH_VENDOR BIT(0) #define GREYBUS_DEVICE_ID_MATCH_VENDOR BIT(0)
#define GREYBUS_DEVICE_ID_MATCH_PRODUCT BIT(1) #define GREYBUS_DEVICE_ID_MATCH_PRODUCT BIT(1)
#define GREYBUS_DEVICE_ID_MATCH_SERIAL BIT(2) #define GREYBUS_DEVICE_ID_MATCH_SERIAL BIT(2)
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
struct gb_i2c_device { struct gb_i2c_device {
struct i2c_adapter *adapter; struct i2c_adapter *adapter;
struct greybus_device *gdev; struct greybus_module *gmod;
}; };
static const struct greybus_module_id id_table[] = { static const struct greybus_module_id id_table[] = {
...@@ -33,10 +33,10 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr, ...@@ -33,10 +33,10 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr,
int size, union i2c_smbus_data *data) int size, union i2c_smbus_data *data)
{ {
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
struct greybus_device *gdev; struct greybus_module *gmod;
gb_i2c_dev = i2c_get_adapdata(adap); gb_i2c_dev = i2c_get_adapdata(adap);
gdev = gb_i2c_dev->gdev; gmod = gb_i2c_dev->gmod;
// FIXME - do the actual work of sending a i2c message here... // FIXME - do the actual work of sending a i2c message here...
switch (size) { switch (size) {
...@@ -50,7 +50,7 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr, ...@@ -50,7 +50,7 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr,
case I2C_SMBUS_BLOCK_PROC_CALL: case I2C_SMBUS_BLOCK_PROC_CALL:
case I2C_SMBUS_I2C_BLOCK_DATA: case I2C_SMBUS_I2C_BLOCK_DATA:
default: default:
dev_err(&gdev->dev, "Unsupported transaction %d\n", size); dev_err(&gmod->dev, "Unsupported transaction %d\n", size);
return -EOPNOTSUPP; return -EOPNOTSUPP;
} }
...@@ -75,7 +75,7 @@ static const struct i2c_algorithm smbus_algorithm = { ...@@ -75,7 +75,7 @@ static const struct i2c_algorithm smbus_algorithm = {
.functionality = i2c_gb_func, .functionality = i2c_gb_func,
}; };
int gb_i2c_probe(struct greybus_device *gdev, int gb_i2c_probe(struct greybus_module *gmod,
const struct greybus_module_id *id) const struct greybus_module_id *id)
{ {
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
...@@ -95,19 +95,19 @@ int gb_i2c_probe(struct greybus_device *gdev, ...@@ -95,19 +95,19 @@ int gb_i2c_probe(struct greybus_device *gdev,
adapter->owner = THIS_MODULE; adapter->owner = THIS_MODULE;
adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adapter->algo = &smbus_algorithm; adapter->algo = &smbus_algorithm;
adapter->dev.parent = &gdev->dev; adapter->dev.parent = &gmod->dev;
adapter->retries = 3; /* we have to pick something... */ adapter->retries = 3; /* we have to pick something... */
snprintf(adapter->name, sizeof(adapter->name), "Greybus i2c adapter"); snprintf(adapter->name, sizeof(adapter->name), "Greybus i2c adapter");
retval = i2c_add_adapter(adapter); retval = i2c_add_adapter(adapter);
if (retval) { if (retval) {
dev_err(&gdev->dev, "Can not add SMBus adapter\n"); dev_err(&gmod->dev, "Can not add SMBus adapter\n");
goto error; goto error;
} }
gb_i2c_dev->gdev = gdev; gb_i2c_dev->gmod = gmod;
gb_i2c_dev->adapter = adapter; gb_i2c_dev->adapter = adapter;
gdev->gb_i2c_dev = gb_i2c_dev; gmod->gb_i2c_dev = gb_i2c_dev;
return 0; return 0;
error: error:
kfree(adapter); kfree(adapter);
...@@ -115,11 +115,11 @@ int gb_i2c_probe(struct greybus_device *gdev, ...@@ -115,11 +115,11 @@ int gb_i2c_probe(struct greybus_device *gdev,
return retval; return retval;
} }
void gb_i2c_disconnect(struct greybus_device *gdev) void gb_i2c_disconnect(struct greybus_module *gmod)
{ {
struct gb_i2c_device *gb_i2c_dev; struct gb_i2c_device *gb_i2c_dev;
gb_i2c_dev = gdev->gb_i2c_dev; gb_i2c_dev = gmod->gb_i2c_dev;
i2c_del_adapter(gb_i2c_dev->adapter); i2c_del_adapter(gb_i2c_dev->adapter);
kfree(gb_i2c_dev->adapter); kfree(gb_i2c_dev->adapter);
kfree(gb_i2c_dev); kfree(gb_i2c_dev);
......
...@@ -45,13 +45,13 @@ static const struct mmc_host_ops gb_sd_ops = { ...@@ -45,13 +45,13 @@ static const struct mmc_host_ops gb_sd_ops = {
.get_ro = gb_sd_get_ro, .get_ro = gb_sd_get_ro,
}; };
int gb_sdio_probe(struct greybus_device *gdev, int gb_sdio_probe(struct greybus_module *gmod,
const struct greybus_module_id *id) const struct greybus_module_id *id)
{ {
struct mmc_host *mmc; struct mmc_host *mmc;
struct gb_sdio_host *host; struct gb_sdio_host *host;
mmc = mmc_alloc_host(sizeof(struct gb_sdio_host), &gdev->dev); mmc = mmc_alloc_host(sizeof(struct gb_sdio_host), &gmod->dev);
if (!mmc) if (!mmc)
return -ENOMEM; return -ENOMEM;
...@@ -61,16 +61,16 @@ int gb_sdio_probe(struct greybus_device *gdev, ...@@ -61,16 +61,16 @@ int gb_sdio_probe(struct greybus_device *gdev,
mmc->ops = &gb_sd_ops; mmc->ops = &gb_sd_ops;
// FIXME - set up size limits we can handle. // FIXME - set up size limits we can handle.
gdev->gb_sdio_host = host; gmod->gb_sdio_host = host;
return 0; return 0;
} }
void gb_sdio_disconnect(struct greybus_device *gdev) void gb_sdio_disconnect(struct greybus_module *gmod)
{ {
struct mmc_host *mmc; struct mmc_host *mmc;
struct gb_sdio_host *host; struct gb_sdio_host *host;
host = gdev->gb_sdio_host; host = gmod->gb_sdio_host;
mmc = host->mmc; mmc = host->mmc;
mmc_remove_host(mmc); mmc_remove_host(mmc);
......
...@@ -26,8 +26,8 @@ static ssize_t function_##field##_show(struct device *dev, \ ...@@ -26,8 +26,8 @@ static ssize_t function_##field##_show(struct device *dev, \
struct device_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
struct greybus_device *gdev = to_greybus_device(dev); \ struct greybus_module *gmod = to_greybus_module(dev); \
return sprintf(buf, "%d\n", gdev->function.field); \ return sprintf(buf, "%d\n", gmod->function.field); \
} \ } \
static DEVICE_ATTR_RO(function_##field) static DEVICE_ATTR_RO(function_##field)
...@@ -49,15 +49,15 @@ static struct attribute *function_attrs[] = { ...@@ -49,15 +49,15 @@ static struct attribute *function_attrs[] = {
static umode_t function_attrs_are_visible(struct kobject *kobj, static umode_t function_attrs_are_visible(struct kobject *kobj,
struct attribute *a, int n) struct attribute *a, int n)
{ {
struct greybus_device *gdev = to_greybus_device(kobj_to_dev(kobj)); struct greybus_module *gmod = to_greybus_module(kobj_to_dev(kobj));
// FIXME - make this a dynamic structure to "know" if it really is here // FIXME - make this a dynamic structure to "know" if it really is here
// or not easier? // or not easier?
if (gdev->function.number || if (gmod->function.number ||
gdev->function.cport || gmod->function.cport ||
gdev->function.class || gmod->function.class ||
gdev->function.subclass || gmod->function.subclass ||
gdev->function.protocol) gmod->function.protocol)
return a->mode; return a->mode;
return 0; return 0;
} }
...@@ -73,8 +73,8 @@ static ssize_t module_##field##_show(struct device *dev, \ ...@@ -73,8 +73,8 @@ static ssize_t module_##field##_show(struct device *dev, \
struct device_attribute *attr, \ struct device_attribute *attr, \
char *buf) \ char *buf) \
{ \ { \
struct greybus_device *gdev = to_greybus_device(dev); \ struct greybus_module *gmod = to_greybus_module(dev); \
return sprintf(buf, "%x\n", gdev->module_id.field); \ return sprintf(buf, "%x\n", gmod->module_id.field); \
} \ } \
static DEVICE_ATTR_RO(module_##field) static DEVICE_ATTR_RO(module_##field)
...@@ -86,10 +86,10 @@ static ssize_t module_vendor_string_show(struct device *dev, ...@@ -86,10 +86,10 @@ static ssize_t module_vendor_string_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct greybus_device *gdev = to_greybus_device(dev); struct greybus_module *gmod = to_greybus_module(dev);
return sprintf(buf, "%s", return sprintf(buf, "%s",
greybus_string(gdev, gdev->module_id.vendor_stringid)); greybus_string(gmod, gmod->module_id.vendor_stringid));
} }
static DEVICE_ATTR_RO(module_vendor_string); static DEVICE_ATTR_RO(module_vendor_string);
...@@ -97,10 +97,10 @@ static ssize_t module_product_string_show(struct device *dev, ...@@ -97,10 +97,10 @@ static ssize_t module_product_string_show(struct device *dev,
struct device_attribute *attr, struct device_attribute *attr,
char *buf) char *buf)
{ {
struct greybus_device *gdev = to_greybus_device(dev); struct greybus_module *gmod = to_greybus_module(dev);
return sprintf(buf, "%s", return sprintf(buf, "%s",
greybus_string(gdev, gdev->module_id.product_stringid)); greybus_string(gmod, gmod->module_id.product_stringid));
} }
static DEVICE_ATTR_RO(module_product_string); static DEVICE_ATTR_RO(module_product_string);
...@@ -116,20 +116,20 @@ static struct attribute *module_attrs[] = { ...@@ -116,20 +116,20 @@ static struct attribute *module_attrs[] = {
static umode_t module_attrs_are_visible(struct kobject *kobj, static umode_t module_attrs_are_visible(struct kobject *kobj,
struct attribute *a, int n) struct attribute *a, int n)
{ {
struct greybus_device *gdev = to_greybus_device(kobj_to_dev(kobj)); struct greybus_module *gmod = to_greybus_module(kobj_to_dev(kobj));
if ((a == &dev_attr_module_vendor_string.attr) && if ((a == &dev_attr_module_vendor_string.attr) &&
(gdev->module_id.vendor_stringid)) (gmod->module_id.vendor_stringid))
return a->mode; return a->mode;
if ((a == &dev_attr_module_product_string.attr) && if ((a == &dev_attr_module_product_string.attr) &&
(gdev->module_id.product_stringid)) (gmod->module_id.product_stringid))
return a->mode; return a->mode;
// FIXME - make this a dynamic structure to "know" if it really is here // FIXME - make this a dynamic structure to "know" if it really is here
// or not easier? // or not easier?
if (gdev->module_id.vendor || if (gmod->module_id.vendor ||
gdev->module_id.product || gmod->module_id.product ||
gdev->module_id.version) gmod->module_id.version)
return a->mode; return a->mode;
return 0; return 0;
} }
...@@ -144,10 +144,10 @@ static struct attribute_group module_attr_grp = { ...@@ -144,10 +144,10 @@ static struct attribute_group module_attr_grp = {
static ssize_t serial_number_show(struct device *dev, static ssize_t serial_number_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct greybus_device *gdev = to_greybus_device(dev); struct greybus_module *gmod = to_greybus_module(dev);
return sprintf(buf, "%llX\n", return sprintf(buf, "%llX\n",
(unsigned long long)le64_to_cpu(gdev->serial_number.serial_number)); (unsigned long long)le64_to_cpu(gmod->serial_number.serial_number));
} }
static DEVICE_ATTR_RO(serial_number); static DEVICE_ATTR_RO(serial_number);
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "greybus.h" #include "greybus.h"
struct test_device { struct test_device {
struct greybus_device *gdev; struct greybus_module *gmod;
}; };
int gb_register_cport_complete(struct greybus_device *gdev, int gb_register_cport_complete(struct greybus_module *gmod,
gbuf_complete_t handler, int cport, gbuf_complete_t handler, int cport,
void *context); void *context);
void gb_deregister_cport_complete(int cport); void gb_deregister_cport_complete(int cport);
......
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
struct gb_tty { struct gb_tty {
struct tty_port port; struct tty_port port;
struct greybus_device *gdev; struct greybus_module *gmod;
int cport; int cport;
unsigned int minor; unsigned int minor;
unsigned char clocal; unsigned char clocal;
...@@ -384,7 +384,7 @@ static const struct tty_operations gb_ops = { ...@@ -384,7 +384,7 @@ static const struct tty_operations gb_ops = {
}; };
int gb_tty_probe(struct greybus_device *gdev, int gb_tty_probe(struct greybus_module *gmod,
const struct greybus_module_id *id) const struct greybus_module_id *id)
{ {
struct gb_tty *gb_tty; struct gb_tty *gb_tty;
...@@ -399,14 +399,14 @@ int gb_tty_probe(struct greybus_device *gdev, ...@@ -399,14 +399,14 @@ int gb_tty_probe(struct greybus_device *gdev,
minor = alloc_minor(gb_tty); minor = alloc_minor(gb_tty);
if (minor < 0) { if (minor < 0) {
if (minor == -ENOSPC) { if (minor == -ENOSPC) {
dev_err(&gdev->dev, "no more free minor numbers\n"); dev_err(&gmod->dev, "no more free minor numbers\n");
return -ENODEV; return -ENODEV;
} }
return minor; return minor;
} }
gb_tty->minor = minor; gb_tty->minor = minor;
gb_tty->gdev = gdev; gb_tty->gmod = gmod;
spin_lock_init(&gb_tty->write_lock); spin_lock_init(&gb_tty->write_lock);
spin_lock_init(&gb_tty->read_lock); spin_lock_init(&gb_tty->read_lock);
init_waitqueue_head(&gb_tty->wioctl); init_waitqueue_head(&gb_tty->wioctl);
...@@ -414,10 +414,10 @@ int gb_tty_probe(struct greybus_device *gdev, ...@@ -414,10 +414,10 @@ int gb_tty_probe(struct greybus_device *gdev,
/* FIXME - allocate gb buffers */ /* FIXME - allocate gb buffers */
gdev->gb_tty = gb_tty; gmod->gb_tty = gb_tty;
tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor, tty_dev = tty_port_register_device(&gb_tty->port, gb_tty_driver, minor,
&gdev->dev); &gmod->dev);
if (IS_ERR(tty_dev)) { if (IS_ERR(tty_dev)) {
retval = PTR_ERR(tty_dev); retval = PTR_ERR(tty_dev);
goto error; goto error;
...@@ -425,14 +425,14 @@ int gb_tty_probe(struct greybus_device *gdev, ...@@ -425,14 +425,14 @@ int gb_tty_probe(struct greybus_device *gdev,
return 0; return 0;
error: error:
gdev->gb_tty = NULL; gmod->gb_tty = NULL;
release_minor(gb_tty); release_minor(gb_tty);
return retval; return retval;
} }
void gb_tty_disconnect(struct greybus_device *gdev) void gb_tty_disconnect(struct greybus_module *gmod)
{ {
struct gb_tty *gb_tty = gdev->gb_tty; struct gb_tty *gb_tty = gmod->gb_tty;
struct tty_struct *tty; struct tty_struct *tty;
if (!gb_tty) if (!gb_tty)
...@@ -442,7 +442,7 @@ void gb_tty_disconnect(struct greybus_device *gdev) ...@@ -442,7 +442,7 @@ void gb_tty_disconnect(struct greybus_device *gdev)
gb_tty->disconnected = true; gb_tty->disconnected = true;
wake_up_all(&gb_tty->wioctl); wake_up_all(&gb_tty->wioctl);
gdev->gb_tty = NULL; gmod->gb_tty = NULL;
mutex_unlock(&gb_tty->mutex); mutex_unlock(&gb_tty->mutex);
tty = tty_port_tty_get(&gb_tty->port); tty = tty_port_tty_get(&gb_tty->port);
......
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