Re: [PATCH linux dev-5.10 2/7] ipmi: kcs_bmc: Add a "raw" character device interface
Andrew Jeffery
andrew at aj.id.au
Wed Jun 23 10:47:46 AEST 2021
On Fri, 18 Jun 2021, at 13:28, Andrew Jeffery wrote:
> +static int kcs_bmc_raw_add_device(struct kcs_bmc_device *kcs_bmc)
> +{
> + struct kcs_bmc_raw *priv;
> + int rc;
> +
> + priv = devm_kzalloc(kcs_bmc->dev, sizeof(*priv), GFP_KERNEL);
> + if (!priv)
> + return -ENOMEM;
> +
> + priv->client.dev = kcs_bmc;
> + priv->client.ops = &kcs_bmc_raw_client_ops;
> +
> + init_waitqueue_head(&priv->queue);
> + priv->writable = false;
> + priv->readable = false;
> +
> + priv->miscdev.minor = MISC_DYNAMIC_MINOR;
> + priv->miscdev.name = devm_kasprintf(kcs_bmc->dev, GFP_KERNEL, "%s%u",
> DEVICE_NAME,
> + kcs_bmc->channel);
> + if (!priv->miscdev.name)
> + return -EINVAL;
> +
> + priv->miscdev.fops = &kcs_bmc_raw_fops;
> +
> + /* Initialise our expected events. Listen for IBF but ignore OBE
> until necessary */
> + kcs_bmc_raw_update_event_mask(priv, (KCS_BMC_EVENT_TYPE_IBF |
> KCS_BMC_EVENT_TYPE_OBE),
> + KCS_BMC_EVENT_TYPE_IBF);
Ah, this is now wrong wrt to some other rework that went on, we should be disabling IBF and OBE until the chardev is opened.
With the code as it is we can get a "nobody cared" WARN().
I'll send a v2.
Andrew
More information about the openbmc
mailing list