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 {
// 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
// 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)
......@@ -100,7 +100,7 @@ static enum power_supply_property battery_props[] = {
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)
{
struct gb_battery *gb;
......@@ -120,21 +120,21 @@ int gb_battery_probe(struct greybus_device *gdev,
b->num_properties = ARRAY_SIZE(battery_props),
b->get_property = get_property,
retval = power_supply_register(&gdev->dev, b);
retval = power_supply_register(&gmod->dev, b);
if (retval) {
kfree(gb);
return retval;
}
gdev->gb_battery = gb;
gmod->gb_battery = gb;
return 0;
}
void gb_battery_disconnect(struct greybus_device *gdev)
void gb_battery_disconnect(struct greybus_module *gmod)
{
struct gb_battery *gb;
gb = gdev->gb_battery;
gb = gmod->gb_battery;
power_supply_unregister(&gb->bat);
......
This diff is collapsed.
......@@ -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)
{
struct es1_ap_dev *es1 = hd_to_es1(gbuf->gdev->hd);
struct es1_ap_dev *es1 = hd_to_es1(gbuf->gmod->hd);
u8 *buffer;
if (size > ES1_GBUF_MSG_SIZE) {
......
......@@ -22,8 +22,8 @@
static struct kmem_cache *gbuf_head_cache;
static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
struct gdev_cport *cport,
static struct gbuf *__alloc_gbuf(struct greybus_module *gmod,
struct gmod_cport *cport,
gbuf_complete_t complete,
gfp_t gfp_mask,
void *context)
......@@ -35,7 +35,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
return NULL;
kref_init(&gbuf->kref);
gbuf->gdev = gdev;
gbuf->gmod = gmod;
gbuf->cport = cport;
gbuf->complete = complete;
gbuf->context = context;
......@@ -46,7 +46,7 @@ static struct gbuf *__alloc_gbuf(struct greybus_device *gdev,
/**
* 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
* @complete: callback when the gbuf is finished with
* @size: size of the buffer
......@@ -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
* hardware designers for this issue...
*/
struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev,
struct gdev_cport *cport,
struct gbuf *greybus_alloc_gbuf(struct greybus_module *gmod,
struct gmod_cport *cport,
gbuf_complete_t complete,
unsigned int size,
gfp_t gfp_mask,
......@@ -68,14 +68,14 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_device *gdev,
struct gbuf *gbuf;
int retval;
gbuf = __alloc_gbuf(gdev, cport, complete, gfp_mask, context);
gbuf = __alloc_gbuf(gmod, cport, complete, gfp_mask, context);
if (!gbuf)
return NULL;
gbuf->direction = GBUF_DIRECTION_OUT;
/* 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) {
greybus_free_gbuf(gbuf);
return NULL;
......@@ -93,7 +93,7 @@ static void free_gbuf(struct kref *kref)
/* If the direction is "out" then the host controller frees the data */
if (gbuf->direction == GBUF_DIRECTION_OUT) {
gbuf->gdev->hd->driver->free_gbuf_data(gbuf);
gbuf->gmod->hd->driver->free_gbuf_data(gbuf);
} else {
/* we "own" this in data, so free it ourselves */
kfree(gbuf->transfer_buffer);
......@@ -120,7 +120,7 @@ EXPORT_SYMBOL_GPL(greybus_get_gbuf);
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)
......@@ -169,8 +169,8 @@ static void cport_create_event(struct gbuf *gbuf)
#define MAX_CPORTS 1024
struct gb_cport_handler {
gbuf_complete_t handler;
struct gdev_cport cport;
struct greybus_device *gdev;
struct gmod_cport cport;
struct greybus_module *gmod;
void *context;
};
......@@ -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
// 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,
void *context)
{
if (cport_handler[cport].handler)
return -EINVAL;
cport_handler[cport].context = context;
cport_handler[cport].gdev = gdev;
cport_handler[cport].gmod = gmod;
cport_handler[cport].cport.number = cport;
cport_handler[cport].handler = handler;
return 0;
......@@ -212,7 +212,7 @@ void greybus_cport_in_data(struct greybus_host_device *hd, int cport, u8 *data,
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);
if (!gbuf) {
/* Again, something bad went wrong, log it... */
......
......@@ -14,7 +14,7 @@
struct gb_gpio_device {
struct gpio_chip chip;
struct greybus_device *gdev;
struct greybus_module *gmod;
struct gpio_chip *gpio;
// FIXME - some lock?
};
......@@ -49,18 +49,18 @@ static void gpio_set(struct gpio_chip *gpio, unsigned nr, int val)
// 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)
{
struct gb_gpio_device *gb_gpio;
struct gpio_chip *gpio;
struct device *dev = &gdev->dev;
struct device *dev = &gmod->dev;
int retval;
gb_gpio = kzalloc(sizeof(*gb_gpio), GFP_KERNEL);
if (!gb_gpio)
return -ENOMEM;
gb_gpio->gdev = gdev;
gb_gpio->gmod = gmod;
gpio = &gb_gpio->chip;
......@@ -75,7 +75,7 @@ int gb_gpio_probe(struct greybus_device *gdev,
gpio->ngpio = 42; // FIXME!!!
gpio->can_sleep = false; // FIXME!!!
gdev->gb_gpio_dev = gb_gpio;
gmod->gb_gpio_dev = gb_gpio;
retval = gpiochip_add(gpio);
if (retval) {
......@@ -86,12 +86,12 @@ int gb_gpio_probe(struct greybus_device *gdev,
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;
int retval;
gb_gpio_dev = gdev->gb_gpio_dev;
gb_gpio_dev = gmod->gb_gpio_dev;
retval = gpiochip_remove(&gb_gpio_dev->chip);
kfree(gb_gpio_dev);
......
......@@ -101,14 +101,14 @@
struct gbuf;
struct gdev_cport {
struct gmod_cport {
u16 number;
u16 size;
u8 speed; // valid???
// FIXME, what else?
};
struct gdev_string {
struct gmod_string {
u16 length;
u8 id;
u8 string[0];
......@@ -120,8 +120,8 @@ struct gbuf {
struct kref kref;
void *hdpriv;
struct greybus_device *gdev;
struct gdev_cport *cport;
struct greybus_module *gmod;
struct gmod_cport *cport;
int status;
void *transfer_buffer;
u32 transfer_flags; /* flags for the transfer buffer */
......@@ -148,7 +148,7 @@ struct gbuf {
* same module as the gpio pins, etc.)
*
* 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;
......@@ -195,7 +195,7 @@ void greybus_gbuf_finished(struct gbuf *gbuf);
#define MAX_CPORTS_PER_MODULE 10
#define MAX_STRINGS_PER_MODULE 10
struct greybus_device {
struct greybus_module {
struct device dev;
u16 module_number;
struct greybus_descriptor_function function;
......@@ -203,8 +203,8 @@ struct greybus_device {
struct greybus_descriptor_serial_number serial_number;
int num_cports;
int num_strings;
struct gdev_cport *cport[MAX_CPORTS_PER_MODULE];
struct gdev_string *string[MAX_STRINGS_PER_MODULE];
struct gmod_cport *cport[MAX_CPORTS_PER_MODULE];
struct gmod_string *string[MAX_STRINGS_PER_MODULE];
struct greybus_host_device *hd;
......@@ -215,10 +215,10 @@ struct greybus_device {
struct gb_usb_device *gb_usb_dev;
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 gdev_cport *cport,
struct gbuf *greybus_alloc_gbuf(struct greybus_module *gmod,
struct gmod_cport *cport,
gbuf_complete_t complete,
unsigned int size,
gfp_t gfp_mask,
......@@ -234,12 +234,12 @@ int greybus_kill_gbuf(struct gbuf *gbuf);
struct greybus_driver {
const char *name;
int (*probe)(struct greybus_device *gdev,
int (*probe)(struct greybus_module *gmod,
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 (*resume)(struct greybus_device *gdev);
int (*suspend)(struct greybus_module *gmod, pm_message_t message);
int (*resume)(struct greybus_module *gmod);
const struct greybus_module_id *id_table;
......@@ -247,14 +247,14 @@ struct greybus_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 */
......@@ -279,9 +279,9 @@ void greybus_deregister(struct greybus_driver *driver);
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. */
......@@ -297,7 +297,7 @@ void gb_debugfs_cleanup(void);
int gb_gbuf_init(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,
void *context);
void gb_deregister_cport_complete(int cport);
......@@ -309,16 +309,16 @@ extern const struct attribute_group *greybus_module_groups[];
* we have static functions for this, not "dynamic" drivers like we really
* should in the end.
*/
int gb_i2c_probe(struct greybus_device *gdev, const struct greybus_module_id *id);
void gb_i2c_disconnect(struct greybus_device *gdev);
int gb_gpio_probe(struct greybus_device *gdev, const struct greybus_module_id *id);
void gb_gpio_disconnect(struct greybus_device *gdev);
int gb_sdio_probe(struct greybus_device *gdev, const struct greybus_module_id *id);
void gb_sdio_disconnect(struct greybus_device *gdev);
int gb_tty_probe(struct greybus_device *gdev, const struct greybus_module_id *id);
void gb_tty_disconnect(struct greybus_device *gdev);
int gb_battery_probe(struct greybus_device *gdev, const struct greybus_module_id *id);
void gb_battery_disconnect(struct greybus_device *gdev);
int gb_i2c_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_i2c_disconnect(struct greybus_module *gmod);
int gb_gpio_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_gpio_disconnect(struct greybus_module *gmod);
int gb_sdio_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_sdio_disconnect(struct greybus_module *gmod);
int gb_tty_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_tty_disconnect(struct greybus_module *gmod);
int gb_battery_probe(struct greybus_module *gmod, const struct greybus_module_id *id);
void gb_battery_disconnect(struct greybus_module *gmod);
int gb_tty_init(void);
void gb_tty_exit(void);
......
......@@ -19,7 +19,7 @@ struct greybus_module_id {
__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_PRODUCT BIT(1)
#define GREYBUS_DEVICE_ID_MATCH_SERIAL BIT(2)
......
......@@ -14,7 +14,7 @@
struct gb_i2c_device {
struct i2c_adapter *adapter;
struct greybus_device *gdev;
struct greybus_module *gmod;
};
static const struct greybus_module_id id_table[] = {
......@@ -33,10 +33,10 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr,
int size, union i2c_smbus_data *data)
{
struct gb_i2c_device *gb_i2c_dev;
struct greybus_device *gdev;
struct greybus_module *gmod;
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...
switch (size) {
......@@ -50,7 +50,7 @@ static s32 i2c_gb_access(struct i2c_adapter *adap, u16 addr,
case I2C_SMBUS_BLOCK_PROC_CALL:
case I2C_SMBUS_I2C_BLOCK_DATA:
default:
dev_err(&gdev->dev, "Unsupported transaction %d\n", size);
dev_err(&gmod->dev, "Unsupported transaction %d\n", size);
return -EOPNOTSUPP;
}
......@@ -75,7 +75,7 @@ static const struct i2c_algorithm smbus_algorithm = {
.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)
{
struct gb_i2c_device *gb_i2c_dev;
......@@ -95,19 +95,19 @@ int gb_i2c_probe(struct greybus_device *gdev,
adapter->owner = THIS_MODULE;
adapter->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
adapter->algo = &smbus_algorithm;
adapter->dev.parent = &gdev->dev;
adapter->dev.parent = &gmod->dev;
adapter->retries = 3; /* we have to pick something... */
snprintf(adapter->name, sizeof(adapter->name), "Greybus i2c adapter");
retval = i2c_add_adapter(adapter);
if (retval) {
dev_err(&gdev->dev, "Can not add SMBus adapter\n");
dev_err(&gmod->dev, "Can not add SMBus adapter\n");
goto error;
}
gb_i2c_dev->gdev = gdev;
gb_i2c_dev->gmod = gmod;
gb_i2c_dev->adapter = adapter;
gdev->gb_i2c_dev = gb_i2c_dev;
gmod->gb_i2c_dev = gb_i2c_dev;
return 0;
error:
kfree(adapter);
......@@ -115,11 +115,11 @@ int gb_i2c_probe(struct greybus_device *gdev,
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;
gb_i2c_dev = gdev->gb_i2c_dev;
gb_i2c_dev = gmod->gb_i2c_dev;
i2c_del_adapter(gb_i2c_dev->adapter);
kfree(gb_i2c_dev->adapter);
kfree(gb_i2c_dev);
......
......@@ -45,13 +45,13 @@ static const struct mmc_host_ops gb_sd_ops = {
.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)
{
struct mmc_host *mmc;
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)
return -ENOMEM;
......@@ -61,16 +61,16 @@ int gb_sdio_probe(struct greybus_device *gdev,
mmc->ops = &gb_sd_ops;
// FIXME - set up size limits we can handle.
gdev->gb_sdio_host = host;
gmod->gb_sdio_host = host;
return 0;
}
void gb_sdio_disconnect(struct greybus_device *gdev)
void gb_sdio_disconnect(struct greybus_module *gmod)
{
struct mmc_host *mmc;
struct gb_sdio_host *host;
host = gdev->gb_sdio_host;
host = gmod->gb_sdio_host;
mmc = host->mmc;
mmc_remove_host(mmc);
......
......@@ -26,8 +26,8 @@ static ssize_t function_##field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct greybus_device *gdev = to_greybus_device(dev); \
return sprintf(buf, "%d\n", gdev->function.field); \
struct greybus_module *gmod = to_greybus_module(dev); \
return sprintf(buf, "%d\n", gmod->function.field); \
} \
static DEVICE_ATTR_RO(function_##field)
......@@ -49,15 +49,15 @@ static struct attribute *function_attrs[] = {
static umode_t function_attrs_are_visible(struct kobject *kobj,
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
// or not easier?
if (gdev->function.number ||
gdev->function.cport ||
gdev->function.class ||
gdev->function.subclass ||
gdev->function.protocol)
if (gmod->function.number ||
gmod->function.cport ||
gmod->function.class ||
gmod->function.subclass ||
gmod->function.protocol)
return a->mode;
return 0;
}
......@@ -73,8 +73,8 @@ static ssize_t module_##field##_show(struct device *dev, \
struct device_attribute *attr, \
char *buf) \
{ \
struct greybus_device *gdev = to_greybus_device(dev); \
return sprintf(buf, "%x\n", gdev->module_id.field); \
struct greybus_module *gmod = to_greybus_module(dev); \
return sprintf(buf, "%x\n", gmod->module_id.field); \
} \
static DEVICE_ATTR_RO(module_##field)
......@@ -86,10 +86,10 @@ static ssize_t module_vendor_string_show(struct device *dev,
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, "%s",
greybus_string(gdev, gdev->module_id.vendor_stringid));
greybus_string(gmod, gmod->module_id.vendor_stringid));
}
static DEVICE_ATTR_RO(module_vendor_string);
......@@ -97,10 +97,10 @@ static ssize_t module_product_string_show(struct device *dev,
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, "%s",
greybus_string(gdev, gdev->module_id.product_stringid));
greybus_string(gmod, gmod->module_id.product_stringid));
}
static DEVICE_ATTR_RO(module_product_string);
......@@ -116,20 +116,20 @@ static struct attribute *module_attrs[] = {
static umode_t module_attrs_are_visible(struct kobject *kobj,
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) &&
(gdev->module_id.vendor_stringid))
(gmod->module_id.vendor_stringid))
return a->mode;
if ((a == &dev_attr_module_product_string.attr) &&
(gdev->module_id.product_stringid))
(gmod->module_id.product_stringid))
return a->mode;
// FIXME - make this a dynamic structure to "know" if it really is here
// or not easier?
if (gdev->module_id.vendor ||
gdev->module_id.product ||
gdev->module_id.version)
if (gmod->module_id.vendor ||
gmod->module_id.product ||
gmod->module_id.version)
return a->mode;
return 0;
}
......@@ -144,10 +144,10 @@ static struct attribute_group module_attr_grp = {
static ssize_t serial_number_show(struct device *dev,
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",
(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);
......
......@@ -12,10 +12,10 @@
#include "greybus.h"
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,
void *context);
void gb_deregister_cport_complete(int cport);
......
......@@ -33,7 +33,7 @@
struct gb_tty {
struct tty_port port;
struct greybus_device *gdev;
struct greybus_module *gmod;
int cport;
unsigned int minor;
unsigned char clocal;
......@@ -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)
{
struct gb_tty *gb_tty;
......@@ -399,14 +399,14 @@ int gb_tty_probe(struct greybus_device *gdev,
minor = alloc_minor(gb_tty);
if (minor < 0) {
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 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->read_lock);
init_waitqueue_head(&gb_tty->wioctl);
......@@ -414,10 +414,10 @@ int gb_tty_probe(struct greybus_device *gdev,
/* 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,
&gdev->dev);
&gmod->dev);
if (IS_ERR(tty_dev)) {
retval = PTR_ERR(tty_dev);
goto error;
......@@ -425,14 +425,14 @@ int gb_tty_probe(struct greybus_device *gdev,
return 0;
error:
gdev->gb_tty = NULL;
gmod->gb_tty = NULL;
release_minor(gb_tty);
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;
if (!gb_tty)
......@@ -442,7 +442,7 @@ void gb_tty_disconnect(struct greybus_device *gdev)
gb_tty->disconnected = true;
wake_up_all(&gb_tty->wioctl);
gdev->gb_tty = NULL;
gmod->gb_tty = NULL;
mutex_unlock(&gb_tty->mutex);
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