Commit 0f37860d authored by Johan Hovold's avatar Johan Hovold Committed by Greg Kroah-Hartman

greybus: kill the endo

Remove the now unused endo and module code.

Note that the never-implemented serial and version attributes of the
endo can be implemented as svc attributes if needed.
Signed-off-by: default avatarJohan Hovold <johan@hovoldconsulting.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@google.com>
parent dc3da5db
......@@ -2,8 +2,6 @@ greybus-y := core.o \
debugfs.o \
hd.o \
manifest.o \
endo.o \
module.o \
interface.o \
bundle.o \
connection.o \
......
......@@ -78,23 +78,12 @@ static int greybus_module_match(struct device *dev, struct device_driver *drv)
static int greybus_uevent(struct device *dev, struct kobj_uevent_env *env)
{
struct gb_host_device *hd = NULL;
struct gb_module *module = NULL;
struct gb_interface *intf = NULL;
struct gb_bundle *bundle = NULL;
struct gb_svc *svc = NULL;
if (is_gb_endo(dev)) {
/*
* Not much to do for an endo, just fall through, as the
* "default" attributes are good enough for us.
*/
return 0;
}
if (is_gb_host_device(dev)) {
hd = to_gb_host_device(dev);
} else if (is_gb_module(dev)) {
module = to_gb_module(dev);
} else if (is_gb_interface(dev)) {
intf = to_gb_interface(dev);
} else if (is_gb_bundle(dev)) {
......@@ -214,12 +203,6 @@ static int __init gb_init(void)
goto error_operation;
}
retval = gb_endo_init();
if (retval) {
pr_err("gb_endo_init failed (%d)\n", retval);
goto error_endo;
}
retval = gb_control_protocol_init();
if (retval) {
pr_err("gb_control_protocol_init failed\n");
......@@ -245,8 +228,6 @@ static int __init gb_init(void)
error_svc:
gb_control_protocol_exit();
error_control:
gb_endo_exit();
error_endo:
gb_operation_exit();
error_operation:
gb_hd_exit();
......@@ -264,7 +245,6 @@ static void __exit gb_exit(void)
gb_firmware_protocol_exit();
gb_svc_protocol_exit();
gb_control_protocol_exit();
gb_endo_exit();
gb_operation_exit();
gb_hd_exit();
bus_unregister(&greybus_bus_type);
......
This diff is collapsed.
/*
* Greybus endo code
*
* Copyright 2015 Google Inc.
* Copyright 2015 Linaro Ltd.
*
* Released under the GPLv2 only.
*/
#ifndef __ENDO_H
#define __ENDO_H
/* Greybus "public" definitions" */
struct gb_svc_info {
u8 serial_number[10];
u8 version[10];
};
/* Max ribs per Endo size */
#define ENDO_BACK_RIBS_MINI 0x4
#define ENDO_BACK_RIBS_MEDIUM 0x5
#define ENDO_BACK_RIBS_LARGE 0x6
/**
* struct endo_layout - represents front/back ribs of the endo.
*
* @front_ribs: Mask of present ribs in front.
* @left_ribs: Mask of present ribs in back (left).
* @right_ribs: Mask of present ribs in back (right).
* @max_ribs: Max ribs on endo back, possible values defined above.
*/
struct endo_layout {
u8 front_ribs;
u8 left_ribs;
u8 right_ribs;
u8 max_ribs;
};
struct gb_endo {
struct device dev;
struct endo_layout layout;
struct gb_svc_info svc_info;
u16 dev_id;
u16 id;
u8 ap_intf_id;
};
#define to_gb_endo(d) container_of(d, struct gb_endo, dev)
/* Greybus "private" definitions */
struct gb_host_device;
int gb_endo_init(void);
void gb_endo_exit(void);
struct gb_endo *gb_endo_create(struct gb_host_device *hd,
u16 endo_id, u8 ap_intf_id);
void gb_endo_remove(struct gb_endo *endo);
int greybus_endo_setup(struct gb_host_device *hd, u16 endo_id,
u8 ap_intf_id);
u8 endo_get_module_id(struct gb_endo *endo, u8 interface_id);
#endif /* __ENDO_H */
......@@ -26,10 +26,8 @@
#include "greybus_protocols.h"
#include "manifest.h"
#include "hd.h"
#include "endo.h"
#include "svc.h"
#include "firmware.h"
#include "module.h"
#include "control.h"
#include "interface.h"
#include "bundle.h"
......@@ -105,8 +103,6 @@ struct dentry *gb_debugfs_get(void);
extern struct bus_type greybus_bus_type;
extern struct device_type greybus_hd_type;
extern struct device_type greybus_endo_type;
extern struct device_type greybus_module_type;
extern struct device_type greybus_interface_type;
extern struct device_type greybus_bundle_type;
extern struct device_type greybus_svc_type;
......@@ -116,16 +112,6 @@ static inline int is_gb_host_device(const struct device *dev)
return dev->type == &greybus_hd_type;
}
static inline int is_gb_endo(const struct device *dev)
{
return dev->type == &greybus_endo_type;
}
static inline int is_gb_module(const struct device *dev)
{
return dev->type == &greybus_module_type;
}
static inline int is_gb_interface(const struct device *dev)
{
return dev->type == &greybus_interface_type;
......
......@@ -130,13 +130,7 @@ EXPORT_SYMBOL_GPL(gb_hd_add);
void gb_hd_del(struct gb_host_device *hd)
{
/*
* Tear down all interfaces, modules, and the endo that is associated
* with this host controller before freeing the memory associated with
* the host controller.
*/
gb_interfaces_remove(hd);
gb_endo_remove(hd->endo);
gb_connection_destroy(hd->svc_connection);
......
......@@ -40,7 +40,6 @@ struct gb_host_device {
/* Host device buffer constraints */
size_t buffer_size_max;
struct gb_endo *endo;
struct gb_svc *svc;
struct gb_connection *svc_connection;
......
/*
* Greybus module code
*
* Copyright 2014 Google Inc.
* Copyright 2014 Linaro Ltd.
*
* Released under the GPLv2 only.
*/
#include "greybus.h"
/* module sysfs attributes */
static ssize_t epm_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
// FIXME
// Implement something here when we have a working control protocol
return sprintf(buf, "1\n");
}
static ssize_t epm_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size)
{
// FIXME
// Implement something here when we have a working control protocol
return 0;
}
static DEVICE_ATTR_RW(epm);
static ssize_t power_control_show(struct device *dev,
struct device_attribute *addr, char *buf)
{
// FIXME
// Implement something here when we have a working control protocol
return sprintf(buf, "1\n");
}
static ssize_t power_control_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t size)
{
// FIXME
// Implement something here when we have a working control protocol
return 0;
}
static DEVICE_ATTR_RW(power_control);
static ssize_t present_show(struct device *dev,
struct device_attribute *addr, char *buf)
{
// FIXME
// Implement something here when we have a working control protocol
return sprintf(buf, "1\n");
}
static ssize_t present_store(struct device *dev, struct device_attribute *attr,
const char *buf, size_t size)
{
// FIXME
// Implement something here when we have a working control protocol
return 0;
}
static DEVICE_ATTR_RW(present);
static struct attribute *module_attrs[] = {
&dev_attr_epm.attr,
&dev_attr_power_control.attr,
&dev_attr_present.attr,
NULL,
};
ATTRIBUTE_GROUPS(module);
static void gb_module_release(struct device *dev)
{
struct gb_module *module = to_gb_module(dev);
kfree(module);
}
struct device_type greybus_module_type = {
.name = "greybus_module",
.release = gb_module_release,
};
struct module_find {
struct gb_endo *endo;
u8 module_id;
};
static int module_find(struct device *dev, void *data)
{
struct gb_module *module;
struct module_find *find = data;
if (!is_gb_module(dev))
return 0;
module = to_gb_module(dev);
if ((module->module_id == find->module_id) &&
(module->dev.parent == &find->endo->dev))
return 1;
return 0;
}
/*
* Search the list of modules in the system. If one is found, return it, with
* the reference count incremented.
*/
struct gb_module *gb_module_find(struct gb_host_device *hd, u8 module_id)
{
struct device *dev;
struct gb_module *module = NULL;
struct module_find find;
if (!module_id)
return NULL;
find.module_id = module_id;
find.endo = hd->endo;
dev = bus_find_device(&greybus_bus_type, NULL,
&find, module_find);
if (dev)
module = to_gb_module(dev);
return module;
}
struct gb_module *gb_module_create(struct device *parent, u8 module_id)
{
struct gb_module *module;
int retval;
module = kzalloc(sizeof(*module), GFP_KERNEL);
if (!module)
return NULL;
module->module_id = module_id;
module->dev.parent = parent;
module->dev.bus = &greybus_bus_type;
module->dev.type = &greybus_module_type;
module->dev.groups = module_groups;
module->dev.dma_mask = parent->dma_mask;
device_initialize(&module->dev);
dev_set_name(&module->dev, "%s:%hhu", dev_name(parent), module_id);
retval = device_add(&module->dev);
if (retval) {
pr_err("failed to add module device for id 0x%02hhx\n",
module_id);
put_device(&module->dev);
return NULL;
}
return module;
}
static int module_remove(struct device *dev, void *data)
{
struct gb_module *module;
struct gb_endo *endo = data;
if (!is_gb_module(dev))
return 0;
module = to_gb_module(dev);
if (module->dev.parent == &endo->dev)
device_unregister(&module->dev);
return 0;
}
void gb_module_remove_all(struct gb_endo *endo)
{
bus_for_each_dev(&greybus_bus_type, NULL, endo, module_remove);
}
/*
* Greybus module code
*
* Copyright 2014 Google Inc.
*
* Released under the GPLv2 only.
*/
#ifndef __MODULE_H
#define __MODULE_H
/* Greybus "public" definitions" */
struct gb_module {
struct device dev;
u8 module_id; /* Physical location within the Endo */
};
#define to_gb_module(d) container_of(d, struct gb_module, dev)
struct gb_host_device;
/* Greybus "private" definitions */
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);
void gb_module_remove_all(struct gb_endo *endo);
#endif /* __MODULE_H */
......@@ -310,14 +310,9 @@ static int gb_svc_hello(struct gb_operation *op)
{
struct gb_connection *connection = op->connection;
struct gb_svc *svc = connection->private;
struct gb_host_device *hd = connection->hd;
struct gb_svc_hello_request *hello_request;
int ret;
/*
* SVC sends information about the endo and interface-id on the hello
* request, use that to create an endo.
*/
if (op->request->payload_size < sizeof(*hello_request)) {
dev_warn(&svc->dev, "short hello request (%zu < %zu)\n",
op->request->payload_size,
......@@ -335,11 +330,6 @@ static int gb_svc_hello(struct gb_operation *op)
return ret;
}
/* Setup Endo */
ret = greybus_endo_setup(hd, svc->endo_id, svc->ap_intf_id);
if (ret)
return ret;
return 0;
}
......
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