2 * bus.c - barebox driver model
4 * Copyright (c) 2009 Sascha Hauer <s.hauer@pengutronix.de>, Pengutronix
6 * See file CREDITS for list of people who contributed to this
9 * This program is free software; you can redistribute it and/or modify
10 * it under the terms of the GNU General Public License version 2
11 * as published by the Free Software Foundation.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 static int platform_match(struct device_d
*dev
, struct driver_d
*drv
)
27 return strcmp(dev
->name
, drv
->name
) ? -1 : 0;
30 static int platform_probe(struct device_d
*dev
)
32 return dev
->driver
->probe(dev
);
35 static void platform_remove(struct device_d
*dev
)
37 dev
->driver
->remove(dev
);
40 struct bus_type platform_bus
= {
42 .match
= platform_match
,
43 .probe
= platform_probe
,
44 .remove
= platform_remove
,
49 EXPORT_SYMBOL(bus_list
);
51 int bus_register(struct bus_type
*bus
)
53 list_add_tail(&bus
->list
, &bus_list
);