[PATCH linux dev-4.7 2/2] drivers: fsi: scom: Add remove function

Christopher Bostic cbostic at linux.vnet.ibm.com
Tue Feb 14 08:03:32 AEDT 2017


Acked by: Christopher Bostic <cbostic at linux.vnet.ibm.com>


On 2/13/17 2:08 PM, Eddie James wrote:
> From: "Edward A. James" <eajames at us.ibm.com>
>
> driver wasn't cleaning up miscdevice
>
> Signed-off-by: Edward A. James <eajames at us.ibm.com>
> ---
>   drivers/fsi/fsi-scom.c | 16 ++++++++++++++++
>   1 file changed, 16 insertions(+)
>
> diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
> index 22d280a..a439a5e 100644
> --- a/drivers/fsi/fsi-scom.c
> +++ b/drivers/fsi/fsi-scom.c
> @@ -199,6 +199,21 @@ static int scom_probe(struct device *dev)
>   	return misc_register(&scom->mdev);
>   }
>
> +static int scom_remove(struct device *dev)
> +{
> +	struct scom_device *scom, *scom_tmp;
> +	struct fsi_device *fsi_dev = to_fsi_dev(dev);
> +	
> +	list_for_each_entry_safe(scom, scom_tmp, &scom_devices, link) {
> +		if (scom->fsi_dev == fsi_dev) {
> +			list_del(&scom->link);
> +			misc_deregister(&scom->mdev);
> +		}
> +	}
> +
> +	return 0;
> +}
> +
>   static struct fsi_device_id scom_ids[] = {
>   	{
>   		.engine_type = FSI_ENGID_SCOM,
> @@ -213,6 +228,7 @@ static struct fsi_driver scom_drv = {
>   		.name = "scom",
>   		.bus = &fsi_bus_type,
>   		.probe = scom_probe,
> +		.remove = scom_remove,
>   	}
>   };
>



More information about the openbmc mailing list