From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757487Ab2IUVwM (ORCPT ); Fri, 21 Sep 2012 17:52:12 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42944 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755516Ab2IUVwK (ORCPT ); Fri, 21 Sep 2012 17:52:10 -0400 Date: Fri, 21 Sep 2012 14:52:09 -0700 From: Andrew Morton To: Jingoo Han Cc: "'LKML'" , "'Richard Purdie'" Subject: Re: [PATCH] backlight: platform-lcd: Add support for device tree based probe Message-Id: <20120921145209.b57cad16.akpm@linux-foundation.org> In-Reply-To: <000e01cd9798$370acbd0$a5206370$%han@samsung.com> References: <000e01cd9798$370acbd0$a5206370$%han@samsung.com> X-Mailer: Sylpheed 3.0.2 (GTK+ 2.20.1; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, 21 Sep 2012 10:27:07 +0900 Jingoo Han wrote: > This patch adds the of_match_table to platform-lcd driver to be > probed when platform-lcd device node is found in the device tree. > > Cc: Richard Purdie > Signed-off-by: Jingoo Han > --- > drivers/video/backlight/platform_lcd.c | 9 +++++++++ > 1 files changed, 9 insertions(+), 0 deletions(-) > > diff --git a/drivers/video/backlight/platform_lcd.c b/drivers/video/backlight/platform_lcd.c > index b667234..574d5ee 100644 > --- a/drivers/video/backlight/platform_lcd.c > +++ b/drivers/video/backlight/platform_lcd.c > @@ -145,6 +145,14 @@ static SIMPLE_DEV_PM_OPS(platform_lcd_pm_ops, platform_lcd_suspend, > platform_lcd_resume); > #endif > > +#ifdef CONFIG_OF > +static const struct of_device_id platform_lcd_of_match[] = { > + { .compatible = "platform-lcd" }, > + {}, > +}; > +MODULE_DEVICE_TABLE(of, platform_lcd_of_match); > +#endif > + > static struct platform_driver platform_lcd_driver = { > .driver = { > .name = "platform-lcd", > @@ -152,6 +160,7 @@ static struct platform_driver platform_lcd_driver = { > #ifdef CONFIG_PM > .pm = &platform_lcd_pm_ops, > #endif > + .of_match_table = of_match_ptr(platform_lcd_of_match), > }, > .probe = platform_lcd_probe, > .remove = __devexit_p(platform_lcd_remove), This .c file includes no open-firmware headers. It does happen to get a copy of of.h via fb.h->i2c.h->of.h, but that was just luck. I did this: --- a/drivers/video/backlight/platform_lcd.c~backlight-platform-lcd-add-support-for-device-tree-based-probe-fix +++ a/drivers/video/backlight/platform_lcd.c @@ -16,6 +16,7 @@ #include #include #include +#include #include #include