Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753582AbaBKVag (ORCPT ); Tue, 11 Feb 2014 16:30:36 -0500 Received: from mail-vc0-f173.google.com ([209.85.220.173]:32893 "EHLO mail-vc0-f173.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751664AbaBKVae (ORCPT ); Tue, 11 Feb 2014 16:30:34 -0500 MIME-Version: 1.0 In-Reply-To: References: <1392122211-11422-1-git-send-email-laurent.pinchart@ideasonboard.com> <1596542.hkJp71u3OJ@avalon> <20140211164825.GC841@joshc.qualcomm.com> <6446980.WMjvBYStRY@avalon> <20140211180845.GG841@joshc.qualcomm.com> Date: Tue, 11 Feb 2014 15:30:33 -0600 Message-ID: Subject: Re: [PATCH] of: Turn of_match_node into a static inline when CONFIG_OF isn't set From: Rob Herring To: Geert Uytterhoeven Cc: Josh Cartwright , Laurent Pinchart , "linux-kernel@vger.kernel.org" , "devicetree@vger.kernel.org" , Grant Likely , Rob Herring Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Feb 11, 2014 at 12:29 PM, Geert Uytterhoeven wrote: > On Tue, Feb 11, 2014 at 7:08 PM, Josh Cartwright wrote: >> It sure would be convenient if platform_device had a 'const struct >> of_device_id *of_id_entry' member similar to the existing struct >> platform_device_id one, that was set up during platform device matching. >> Most platform_driver users of of_match_node() would simply go away. > > Can't the entry be shared for both platform_device_id and of_device_id? > Only one of them can be valid at the same time, right? > > Ideally, all xxx_device_id look like > > struct xxx_device_id { > ... /* bus-specific ID information */ > kernel_ulong_t driver_data; > }; > > This may be formalized in some way, using a base class, but thay may > require reordering the fields, like: > > struct base_device_id { > kernel_ulong_t driver_data; > long id[0]; > }; > I believe this is the reason drivers have to call of_match_device: commit b1608d69cb804e414d0887140ba08a9398e4e638 Author: Grant Likely Date: Wed May 18 11:19:24 2011 -0600 drivercore: revert addition of of_match to struct device Commit b826291c, "drivercore/dt: add a match table pointer to struct device" added an of_match pointer to struct device to cache the of_match_table entry discovered at driver match time. This was unsafe because matching is not an atomic operation with probing a driver. If two or more drivers are attempted to be matched to a driver at the same time, then the cached matching entry pointer could get overwritten. This patch reverts the of_match cache pointer and reworks all users to call of_match_device() directly instead. Signed-off-by: Grant Likely Rob -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/