static int greybus_match_one_id(struct greybus_module *gmod,
const struct greybus_module_id *id)
{
- struct greybus_descriptor_module_id *module_id;
+ struct greybus_descriptor_module *module;
struct greybus_descriptor_serial_number *serial_num;
- module_id = &gmod->module_id;
+ module = &gmod->module;
serial_num = &gmod->serial_number;
if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_VENDOR) &&
- (id->vendor != le16_to_cpu(module_id->vendor)))
+ (id->vendor != le16_to_cpu(module->vendor)))
return 0;
if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_PRODUCT) &&
- (id->product != le16_to_cpu(module_id->product)))
+ (id->product != le16_to_cpu(module->product)))
return 0;
if ((id->match_flags & GREYBUS_DEVICE_ID_MATCH_SERIAL) &&
return 0;
}
-static int create_module_id(struct greybus_module *gmod,
- struct greybus_descriptor_module_id *module_id,
+static int create_module(struct greybus_module *gmod,
+ struct greybus_descriptor_module *module,
size_t desc_size)
{
- if (desc_size != sizeof(*module_id)) {
+ if (desc_size != sizeof(*module)) {
dev_err(gmod->dev.parent, "invalid module header size %zu\n",
desc_size);
return -EINVAL;
}
- memcpy(&gmod->module_id, module_id, desc_size);
+ memcpy(&gmod->module, module, desc_size);
return 0;
}
data_size);
break;
- case GREYBUS_TYPE_MODULE_ID:
- retval = create_module_id(gmod, &desc->module_id,
+ case GREYBUS_TYPE_MODULE:
+ retval = create_module(gmod, &desc->module,
data_size);
break;
struct device dev;
u16 module_number;
struct greybus_descriptor_function function;
- struct greybus_descriptor_module_id module_id;
+ struct greybus_descriptor_module module;
struct greybus_descriptor_serial_number serial_number;
int num_cports;
int num_strings;
enum greybus_descriptor_type {
GREYBUS_TYPE_INVALID = 0x0000,
GREYBUS_TYPE_FUNCTION = 0x0001,
- GREYBUS_TYPE_MODULE_ID = 0x0002,
+ GREYBUS_TYPE_MODULE = 0x0002,
GREYBUS_TYPE_SERIAL_NUMBER = 0x0003,
GREYBUS_TYPE_STRING = 0x0004,
GREYBUS_TYPE_CPORT = 0x0005,
__u8 reserved;
};
-struct greybus_descriptor_module_id {
+struct greybus_descriptor_module {
__le16 vendor;
__le16 product;
__le16 version;
struct greybus_descriptor_header header;
union {
struct greybus_descriptor_function function;
- struct greybus_descriptor_module_id module_id;
+ struct greybus_descriptor_module module;
struct greybus_descriptor_serial_number serial_number;
struct greybus_descriptor_string string;
struct greybus_descriptor_cport cport;
char *buf) \
{ \
struct greybus_module *gmod = to_greybus_module(dev); \
- return sprintf(buf, "%x\n", gmod->module_id.field); \
+ return sprintf(buf, "%x\n", gmod->module.field); \
} \
static DEVICE_ATTR_RO(module_##field)
struct greybus_module *gmod = to_greybus_module(dev);
return sprintf(buf, "%s",
- greybus_string(gmod, gmod->module_id.vendor_stringid));
+ greybus_string(gmod, gmod->module.vendor_stringid));
}
static DEVICE_ATTR_RO(module_vendor_string);
struct greybus_module *gmod = to_greybus_module(dev);
return sprintf(buf, "%s",
- greybus_string(gmod, gmod->module_id.product_stringid));
+ greybus_string(gmod, gmod->module.product_stringid));
}
static DEVICE_ATTR_RO(module_product_string);
struct greybus_module *gmod = to_greybus_module(kobj_to_dev(kobj));
if ((a == &dev_attr_module_vendor_string.attr) &&
- (gmod->module_id.vendor_stringid))
+ (gmod->module.vendor_stringid))
return a->mode;
if ((a == &dev_attr_module_product_string.attr) &&
- (gmod->module_id.product_stringid))
+ (gmod->module.product_stringid))
return a->mode;
// FIXME - make this a dynamic structure to "know" if it really is here
// or not easier?
- if (gmod->module_id.vendor ||
- gmod->module_id.product ||
- gmod->module_id.version)
+ if (gmod->module.vendor ||
+ gmod->module.product ||
+ gmod->module.version)
return a->mode;
return 0;
}