From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753581AbbCEAsb (ORCPT ); Wed, 4 Mar 2015 19:48:31 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:35866 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753368AbbCEAs3 (ORCPT ); Wed, 4 Mar 2015 19:48:29 -0500 Date: Wed, 4 Mar 2015 16:48:27 -0800 From: Dmitry Torokhov To: Greg KH Cc: Charlie Mooney , linux-kernel@vger.kernel.org, ming.lei@canonical.com Subject: Re: [PATCH] firmware_class: Add firmware filename overrides Message-ID: <20150305004827.GC3325@dtor-glaptop> References: <1425511510-1674-1-git-send-email-charliemooney@chromium.org> <20150304235709.GA27233@kroah.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20150304235709.GA27233@kroah.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Mar 04, 2015 at 03:57:09PM -0800, Greg KH wrote: > On Wed, Mar 04, 2015 at 03:25:10PM -0800, Charlie Mooney wrote: > > This patch adds an additional feature to the firmware_class.c module. > > To allow a unified method of specifying new firmware locations when > > drivers request a firmware binary to update their devices with, we > > have added the concept of a "fw override" > > > > A fw override is a rule that matches firmware requests based on the > > name of the device requesting the fw and what the filename for the > > fw they are requesting is, and overrides their requests with a new > > value. > > > > Overrides are set up by piping a description of the override into > > an attribute set up at /sys/class/firmware/fw_override. The string > > should be a null-deliminited list of the firmware name you want to > > over ride, the new name to replace it with, and the device name that > > you want the override to apply to. For example you could set up > > an override for a device called "my_device" so that any time it > > requests a firmware called "my_fw.bin" it instead gets "new_fw.bin" > > with the following command: > > > > echo -e 'my_fw.bin\0new_fw.bin\0my_device\0' > > > /sys/class/firmware/fw_override > > I hate to ask, but I have to, why do you need this? We may have single driver serve several devices (a touchscreen and a touchpad) that require different firmware/config file to function. We have several options: - modify the driver to allow changing firmware name from userspace - gets old when there are several drivers that need that; - encode part numbers in the driver and request different firmware - not easily maintainable, still has an issue that same part might be used for different devices; - replace the firmware file on disk before initiating firmware load - does not work well with read-only file systems; - have udev supply different data - udev went out of fashion; - have one central place (firmware loader) that users can control to override the names - this solution. Thanks. -- Dmitry