Commit 42ba9f06 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

cobalt/rtdm: drop redundant information from rtdm_device_class

Convert .provider_name to MODULE_AUTHOR(), .peripheral_name to
MODULE_DESCRIPTION() and .driver_version to MODULE_VERSION()
respectively, if not already present.

Drop .driver_name entirely as it brings no information we could not
get from reading the module name.
parent dbdc0ebd
......@@ -27,6 +27,7 @@
#include <asm/atomic.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/cdev.h>
#include <xenomai/version.h>
#include <cobalt/kernel/heap.h>
......@@ -83,26 +84,6 @@ enum rtdm_selecttype;
#define RTDM_SECURE_DEVICE 0x80000000
/** @} Device Flags */
/*!
* @anchor drv_versioning @name Driver Versioning
* Encoding of driver versions. See
* @ref rtdm_api_versioning "API Versioning" for the interface revision.
* @{
*/
/** Version code constructor for driver revisions */
#define RTDM_DRIVER_VER(major, minor, patch) \
(((major & 0xFF) << 16) | ((minor & 0xFF) << 8) | (patch & 0xFF))
/** Get major version number from driver revision code */
#define RTDM_DRIVER_MAJOR_VER(ver) (((ver) >> 16) & 0xFF)
/** Get minor version number from driver revision code */
#define RTDM_DRIVER_MINOR_VER(ver) (((ver) >> 8) & 0xFF)
/** Get patch version number from driver revision code */
#define RTDM_DRIVER_PATCH_VER(ver) ((ver) & 0xFF)
/** @} Driver Versioning */
/** @} rtdm_device_register */
/*!
......@@ -231,6 +212,7 @@ struct rtdm_profile_info {
int version;
/** Reserved */
unsigned int magic;
struct module *owner;
};
/**
......@@ -253,15 +235,6 @@ struct rtdm_device_class {
int protocol_family;
/** Protocol device identification: socket type (SOCK_xxx) */
int socket_type;
/** Informational driver name (reported via /proc) */
const char *driver_name;
/** Driver version, see @ref drv_versioning "Driver Versioning" macros */
int driver_version;
/** Informational peripheral name the device is attached to
* (reported via /proc) */
const char *peripheral_name;
/** Informational driver provider name (reported via /proc) */
const char *provider_name;
/** I/O operation handlers */
struct rtdm_fd_ops ops;
/**
......@@ -309,6 +282,7 @@ struct rtdm_device_class {
.subclass_id = (__subid), \
.version = (__version), \
.magic = ~RTDM_CLASS_MAGIC, \
.owner = THIS_MODULE, \
}
/**
......
......@@ -191,7 +191,7 @@ struct udd_memregion {
struct udd_device {
/**
* Name of the device managed by the mini-driver, appears
* automatically in the /dev namespace upon creation.
* automatically in the /dev/rtdm namespace upon creation.
*/
const char *device_name;
/**
......@@ -199,11 +199,6 @@ struct udd_device {
* RTDM_NAMED_DEVICE may be omitted).
*/
int device_flags;
/**
* Textual description of the device managed by the
* mini-driver.
*/
const char *device_description;
/**
* Subclass code of the device managed by the mini-driver (see
* RTDM_SUBCLASS_xxx definition in the @ref rtdm_profiles
......@@ -211,10 +206,6 @@ struct udd_device {
* RTDM_CLASS_UDD.
*/
int device_subclass;
/** @ref drv_versioning "Driver version. */
int driver_version;
/** Driver author/provider (exposed via /proc/xenomai/rtdm) */
const char *driver_author;
struct {
/**
* Ancillary open() handler, optional. See
......
......@@ -219,10 +219,6 @@ static struct rtdm_device_class umm = {
.mmap = umm_mmap,
.get_unmapped_area = umm_get_unmapped_area,
},
.driver_name = "memdev",
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "User-mapped heap",
.provider_name = "Philippe Gerum <rpm@xenomai.org>",
};
static struct rtdm_device umm_devices[] = {
......@@ -249,10 +245,6 @@ static struct rtdm_device_class sysmem = {
.ioctl_rt = sysmem_ioctl_rt,
.ioctl_nrt = sysmem_ioctl_nrt,
},
.driver_name = "memdev",
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "System memory heap",
.provider_name = "Philippe Gerum <rpm@xenomai.org>",
};
static struct rtdm_device sysmem_device = {
......
......@@ -74,7 +74,7 @@ static void *named_begin(struct xnvfile_regular_iterator *it)
if (pos == 1)
/* Output the header once, only if some device follows. */
xnvfile_puts(it, "Name\t\t\t\tDriver\n");
xnvfile_printf(it, "%-20s %s\n", "NODE", "CLASS");
return priv->curr;
}
......@@ -83,8 +83,8 @@ static int named_show(struct xnvfile_regular_iterator *it, void *data)
{
struct rtdm_device *device = data;
xnvfile_printf(it, "%-31s\t%-15s\n", device->name,
device->class->driver_name);
xnvfile_printf(it, "%-20s %s\n",
device->name, device->class->profile_info.name);
return 0;
}
......@@ -130,7 +130,7 @@ static void *proto_begin(struct xnvfile_regular_iterator *it)
if (pos == 1)
/* Output the header once, only if some device follows. */
xnvfile_puts(it, "Name\t\t\t\tDriver\n");
xnvfile_printf(it, "%-12s %s\n", "NODE", "CLASS");
return priv->curr;
}
......@@ -144,9 +144,8 @@ static int proto_show(struct xnvfile_regular_iterator *it, void *data)
ksformat(pnum, sizeof(pnum), "%u:%u",
class->protocol_family, class->socket_type);
xnvfile_printf(it, "%-31s\t%-15s\t%s\n",
pnum, class->driver_name,
device->name);
xnvfile_printf(it, "%-12s %s\n",
pnum, class->profile_info.name);
return 0;
}
......@@ -276,15 +275,6 @@ static int devinfo_vfile_show(struct xnvfile_regular_iterator *it, void *data)
found:
class = device->class;
xnvfile_printf(it, "driver:\t\t%s\nversion:\t%d.%d.%d\n",
class->driver_name,
RTDM_DRIVER_MAJOR_VER(class->driver_version),
RTDM_DRIVER_MINOR_VER(class->driver_version),
RTDM_DRIVER_PATCH_VER(class->driver_version));
xnvfile_printf(it, "peripheral:\t%s\nprovider:\t%s\n",
class->peripheral_name, class->provider_name);
xnvfile_printf(it, "class:\t\t%d\nsub-class:\t%d\n",
class->profile_info.class_id,
class->profile_info.subclass_id);
......
......@@ -156,23 +156,21 @@ TRACE_EVENT(cobalt_device_register,
__field(int, class_id)
__field(int, subclass_id)
__field(int, profile_version)
__field(int, driver_version)
),
TP_fast_assign(
__entry->device = device;
__assign_str(device_name, device->class->device_name);
__assign_str(device_name, device->name);
__entry->flags = device->class->device_flags;
__entry->class_id = device->class->device_class;
__entry->subclass_id = device->class->device_sub_class;
__entry->profile_version = device->class->profile_version;
__entry->driver_version = device->class->driver_version;
__entry->class_id = device->class->profile_info.class_id;
__entry->subclass_id = device->class->profile_info.subclass_id;
__entry->profile_version = device->class->profile_info.version;
),
TP_printk("%s device %s=%p version=%d flags=0x%x, class=%d.%d profile=%d",
TP_printk("%s device %s=%p flags=0x%x, class=%d.%d profile=%d",
(__entry->flags & RTDM_DEVICE_TYPE_MASK)
== RTDM_NAMED_DEVICE ? "named" : "protocol",
__get_str(device_name), __entry->device, __entry->driver_version,
__get_str(device_name), __entry->device,
__entry->flags, __entry->class_id, __entry->subclass_id,
__entry->profile_version)
);
......@@ -183,13 +181,13 @@ TRACE_EVENT(cobalt_device_unregister,
TP_STRUCT__entry(
__field(struct rtdm_device *, device)
__string(device_name, device->class->device_name)
__string(device_name, device->name)
__field(unsigned int, poll_delay)
),
TP_fast_assign(
__entry->device = device;
__assign_str(device_name, device->class->device_name);
__assign_str(device_name, device->name);
__entry->poll_delay = poll_delay;
),
......
......@@ -26,6 +26,10 @@
#include <rtdm/driver.h>
#include <rtdm/analogy/device.h>
MODULE_AUTHOR("Alexis Berlemont");
MODULE_DESCRIPTION("Analogy core driver");
MODULE_LICENSE("GPL");
int (* const a4l_ioctl_functions[]) (struct a4l_device_context *, void *) = {
[_IOC_NR(A4L_DEVCFG)] = a4l_ioctl_devcfg,
[_IOC_NR(A4L_DEVINFO)] = a4l_ioctl_devinfo,
......@@ -232,10 +236,6 @@ static struct rtdm_device_class analogy = {
.write_nrt = a4l_write,
.select = a4l_rt_select,
},
.driver_name = "analogy",
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "Analogy",
.provider_name = "Alexis Berlemont",
};
static struct rtdm_device rtdm_devs[A4L_NB_DEVICES] = {
......@@ -270,9 +270,6 @@ void a4l_unregister(void)
rtdm_dev_unregister(&(rtdm_devs[i]), 1000);
}
MODULE_DESCRIPTION("Analogy");
MODULE_LICENSE("GPL");
static int __init a4l_init(void)
{
int ret;
......
......@@ -17,13 +17,16 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#include <linux/module.h>
#include <linux/init.h>
#include <linux/slab.h>
#include <cobalt/kernel/arith.h>
#include <rtdm/driver.h>
#include <rtdm/autotune.h>
/*
* Auto-tuning services for the Cobalt core clock. This driver is
* always built statically into the kernel when enabled.
*/
#define AUTOTUNE_STEPS 60
#define ONE_SECOND 1000000000UL
#define H2G2_FACTOR(g) ((g) * 4 / 5) /* 42 would be too pessimistic */
......@@ -642,10 +645,6 @@ static struct rtdm_device_class autotune = {
.ioctl_nrt = autotune_ioctl_nrt,
.close = autotune_close,
},
.driver_name = "autotune",
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "Auto-tuning services",
.provider_name = "Philippe Gerum <rpm@xenomai.org>",
};
static struct rtdm_device device = {
......@@ -655,18 +654,10 @@ static struct rtdm_device device = {
static int __init autotune_init(void)
{
int ret;
if (!realtime_core_enabled())
return 0;
ret = rtdm_dev_register(&device);
if (ret)
return ret;
return 0;
return rtdm_dev_register(&device);
}
device_initcall(autotune_init);
MODULE_LICENSE("GPL");
......@@ -36,6 +36,7 @@
#include <linux/module.h>
#include <linux/delay.h>
#include <linux/stringify.h>
#include <rtdm/driver.h>
......@@ -57,14 +58,14 @@
MODULE_AUTHOR("RT-Socket-CAN Development Team");
MODULE_DESCRIPTION("RTDM CAN raw socket device driver");
MODULE_VERSION(__stringify(RTCAN_MAJOR_VER)
__stringify(RTCAN_MINOR_VER)
__stringify(RTCAN_BUGFIX_VER));
MODULE_LICENSE("GPL");
void rtcan_tx_push(struct rtcan_device *dev, struct rtcan_socket *sock,
can_frame_t *frame);
static struct rtdm_device_class rtcan_proto_raw;
static inline int rtcan_accept_msg(uint32_t can_id, can_filter_t *filter)
{
if ((filter->can_mask & CAN_INV_FILTER))
......@@ -127,8 +128,7 @@ static void rtcan_rcv_deliver(struct rtcan_recv *recv_listener,
} else {
/* Overflow of socket's ring buffer! */
sock->rx_buf_full++;
RTCAN_RTDM_DBG("%s: socket buffer overflow, message discarded\n",
rtcan_proto_raw.driver_name);
RTCAN_RTDM_DBG("rtcan: socket buffer overflow, message discarded\n");
}
rtdm_fd_unlock(fd);
......@@ -976,8 +976,8 @@ ssize_t rtcan_raw_sendmsg(struct rtdm_fd *fd,
}
static struct rtdm_device_class rtcan_proto_raw = {
.profile_info = RTDM_PROFILE_INFO(rtcan_proto_raw,
static struct rtdm_device_class rtcan = {
.profile_info = RTDM_PROFILE_INFO(rtcan,
RTDM_CLASS_CAN,
RTDM_SUBCLASS_GENERIC,
RTCAN_PROFILE_VER),
......@@ -994,27 +994,21 @@ static struct rtdm_device_class rtcan_proto_raw = {
.recvmsg_rt = rtcan_raw_recvmsg,
.sendmsg_rt = rtcan_raw_sendmsg,
},
.driver_name = "rtcan",
.driver_version = RTDM_DRIVER_VER(RTCAN_MAJOR_VER,
RTCAN_MINOR_VER,
RTCAN_BUGFIX_VER),
.peripheral_name = "Real-Time CAN Raw Socket Interface",
.provider_name = "RT-Socket-CAN development team",
};
static struct rtdm_device rtcan_proto_raw_dev = {
.class = &rtcan_proto_raw,
static struct rtdm_device rtcan_device = {
.class = &rtcan,
.label = "rtcan",
};
int __init rtcan_raw_proto_register(void)
{
return rtdm_dev_register(&rtcan_proto_raw_dev);
return rtdm_dev_register(&rtcan_device);
}
void __exit rtcan_raw_proto_unregister(void)
{
rtdm_dev_unregister(&rtcan_proto_raw_dev, 1000);
rtdm_dev_unregister(&rtcan_device, 1000);
}
......
......@@ -24,6 +24,10 @@
#include <rtdm/ipc.h>
#include "internal.h"
MODULE_DESCRIPTION("Real-time IPC interface");
MODULE_AUTHOR("Philippe Gerum <rpm@xenomai.org>");
MODULE_LICENSE("GPL");
static struct rtipc_protocol *protocols[IPCPROTO_MAX] = {
#ifdef CONFIG_XENO_DRIVERS_RTIPC_XDDP
[IPCPROTO_XDDP - 1] = &xddp_proto_driver,
......@@ -277,10 +281,6 @@ static struct rtdm_device_class rtipc = {
.write_nrt = NULL,
.select = rtipc_select,
},
.driver_name = "rtipc",
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "Real-time IPC interface",
.provider_name = "Philippe Gerum <rpm@xenomai.org>",
};
static struct rtdm_device device = {
......@@ -323,5 +323,3 @@ void __exit __rtipc_exit(void)
module_init(__rtipc_init);
module_exit(__rtipc_exit);
MODULE_LICENSE("GPL");
......@@ -25,6 +25,11 @@
#include <rtdm/serial.h>
#include <rtdm/driver.h>
MODULE_DESCRIPTION("RTDM-based driver for 16550A UARTs");
MODULE_AUTHOR("Jan Kiszka <jan.kiszka@web.de>");
MODULE_VERSION("1.5.2");
MODULE_LICENSE("GPL");
#define RT_16550_DRIVER_NAME "xeno_16550A"
#define MAX_DEVICES 8
......@@ -135,9 +140,6 @@ MODULE_PARM_DESC(baud_base, "Maximum baud rate of the serial device "
"(internal clock rate / 16)");
MODULE_PARM_DESC(tx_fifo, "Transmitter FIFO size");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("jan.kiszka@web.de");
#include "16550A_io.h"
#include "16550A_pnp.h"
#include "16550A_pci.h"
......@@ -1080,10 +1082,6 @@ static struct rtdm_device_class uart16550A = {
.read_rt = rt_16550_read,
.write_rt = rt_16550_write,
},
.driver_name = RT_16550_DRIVER_NAME,
.driver_version = RTDM_DRIVER_VER(1, 5, 2),
.peripheral_name = "UART 16550A",
.provider_name = "Jan Kiszka",
};
void rt_16550_exit(void);
......
......@@ -29,7 +29,9 @@
#include <rtdm/serial.h>
#include <rtdm/driver.h>
MODULE_DESCRIPTION("RTDM-based driver for MPC52xx UARTs");
MODULE_AUTHOR("Wolfgang Grandegger <wg@denx.de>");
MODULE_VERSION("1.0.0");
MODULE_LICENSE("GPL");
#define RT_MPC52XX_UART_DRVNAM "xeno_mpc52xx_uart"
......@@ -1248,10 +1250,6 @@ static struct rtdm_device_class mpc52xx_uart = {
.read_rt = rt_mpc52xx_uart_read,
.write_rt = rt_mpc52xx_uart_write,
},
.driver_name = RT_MPC52XX_UART_DRVNAM,
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "MPC52xx UART",
.provider_name = "Wolfgang Grandegger",
};
static int rt_mpc52xx_uart_of_probe(struct platform_device *op)
......
......@@ -42,6 +42,11 @@
#include <rtdm/serial.h>
#include <rtdm/driver.h>
MODULE_AUTHOR("Wolfgang Grandegger <wg@denx.de>");
MODULE_DESCRIPTION("RTDM-based driver for IMX UARTs");
MODULE_VERSION("1.0.0");
MODULE_LICENSE("GPL");
#define DRIVER_NAME "xeno_imx_uart"
/* Register definitions */
......@@ -1375,10 +1380,6 @@ static struct rtdm_device imx_uart = {
.read_rt = rt_imx_uart_read,
.write_rt = rt_imx_uart_write,
},
.driver_name = DRIVER_NAME,
.driver_version = RTDM_DRIVER_VER(1, 0, 0),
.peripheral_name = "IMX UART",
.provider_name = "Wolfgang Grandegger",
};
static int rt_imx_uart_probe(struct platform_device *pdev)
......@@ -1535,7 +1536,3 @@ static void __exit rt_imx_uart_exit(void)
module_init(rt_imx_uart_init);
module_exit(rt_imx_uart_exit);
MODULE_AUTHOR("Wolfgang Grandegger <wg@denx.de>");
MODULE_DESCRIPTION("IMX RTserial port driver");
MODULE_LICENSE("GPL");
......@@ -21,8 +21,10 @@
#include <rtdm/driver.h>
#include <rtdm/testing.h>
MODULE_DESCRIPTION("RTDM test helper module");
MODULE_AUTHOR("Jan Kiszka <jan.kiszka@web.de>");
MODULE_VERSION("0.1.0");
MODULE_LICENSE("GPL");
MODULE_AUTHOR("jan.kiszka@web.de");
struct rtdm_test_context {
rtdm_timer_t close_timer;
......@@ -114,10 +116,6 @@ static struct rtdm_device_class rtdmtest = {
.ioctl_rt = rtdm_test_ioctl,
.ioctl_nrt = rtdm_test_ioctl,
},
.driver_name = "rtdmtest",
.driver_version = RTDM_DRIVER_VER(0, 1, 0),
.peripheral_name = "RTDM unit test",
.provider_name = "Jan Kiszka",
};
static struct rtdm_device device[2] = {
......
......@@ -26,6 +26,11 @@
#include <rtdm/driver.h>
#include <asm/xenomai/fptest.h>
MODULE_DESCRIPTION("Cobalt context switch test helper");
MODULE_AUTHOR("Gilles Chanteperdrix <gilles.chanteperdrix@xenomai.org>");
MODULE_VERSION("0.1.1");
MODULE_LICENSE("GPL");
#define RTSWITCH_RT 0x10000
#define RTSWITCH_NRT 0
#define RTSWITCH_KERNEL 0x20000
......@@ -59,9 +64,6 @@ struct rtswitch_context {
static int fp_features;
MODULE_LICENSE("GPL");
MODULE_AUTHOR("Gilles.Chanteperdrix@laposte.net");
static int report(const char *fmt, ...)
{
va_list ap;
......@@ -729,10 +731,6 @@ static struct rtdm_device_class switchtest = {
.ioctl_rt = rtswitch_ioctl_rt,
.ioctl_nrt = rtswitch_ioctl_nrt,
},
.driver_name = "switchtest",
.driver_version = RTDM_DRIVER_VER(0, 1, 1),
.peripheral_name = "Context Switch Test",
.provider_name = "Gilles Chanteperdrix",
};
static struct rtdm_device device = {
......
......@@ -24,6 +24,11 @@
#include <rtdm/testing.h>
#include <rtdm/driver.h>
MODULE_DESCRIPTION("Timer latency test helper");
MODULE_AUTHOR("Jan Kiszka <jan.kiszka@web.de>");
MODULE_VERSION("0.2.1");
MODULE_LICENSE("GPL");
struct rt_tmbench_context {
int mode;
unsigned long period;
......@@ -50,9 +55,6 @@ struct rt_tmbench_context {
struct semaphore nrt_mutex;
};
MODULE_LICENSE("GPL");
MODULE_AUTHOR("jan.kiszka@web.de");
static inline void add_histogram(struct rt_tmbench_context *ctx,
long *histogram, long addval)
{
......@@ -462,10 +464,6 @@ static struct rtdm_device_class timerbench = {
.ioctl_rt = rt_tmbench_ioctl_rt,
.ioctl_nrt = rt_tmbench_ioctl_nrt,
},
.driver_name = "timerbench",
.driver_version = RTDM_DRIVER_VER(0, 2, 1),
.peripheral_name = "Timer Latency Benchmark",
.provider_name = "Jan Kiszka",
};
static struct rtdm_device device = {
......
......@@ -298,11 +298,6 @@ static inline int register_mapper(struct udd_device *udd)
.close = mapper_close,
.mmap = mapper_mmap,
};
class->driver_name = "udd";
class->driver_version = RTDM_DRIVER_VER(1, 0, 0);
class->peripheral_name = "UDD mapper";
class->provider_name = "Philippe Gerum <rpm@xenomai.org>";
dev->class = class;
dev->label = ur->mapper_name;
......@@ -373,10 +368,6 @@ int udd_register_device(struct udd_device *udd)
.close = udd_close,
.select = udd_select,
};
class->driver_name = "udd";
class->driver_version = udd->driver_version;
class->peripheral_name = udd->device_description;
class->provider_name = udd->driver_author;
dev->class = class;
dev->label = udd->device_name;
......
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