diff mbox

[RFC,05/12] phy: use of_phy_simple_xlate for NULL xlate function

Message ID 1382365111-6533-6-git-send-email-t.stanislaws@samsung.com (mailing list archive)
State New, archived
Headers show

Commit Message

Tomasz Stanislawski Oct. 21, 2013, 2:18 p.m. UTC
Use default handler of_phy_simple_xlate() when NULL is passed as argument to
of_phy_provider_register().

Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
---
 drivers/phy/phy-core.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Kishon Vijay Abraham I Oct. 24, 2013, 3:33 p.m. UTC | #1
Hi,

On Monday 21 October 2013 07:48 PM, Tomasz Stanislawski wrote:
> Use default handler of_phy_simple_xlate() when NULL is passed as argument to
> of_phy_provider_register().
> 
> Signed-off-by: Tomasz Stanislawski <t.stanislaws@samsung.com>
> ---
>  drivers/phy/phy-core.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
> index 03cf8fb..c38ae1e7 100644
> --- a/drivers/phy/phy-core.c
> +++ b/drivers/phy/phy-core.c
> @@ -575,7 +575,7 @@ struct phy_provider *__of_phy_provider_register(struct device *dev,
>  
>  	phy_provider->dev = dev;
>  	phy_provider->owner = owner;
> -	phy_provider->of_xlate = of_xlate;
> +	phy_provider->of_xlate = of_xlate ? of_xlate : of_phy_simple_xlate;

Lets allow the phy provider to pass the correct of_xlate (of_phy_simple_xlate
is exported anyway). Instead you can modify the patch to check for of_xlate and
do a WARN if it is NULL.

Thanks
Kishon
diff mbox

Patch

diff --git a/drivers/phy/phy-core.c b/drivers/phy/phy-core.c
index 03cf8fb..c38ae1e7 100644
--- a/drivers/phy/phy-core.c
+++ b/drivers/phy/phy-core.c
@@ -575,7 +575,7 @@  struct phy_provider *__of_phy_provider_register(struct device *dev,
 
 	phy_provider->dev = dev;
 	phy_provider->owner = owner;
-	phy_provider->of_xlate = of_xlate;
+	phy_provider->of_xlate = of_xlate ? of_xlate : of_phy_simple_xlate;
 
 	mutex_lock(&phy_provider_mutex);
 	list_add_tail(&phy_provider->list, &phy_provider_list);