Re: [PATCH V1] add huawei ibma driver modules The driver is used for communication between in-band management agent(iBMA) and out-of-band management controller(iBMC) via pcie bus in Huawei V3 server. The driver provides character device,VNIC and black box interface for application layer.
From: Andrew Lunn
Date: Wed Aug 29 2018 - 23:17:57 EST
On Thu, Aug 30, 2018 at 09:11:12AM +0800, xiongsujuan wrote:
Hi xiongsujuan
Please add a real commit message. Talk about the architecture, etc.
You are also missing a Signed-off-by:
> +const struct file_operations g_bma_cdev_fops = {
> + .owner = THIS_MODULE,
> + .open = cdev_open,
> + .release = cdev_release,
> + .poll = cdev_poll,
> + .read = cdev_read,
> + .write = cdev_write,
> +};
> +
> +static int __init bma_cdev_init(void)
> +{
> + int i = 0;
> +
> + int ret = 0;
> + int err_count = 0;
> +
> + if (!bma_intf_check_edma_supported())
> + return -ENXIO;
> +
> + if (dev_num <= 0 || dev_num > CDEV_MAX_NUM)
> + return -EINVAL;
> +
> + memset(&g_cdev_set, 0, sizeof(struct cdev_dev_set));
> + g_cdev_set.dev_num = dev_num;
> +
> + for (i = 0; i < dev_num; i++) {
> + struct cdev_dev *pDev = &g_cdev_set.dev_list[i];
> +
> + sprintf(pDev->dev_name, "%s%d", CDEV_NAME_PREFIX, i);
> + pDev->dev_struct.name = pDev->dev_name;
> + pDev->dev_struct.minor = MISC_DYNAMIC_MINOR;
> + pDev->dev_struct.fops = &g_bma_cdev_fops;
> +
> + pDev->dev_id = CDEV_INVALID_ID;
> +
> + ret = misc_register(&pDev->dev_struct);
> +
> + if (ret) {
> + CDEV_LOG(DLOG_DEBUG, "misc_register failed %d", i);
> + err_count++;
> + continue;
> + }
> +
> + pDev->dev_id = MKDEV(MISC_MAJOR, pDev->dev_struct.minor);
> +
> + ret = bma_intf_register_type(TYPE_CDEV + i, 0, INTR_DISABLE,
> + &pDev->dev_data);
> +
> + if (ret) {
> + CDEV_LOG(DLOG_ERROR,
> + "cdev %d open failed ,result = %d",
> + i, ret);
> + misc_deregister(&pDev->dev_struct);
I've never seen a Ethernet driver with a cdev. You need to explain
this. What is it, why does it exist, etc.
Andrew