2019-06-01 08:08:55 +00:00
|
|
|
// SPDX-License-Identifier: GPL-2.0-only
|
2014-02-26 16:29:05 +00:00
|
|
|
/*
|
|
|
|
* MEN Chameleon Bus.
|
|
|
|
*
|
|
|
|
* Copyright (C) 2013 MEN Mikroelektronik GmbH (www.men.de)
|
|
|
|
* Author: Johannes Thumshirn <johannes.thumshirn@men.de>
|
|
|
|
*/
|
|
|
|
#include <linux/kernel.h>
|
|
|
|
#include <linux/module.h>
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <linux/idr.h>
|
|
|
|
#include <linux/mcb.h>
|
|
|
|
|
|
|
|
static DEFINE_IDA(mcb_ida);
|
|
|
|
|
|
|
|
static const struct mcb_device_id *mcb_match_id(const struct mcb_device_id *ids,
|
|
|
|
struct mcb_device *dev)
|
|
|
|
{
|
|
|
|
if (ids) {
|
|
|
|
while (ids->device) {
|
|
|
|
if (ids->device == dev->id)
|
|
|
|
return ids;
|
|
|
|
ids++;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2024-07-01 12:07:37 +00:00
|
|
|
static int mcb_match(struct device *dev, const struct device_driver *drv)
|
2014-02-26 16:29:05 +00:00
|
|
|
{
|
2024-07-01 12:07:37 +00:00
|
|
|
const struct mcb_driver *mdrv = to_mcb_driver(drv);
|
2014-02-26 16:29:05 +00:00
|
|
|
struct mcb_device *mdev = to_mcb_device(dev);
|
|
|
|
const struct mcb_device_id *found_id;
|
|
|
|
|
|
|
|
found_id = mcb_match_id(mdrv->id_table, mdev);
|
|
|
|
if (found_id)
|
|
|
|
return 1;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
2023-01-11 11:30:17 +00:00
|
|
|
static int mcb_uevent(const struct device *dev, struct kobj_uevent_env *env)
|
2014-02-26 16:29:05 +00:00
|
|
|
{
|
2023-01-11 11:30:17 +00:00
|
|
|
const struct mcb_device *mdev = to_mcb_device(dev);
|
2014-02-26 16:29:05 +00:00
|
|
|
int ret;
|
|
|
|
|
|
|
|
ret = add_uevent_var(env, "MODALIAS=mcb:16z%03d", mdev->id);
|
|
|
|
if (ret)
|
|
|
|
return -ENOMEM;
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static int mcb_probe(struct device *dev)
|
|
|
|
{
|
|
|
|
struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
|
|
|
|
struct mcb_device *mdev = to_mcb_device(dev);
|
|
|
|
const struct mcb_device_id *found_id;
|
2016-05-10 10:39:45 +00:00
|
|
|
struct module *carrier_mod;
|
|
|
|
int ret;
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
found_id = mcb_match_id(mdrv->id_table, mdev);
|
|
|
|
if (!found_id)
|
|
|
|
return -ENODEV;
|
|
|
|
|
2016-05-10 10:39:45 +00:00
|
|
|
carrier_mod = mdev->dev.parent->driver->owner;
|
|
|
|
if (!try_module_get(carrier_mod))
|
|
|
|
return -EINVAL;
|
|
|
|
|
2016-05-10 10:39:44 +00:00
|
|
|
get_device(dev);
|
2016-05-10 10:39:45 +00:00
|
|
|
ret = mdrv->probe(mdev, found_id);
|
2022-12-02 09:38:49 +00:00
|
|
|
if (ret) {
|
2016-05-10 10:39:45 +00:00
|
|
|
module_put(carrier_mod);
|
2022-12-02 09:38:49 +00:00
|
|
|
put_device(dev);
|
|
|
|
}
|
2016-05-10 10:39:45 +00:00
|
|
|
|
|
|
|
return ret;
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
|
|
|
|
2021-07-13 19:35:22 +00:00
|
|
|
static void mcb_remove(struct device *dev)
|
2014-02-26 16:29:05 +00:00
|
|
|
{
|
|
|
|
struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
|
|
|
|
struct mcb_device *mdev = to_mcb_device(dev);
|
2016-05-10 10:39:45 +00:00
|
|
|
struct module *carrier_mod;
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
mdrv->remove(mdev);
|
|
|
|
|
2016-05-10 10:39:45 +00:00
|
|
|
carrier_mod = mdev->dev.parent->driver->owner;
|
|
|
|
module_put(carrier_mod);
|
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
put_device(&mdev->dev);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mcb_shutdown(struct device *dev)
|
|
|
|
{
|
2016-05-03 10:42:03 +00:00
|
|
|
struct mcb_driver *mdrv = to_mcb_driver(dev->driver);
|
2014-02-26 16:29:05 +00:00
|
|
|
struct mcb_device *mdev = to_mcb_device(dev);
|
|
|
|
|
|
|
|
if (mdrv && mdrv->shutdown)
|
|
|
|
mdrv->shutdown(mdev);
|
|
|
|
}
|
|
|
|
|
2016-05-03 07:46:23 +00:00
|
|
|
static ssize_t revision_show(struct device *dev, struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
|
|
|
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%d\n", bus->revision);
|
|
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(revision);
|
|
|
|
|
|
|
|
static ssize_t model_show(struct device *dev, struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
|
|
|
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%c\n", bus->model);
|
|
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(model);
|
|
|
|
|
|
|
|
static ssize_t minor_show(struct device *dev, struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
|
|
|
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%d\n", bus->minor);
|
|
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(minor);
|
|
|
|
|
|
|
|
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
|
|
|
|
char *buf)
|
|
|
|
{
|
|
|
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
|
|
|
|
|
|
|
return scnprintf(buf, PAGE_SIZE, "%s\n", bus->name);
|
|
|
|
}
|
|
|
|
static DEVICE_ATTR_RO(name);
|
|
|
|
|
|
|
|
static struct attribute *mcb_bus_attrs[] = {
|
|
|
|
&dev_attr_revision.attr,
|
|
|
|
&dev_attr_model.attr,
|
|
|
|
&dev_attr_minor.attr,
|
|
|
|
&dev_attr_name.attr,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct attribute_group mcb_carrier_group = {
|
|
|
|
.attrs = mcb_bus_attrs,
|
|
|
|
};
|
|
|
|
|
|
|
|
static const struct attribute_group *mcb_carrier_groups[] = {
|
|
|
|
&mcb_carrier_group,
|
|
|
|
NULL,
|
|
|
|
};
|
|
|
|
|
|
|
|
|
2024-02-27 11:40:29 +00:00
|
|
|
static const struct bus_type mcb_bus_type = {
|
2014-02-26 16:29:05 +00:00
|
|
|
.name = "mcb",
|
|
|
|
.match = mcb_match,
|
|
|
|
.uevent = mcb_uevent,
|
|
|
|
.probe = mcb_probe,
|
|
|
|
.remove = mcb_remove,
|
|
|
|
.shutdown = mcb_shutdown,
|
|
|
|
};
|
|
|
|
|
2024-02-19 19:52:00 +00:00
|
|
|
static const struct device_type mcb_carrier_device_type = {
|
2016-05-03 07:46:23 +00:00
|
|
|
.name = "mcb-carrier",
|
|
|
|
.groups = mcb_carrier_groups,
|
|
|
|
};
|
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
/**
|
|
|
|
* __mcb_register_driver() - Register a @mcb_driver at the system
|
|
|
|
* @drv: The @mcb_driver
|
|
|
|
* @owner: The @mcb_driver's module
|
|
|
|
* @mod_name: The name of the @mcb_driver's module
|
|
|
|
*
|
|
|
|
* Register a @mcb_driver at the system. Perform some sanity checks, if
|
|
|
|
* the .probe and .remove methods are provided by the driver.
|
|
|
|
*/
|
|
|
|
int __mcb_register_driver(struct mcb_driver *drv, struct module *owner,
|
|
|
|
const char *mod_name)
|
|
|
|
{
|
|
|
|
if (!drv->probe || !drv->remove)
|
|
|
|
return -EINVAL;
|
|
|
|
|
|
|
|
drv->driver.owner = owner;
|
|
|
|
drv->driver.bus = &mcb_bus_type;
|
|
|
|
drv->driver.mod_name = mod_name;
|
|
|
|
|
|
|
|
return driver_register(&drv->driver);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(__mcb_register_driver, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_unregister_driver() - Unregister a @mcb_driver from the system
|
|
|
|
* @drv: The @mcb_driver
|
|
|
|
*
|
|
|
|
* Unregister a @mcb_driver from the system.
|
|
|
|
*/
|
|
|
|
void mcb_unregister_driver(struct mcb_driver *drv)
|
|
|
|
{
|
|
|
|
driver_unregister(&drv->driver);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_unregister_driver, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
static void mcb_release_dev(struct device *dev)
|
|
|
|
{
|
|
|
|
struct mcb_device *mdev = to_mcb_device(dev);
|
|
|
|
|
|
|
|
mcb_bus_put(mdev->bus);
|
|
|
|
kfree(mdev);
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_device_register() - Register a mcb_device
|
|
|
|
* @bus: The @mcb_bus of the device
|
|
|
|
* @dev: The @mcb_device
|
|
|
|
*
|
|
|
|
* Register a specific @mcb_device at a @mcb_bus and the system itself.
|
|
|
|
*/
|
|
|
|
int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev)
|
|
|
|
{
|
|
|
|
int ret;
|
|
|
|
int device_id;
|
|
|
|
|
|
|
|
device_initialize(&dev->dev);
|
2016-05-03 10:42:03 +00:00
|
|
|
mcb_bus_get(bus);
|
2014-02-26 16:29:05 +00:00
|
|
|
dev->dev.bus = &mcb_bus_type;
|
|
|
|
dev->dev.parent = bus->dev.parent;
|
|
|
|
dev->dev.release = mcb_release_dev;
|
2016-09-14 10:05:24 +00:00
|
|
|
dev->dma_dev = bus->carrier;
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
device_id = dev->id;
|
|
|
|
dev_set_name(&dev->dev, "mcb%d-16z%03d-%d:%d:%d",
|
|
|
|
bus->bus_nr, device_id, dev->inst, dev->group, dev->var);
|
|
|
|
|
|
|
|
ret = device_add(&dev->dev);
|
|
|
|
if (ret < 0) {
|
|
|
|
pr_err("Failed registering device 16z%03d on bus mcb%d (%d)\n",
|
|
|
|
device_id, bus->bus_nr, ret);
|
|
|
|
goto out;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
|
|
|
|
out:
|
2023-10-19 14:15:34 +00:00
|
|
|
put_device(&dev->dev);
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
return ret;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_device_register, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
2016-05-03 10:42:03 +00:00
|
|
|
static void mcb_free_bus(struct device *dev)
|
|
|
|
{
|
|
|
|
struct mcb_bus *bus = to_mcb_bus(dev);
|
|
|
|
|
|
|
|
put_device(bus->carrier);
|
2022-07-12 06:50:08 +00:00
|
|
|
ida_free(&mcb_ida, bus->bus_nr);
|
2016-05-03 10:42:03 +00:00
|
|
|
kfree(bus);
|
|
|
|
}
|
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
/**
|
|
|
|
* mcb_alloc_bus() - Allocate a new @mcb_bus
|
2023-12-06 05:58:21 +00:00
|
|
|
* @carrier: generic &struct device for the carrier device
|
2014-02-26 16:29:05 +00:00
|
|
|
*
|
|
|
|
* Allocate a new @mcb_bus.
|
|
|
|
*/
|
2014-04-24 12:35:25 +00:00
|
|
|
struct mcb_bus *mcb_alloc_bus(struct device *carrier)
|
2014-02-26 16:29:05 +00:00
|
|
|
{
|
|
|
|
struct mcb_bus *bus;
|
|
|
|
int bus_nr;
|
2016-05-03 07:46:22 +00:00
|
|
|
int rc;
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
bus = kzalloc(sizeof(struct mcb_bus), GFP_KERNEL);
|
|
|
|
if (!bus)
|
2014-04-24 12:35:25 +00:00
|
|
|
return ERR_PTR(-ENOMEM);
|
2014-02-26 16:29:05 +00:00
|
|
|
|
2022-07-12 06:50:08 +00:00
|
|
|
bus_nr = ida_alloc(&mcb_ida, GFP_KERNEL);
|
2014-02-26 16:29:05 +00:00
|
|
|
if (bus_nr < 0) {
|
2021-09-06 12:35:48 +00:00
|
|
|
kfree(bus);
|
|
|
|
return ERR_PTR(bus_nr);
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
bus->bus_nr = bus_nr;
|
2016-05-03 10:42:03 +00:00
|
|
|
bus->carrier = get_device(carrier);
|
2016-05-03 07:46:22 +00:00
|
|
|
|
|
|
|
device_initialize(&bus->dev);
|
|
|
|
bus->dev.parent = carrier;
|
|
|
|
bus->dev.bus = &mcb_bus_type;
|
2016-05-03 07:46:23 +00:00
|
|
|
bus->dev.type = &mcb_carrier_device_type;
|
2023-09-06 11:49:28 +00:00
|
|
|
bus->dev.release = mcb_free_bus;
|
2016-05-03 07:46:22 +00:00
|
|
|
|
|
|
|
dev_set_name(&bus->dev, "mcb:%d", bus_nr);
|
|
|
|
rc = device_add(&bus->dev);
|
|
|
|
if (rc)
|
2021-09-06 12:35:48 +00:00
|
|
|
goto err_put;
|
2016-05-03 07:46:22 +00:00
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
return bus;
|
2021-09-06 12:35:48 +00:00
|
|
|
|
|
|
|
err_put:
|
|
|
|
put_device(&bus->dev);
|
2016-05-03 07:46:22 +00:00
|
|
|
return ERR_PTR(rc);
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_alloc_bus, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
static int __mcb_devices_unregister(struct device *dev, void *data)
|
|
|
|
{
|
|
|
|
device_unregister(dev);
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mcb_devices_unregister(struct mcb_bus *bus)
|
|
|
|
{
|
2023-10-20 12:44:32 +00:00
|
|
|
bus_for_each_dev(bus->dev.bus, NULL, NULL, __mcb_devices_unregister);
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
|
|
|
/**
|
|
|
|
* mcb_release_bus() - Free a @mcb_bus
|
|
|
|
* @bus: The @mcb_bus to release
|
|
|
|
*
|
|
|
|
* Release an allocated @mcb_bus from the system.
|
|
|
|
*/
|
|
|
|
void mcb_release_bus(struct mcb_bus *bus)
|
|
|
|
{
|
|
|
|
mcb_devices_unregister(bus);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_release_bus, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
2023-12-06 05:58:21 +00:00
|
|
|
* mcb_bus_get() - Increment refcnt
|
2014-02-26 16:29:05 +00:00
|
|
|
* @bus: The @mcb_bus
|
|
|
|
*
|
|
|
|
* Get a @mcb_bus' ref
|
|
|
|
*/
|
|
|
|
struct mcb_bus *mcb_bus_get(struct mcb_bus *bus)
|
|
|
|
{
|
|
|
|
if (bus)
|
|
|
|
get_device(&bus->dev);
|
|
|
|
|
|
|
|
return bus;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_bus_get, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_bus_put() - Decrement refcnt
|
|
|
|
* @bus: The @mcb_bus
|
|
|
|
*
|
|
|
|
* Release a @mcb_bus' ref
|
|
|
|
*/
|
|
|
|
void mcb_bus_put(struct mcb_bus *bus)
|
|
|
|
{
|
|
|
|
if (bus)
|
|
|
|
put_device(&bus->dev);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_bus_put, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_alloc_dev() - Allocate a device
|
|
|
|
* @bus: The @mcb_bus the device is part of
|
|
|
|
*
|
|
|
|
* Allocate a @mcb_device and add bus.
|
|
|
|
*/
|
|
|
|
struct mcb_device *mcb_alloc_dev(struct mcb_bus *bus)
|
|
|
|
{
|
|
|
|
struct mcb_device *dev;
|
|
|
|
|
|
|
|
dev = kzalloc(sizeof(struct mcb_device), GFP_KERNEL);
|
|
|
|
if (!dev)
|
|
|
|
return NULL;
|
|
|
|
|
|
|
|
dev->bus = bus;
|
|
|
|
|
|
|
|
return dev;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_alloc_dev, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_free_dev() - Free @mcb_device
|
|
|
|
* @dev: The device to free
|
|
|
|
*
|
|
|
|
* Free a @mcb_device
|
|
|
|
*/
|
|
|
|
void mcb_free_dev(struct mcb_device *dev)
|
|
|
|
{
|
|
|
|
kfree(dev);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_free_dev, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
static int __mcb_bus_add_devices(struct device *dev, void *data)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
retval = device_attach(dev);
|
2023-09-06 11:49:26 +00:00
|
|
|
if (retval < 0) {
|
2014-02-26 16:29:05 +00:00
|
|
|
dev_err(dev, "Error adding device (%d)\n", retval);
|
2023-09-06 11:49:26 +00:00
|
|
|
return retval;
|
|
|
|
}
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_bus_add_devices() - Add devices in the bus' internal device list
|
|
|
|
* @bus: The @mcb_bus we add the devices
|
|
|
|
*
|
|
|
|
* Add devices in the bus' internal device list to the system.
|
|
|
|
*/
|
|
|
|
void mcb_bus_add_devices(const struct mcb_bus *bus)
|
|
|
|
{
|
2023-10-20 12:44:32 +00:00
|
|
|
bus_for_each_dev(bus->dev.bus, NULL, NULL, __mcb_bus_add_devices);
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_bus_add_devices, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
2017-08-02 07:58:52 +00:00
|
|
|
/**
|
|
|
|
* mcb_get_resource() - get a resource for a mcb device
|
|
|
|
* @dev: the mcb device
|
|
|
|
* @type: the type of resource
|
|
|
|
*/
|
|
|
|
struct resource *mcb_get_resource(struct mcb_device *dev, unsigned int type)
|
|
|
|
{
|
|
|
|
if (type == IORESOURCE_MEM)
|
|
|
|
return &dev->mem;
|
|
|
|
else if (type == IORESOURCE_IRQ)
|
|
|
|
return &dev->irq;
|
|
|
|
else
|
|
|
|
return NULL;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_get_resource, "MCB");
|
2017-08-02 07:58:52 +00:00
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
/**
|
|
|
|
* mcb_request_mem() - Request memory
|
|
|
|
* @dev: The @mcb_device the memory is for
|
|
|
|
* @name: The name for the memory reference.
|
|
|
|
*
|
|
|
|
* Request memory for a @mcb_device. If @name is NULL the driver name will
|
|
|
|
* be used.
|
|
|
|
*/
|
|
|
|
struct resource *mcb_request_mem(struct mcb_device *dev, const char *name)
|
|
|
|
{
|
|
|
|
struct resource *mem;
|
|
|
|
u32 size;
|
|
|
|
|
|
|
|
if (!name)
|
|
|
|
name = dev->dev.driver->name;
|
|
|
|
|
|
|
|
size = resource_size(&dev->mem);
|
|
|
|
|
|
|
|
mem = request_mem_region(dev->mem.start, size, name);
|
|
|
|
if (!mem)
|
|
|
|
return ERR_PTR(-EBUSY);
|
|
|
|
|
|
|
|
return mem;
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_request_mem, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* mcb_release_mem() - Release memory requested by device
|
2023-12-06 05:58:21 +00:00
|
|
|
* @mem: The memory resource to be released
|
2014-02-26 16:29:05 +00:00
|
|
|
*
|
|
|
|
* Release memory that was prior requested via @mcb_request_mem().
|
|
|
|
*/
|
|
|
|
void mcb_release_mem(struct resource *mem)
|
|
|
|
{
|
|
|
|
u32 size;
|
|
|
|
|
|
|
|
size = resource_size(mem);
|
|
|
|
release_mem_region(mem->start, size);
|
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_release_mem, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
2014-04-24 12:35:25 +00:00
|
|
|
static int __mcb_get_irq(struct mcb_device *dev)
|
|
|
|
{
|
2017-08-02 07:58:52 +00:00
|
|
|
struct resource *irq;
|
|
|
|
|
|
|
|
irq = mcb_get_resource(dev, IORESOURCE_IRQ);
|
2014-04-24 12:35:25 +00:00
|
|
|
|
|
|
|
return irq->start;
|
|
|
|
}
|
|
|
|
|
2014-02-26 16:29:05 +00:00
|
|
|
/**
|
|
|
|
* mcb_get_irq() - Get device's IRQ number
|
|
|
|
* @dev: The @mcb_device the IRQ is for
|
|
|
|
*
|
|
|
|
* Get the IRQ number of a given @mcb_device.
|
|
|
|
*/
|
|
|
|
int mcb_get_irq(struct mcb_device *dev)
|
|
|
|
{
|
2014-04-24 12:35:25 +00:00
|
|
|
struct mcb_bus *bus = dev->bus;
|
2014-02-26 16:29:05 +00:00
|
|
|
|
2014-04-24 12:35:25 +00:00
|
|
|
if (bus->get_irq)
|
|
|
|
return bus->get_irq(dev);
|
|
|
|
|
|
|
|
return __mcb_get_irq(dev);
|
2014-02-26 16:29:05 +00:00
|
|
|
}
|
module: Convert symbol namespace to string literal
Clean up the existing export namespace code along the same lines of
commit 33def8498fdd ("treewide: Convert macro and uses of __section(foo)
to __section("foo")") and for the same reason, it is not desired for the
namespace argument to be a macro expansion itself.
Scripted using
git grep -l -e MODULE_IMPORT_NS -e EXPORT_SYMBOL_NS | while read file;
do
awk -i inplace '
/^#define EXPORT_SYMBOL_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/^#define MODULE_IMPORT_NS/ {
gsub(/__stringify\(ns\)/, "ns");
print;
next;
}
/MODULE_IMPORT_NS/ {
$0 = gensub(/MODULE_IMPORT_NS\(([^)]*)\)/, "MODULE_IMPORT_NS(\"\\1\")", "g");
}
/EXPORT_SYMBOL_NS/ {
if ($0 ~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+),/) {
if ($0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/ &&
$0 !~ /(EXPORT_SYMBOL_NS[^(]*)\(\)/ &&
$0 !~ /^my/) {
getline line;
gsub(/[[:space:]]*\\$/, "");
gsub(/[[:space:]]/, "", line);
$0 = $0 " " line;
}
$0 = gensub(/(EXPORT_SYMBOL_NS[^(]*)\(([^,]+), ([^)]+)\)/,
"\\1(\\2, \"\\3\")", "g");
}
}
{ print }' $file;
done
Requested-by: Masahiro Yamada <masahiroy@kernel.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Link: https://mail.google.com/mail/u/2/#inbox/FMfcgzQXKWgMmjdFwwdsfgxzKpVHWPlc
Acked-by: Greg KH <gregkh@linuxfoundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2024-12-02 14:59:47 +00:00
|
|
|
EXPORT_SYMBOL_NS_GPL(mcb_get_irq, "MCB");
|
2014-02-26 16:29:05 +00:00
|
|
|
|
|
|
|
static int mcb_init(void)
|
|
|
|
{
|
|
|
|
return bus_register(&mcb_bus_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void mcb_exit(void)
|
|
|
|
{
|
2015-10-28 07:22:16 +00:00
|
|
|
ida_destroy(&mcb_ida);
|
2014-02-26 16:29:05 +00:00
|
|
|
bus_unregister(&mcb_bus_type);
|
|
|
|
}
|
|
|
|
|
|
|
|
/* mcb must be initialized after PCI but before the chameleon drivers.
|
|
|
|
* That means we must use some initcall between subsys_initcall and
|
|
|
|
* device_initcall.
|
|
|
|
*/
|
|
|
|
fs_initcall(mcb_init);
|
|
|
|
module_exit(mcb_exit);
|
|
|
|
|
|
|
|
MODULE_DESCRIPTION("MEN Chameleon Bus Driver");
|
|
|
|
MODULE_AUTHOR("Johannes Thumshirn <johannes.thumshirn@men.de>");
|
|
|
|
MODULE_LICENSE("GPL v2");
|