lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50852.162.105.203.8.1348282609.squirrel@mprc.pku.edu.cn>
Date:	Sat, 22 Sep 2012 10:56:49 +0800 (CST)
From:	guanxuetao@...c.pku.edu.cn
To:	"Thierry Reding" <thierry.reding@...onic-design.de>
Cc:	"Guan Xuetao" <gxt@...c.pku.edu.cn>,
	"Qin Rui" <qinrui@...c.pku.edu.cn>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/5] unicore32: pwm: Remove unnecessary indirection

> Calling the actual probing function through a proxy isn't required and
> makes the code needlessly complex.
>
> Signed-off-by: Thierry Reding <thierry.reding@...onic-design.de>

Tested-by: Qin Rui <qinrui@...c.pku.edu.cn>
Acked-by: Guan Xuetao <gxt@...c.pku.edu.cn>

Thanks & Regards,
Guan Xuetao


> ---
>  arch/unicore32/kernel/pwm.c | 23 ++++++-----------------
>  1 file changed, 6 insertions(+), 17 deletions(-)
>
> diff --git a/arch/unicore32/kernel/pwm.c b/arch/unicore32/kernel/pwm.c
> index 012c54a..7e23470 100644
> --- a/arch/unicore32/kernel/pwm.c
> +++ b/arch/unicore32/kernel/pwm.c
> @@ -156,8 +156,7 @@ static inline void __add_pwm(struct pwm_device *pwm)
>  	mutex_unlock(&pwm_lock);
>  }
>
> -static struct pwm_device *pwm_probe(struct platform_device *pdev,
> -		unsigned int pwm_id, struct pwm_device *parent_pwm)
> +static int __devinit pwm_probe(struct platform_device *pdev)
>  {
>  	struct pwm_device *pwm;
>  	struct resource *r;
> @@ -166,7 +165,7 @@ static struct pwm_device *pwm_probe(struct
> platform_device *pdev,
>  	pwm = kzalloc(sizeof(struct pwm_device), GFP_KERNEL);
>  	if (pwm == NULL) {
>  		dev_err(&pdev->dev, "failed to allocate memory\n");
> -		return ERR_PTR(-ENOMEM);
> +		return -ENOMEM;
>  	}
>
>  	pwm->clk = clk_get(NULL, "OST_CLK");
> @@ -177,7 +176,7 @@ static struct pwm_device *pwm_probe(struct
> platform_device *pdev,
>  	pwm->clk_enabled = 0;
>
>  	pwm->use_count = 0;
> -	pwm->pwm_id = pwm_id;
> +	pwm->pwm_id = pdev->id;
>  	pwm->pdev = pdev;
>
>  	r = platform_get_resource(pdev, IORESOURCE_MEM, 0);
> @@ -203,7 +202,7 @@ static struct pwm_device *pwm_probe(struct
> platform_device *pdev,
>
>  	__add_pwm(pwm);
>  	platform_set_drvdata(pdev, pwm);
> -	return pwm;
> +	return 0;
>
>  err_release_mem:
>  	release_mem_region(r->start, resource_size(r));
> @@ -211,17 +210,7 @@ err_free_clk:
>  	clk_put(pwm->clk);
>  err_free:
>  	kfree(pwm);
> -	return ERR_PTR(ret);
> -}
> -
> -static int __devinit puv3_pwm_probe(struct platform_device *pdev)
> -{
> -	struct pwm_device *pwm = pwm_probe(pdev, pdev->id, NULL);
> -
> -	if (IS_ERR(pwm))
> -		return PTR_ERR(pwm);
> -
> -	return 0;
> +	return ret;
>  }
>
>  static int __devexit pwm_remove(struct platform_device *pdev)
> @@ -251,7 +240,7 @@ static struct platform_driver puv3_pwm_driver = {
>  	.driver		= {
>  		.name	= "PKUnity-v3-PWM",
>  	},
> -	.probe		= puv3_pwm_probe,
> +	.probe		= pwm_probe,
>  	.remove		= __devexit_p(pwm_remove),
>  };
>  module_platform_driver(puv3_pwm_driver);
> --
> 1.7.12
>

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ