[no subject]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> > +             sysfs_remove_group(&priv->fw_attr_kset->kobj,
> > +                                capdata01_attr_groups[i].attr_group);
> > +     }
> > +     kset_unregister(priv->fw_attr_kset);
> > +
> > +err_destroy_classdev:
> > +     device_unregister(priv->fw_attr_dev);
> > +     return err;
> > +}
> > +
> > +/*
> > + * lwmi_om_fw_attr_remove() - Unregisters all capdata01_attr_groups[] attributes as
> > + * firmware_attributes_class members.
> > + * @priv: The Other Mode driver data.
> > + *
> > + */
> > +static void lwmi_om_fw_attr_remove(struct lwmi_om_priv *priv)
> > +{
> > +     int size = ARRAY_SIZE(capdata01_attr_groups);
>
> unsigned int i = ARRAY_SIZE(capdata01_attr_groups) - 1;
>
> > +
> > +     while (--size >= 0) {
>
> while (i--) {
>

Acked

> > +             sysfs_remove_group(&priv->fw_attr_kset->kobj,
> > +                                capdata01_attr_groups[size].attr_group);
> > +     }
> > +     kset_unregister(priv->fw_attr_kset);
> > +     device_unregister(priv->fw_attr_dev);
> > +}
> > +
> > +static int lwmi_om_master_bind(struct device *dev)
> > +{
> > +     struct lwmi_om_priv *priv = dev_get_drvdata(dev);
> > +     int ret;
> > +
> > +     ret = component_bind_all(dev, &priv->cd01_list);
> > +     if (ret)
> > +             return ret;
> > +
> > +     return lwmi_om_fw_attr_add(priv);
> > +}
> > +
> > +static void lwmi_om_master_unbind(struct device *dev)
> > +{
> > +     component_unbind_all(dev, NULL);
> > +}
> > +
> > +static const struct component_master_ops lwmi_om_master_ops = {
> > +     .bind = lwmi_om_master_bind,
> > +     .unbind = lwmi_om_master_unbind,
> > +};
> > +
> > +static int lwmi_other_probe(struct wmi_device *wdev, const void *context)
> > +{
> > +     struct component_match *master_match = NULL;
> > +     struct lwmi_om_priv *priv;
> > +
> > +     priv = devm_kzalloc(&wdev->dev, sizeof(*priv), GFP_KERNEL);
> > +     if (!priv)
> > +             return -ENOMEM;
> > +
> > +     priv->wdev = wdev;
> > +     dev_set_drvdata(&wdev->dev, priv);
> > +
> > +     component_match_add(&wdev->dev, &master_match, lwmi_cd01_match, NULL);
> > +     if (IS_ERR(master_match))
> > +             return PTR_ERR(master_match);
> > +
> > +     return component_master_add_with_match(&wdev->dev, &lwmi_om_master_ops,
> > +                                            master_match);
> > +}
> > +
> > +static void lwmi_other_remove(struct wmi_device *wdev)
> > +{
> > +     struct lwmi_om_priv *priv = dev_get_drvdata(&wdev->dev);
> > +
> > +     component_master_del(&wdev->dev, &lwmi_om_master_ops);
> > +     lwmi_om_fw_attr_remove(priv);
> > +     ida_free(&priv->ida, priv->ida_id);
> > +}
> > +
> > +static const struct wmi_device_id lwmi_other_id_table[] = {
> > +     { LENOVO_OTHER_METHOD_GUID, NULL },
> > +     {}
> > +};
> > +
> > +static struct wmi_driver lwmi_other_driver = {
> > +     .driver = {
> > +             .name = "lenovo_wmi_other",
> > +             .probe_type = PROBE_PREFER_ASYNCHRONOUS,
> > +     },
> > +     .id_table = lwmi_other_id_table,
> > +     .probe = lwmi_other_probe,
> > +     .remove = lwmi_other_remove,
> > +     .no_singleton = true,
> > +};
> > +
> > +module_wmi_driver(lwmi_other_driver);
> > +
> > +MODULE_IMPORT_NS("LENOVO_WMI_CD01");
> > +MODULE_IMPORT_NS("LENOVO_WMI_HELPERS");
> > +MODULE_DEVICE_TABLE(wmi, lwmi_other_id_table);
> > +MODULE_AUTHOR("Derek J. Clark <derekjohn.clark@xxxxxxxxx>");
> > +MODULE_DESCRIPTION("Lenovo Other Mode WMI Driver");
> > +MODULE_LICENSE("GPL");
> > diff --git a/drivers/platform/x86/lenovo-wmi-other.h b/drivers/platform/x86/lenovo-wmi-other.h
> > new file mode 100644
> > index 000000000000..9fba35ef1137
> > --- /dev/null
> > +++ b/drivers/platform/x86/lenovo-wmi-other.h
> > @@ -0,0 +1,19 @@
> > +/* SPDX-License-Identifier: GPL-2.0-or-later
> > + *
> > + * Copyright(C) 2025 Derek J. Clark <derekjohn.clark@xxxxxxxxx>
> > + *
> > + */
> > +
> > +#ifndef _LENOVO_WMI_OTHER_H_
> > +#define _LENOVO_WMI_OTHER_H_
> > +
> > +#include <linux/device.h>
> > +#include <linux/notifier.h>
> > +#include <linux/types.h>
>
> Replace with struct forward declarations.
>
> > +
> > +int lwmi_om_register_notifier(struct notifier_block *nb);
> > +int lwmi_om_unregister_notifier(struct notifier_block *nb);
> > +int devm_lwmi_om_register_notifier(struct device *dev,
> > +                                struct notifier_block *nb);
> > +
> > +#endif /* !_LENOVO_WMI_H_ */
> >
>
> --
>  i.
>





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux