HSI: hsi: Rework hsi_controller release

Use the proper release mechanism for hsi_controller and
hsi_ports structures. Free the structures through their
associated device release callbacks.

Signed-off-by: Carlos Chinea <carlos.chinea@nokia.com>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
This commit is contained in:
Carlos Chinea 2012-04-04 14:11:45 +03:00
parent 66f75a5d02
commit 5a218ceba7
2 changed files with 69 additions and 45 deletions

View file

@ -270,13 +270,13 @@ struct hsi_controller {
struct module *owner;
unsigned int id;
unsigned int num_ports;
struct hsi_port *port;
struct hsi_port **port;
};
#define to_hsi_controller(dev) container_of(dev, struct hsi_controller, device)
struct hsi_controller *hsi_alloc_controller(unsigned int n_ports, gfp_t flags);
void hsi_free_controller(struct hsi_controller *hsi);
void hsi_put_controller(struct hsi_controller *hsi);
int hsi_register_controller(struct hsi_controller *hsi);
void hsi_unregister_controller(struct hsi_controller *hsi);
@ -294,7 +294,7 @@ static inline void *hsi_controller_drvdata(struct hsi_controller *hsi)
static inline struct hsi_port *hsi_find_port_num(struct hsi_controller *hsi,
unsigned int num)
{
return (num < hsi->num_ports) ? &hsi->port[num] : NULL;
return (num < hsi->num_ports) ? hsi->port[num] : NULL;
}
/*