From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbdE3KOC (ORCPT ); Tue, 30 May 2017 06:14:02 -0400 Received: from mail-wm0-f53.google.com ([74.125.82.53]:38045 "EHLO mail-wm0-f53.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751364AbdE3KN7 (ORCPT ); Tue, 30 May 2017 06:13:59 -0400 Date: Tue, 30 May 2017 11:13:50 +0100 From: Lee Jones To: Jan Kiszka Cc: Linux Kernel Mailing List , Andy Shevchenko , Sascha Weisenberger Subject: Re: [PATCH v3 1/2] mfd: intel_quark_i2c_gpio: Use dmi_system_id table for retrieving frequency Message-ID: <20170530101350.ay6eotxzfttpnfrx@dell> References: <781e53b10a5cb589fbe0d1a92e90f9c3b5759499.1496132260.git.jan.kiszka@siemens.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <781e53b10a5cb589fbe0d1a92e90f9c3b5759499.1496132260.git.jan.kiszka@siemens.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 30 May 2017, Jan Kiszka wrote: > Avoids reimplementation of DMI matching in intel_quark_i2c_setup. > > Signed-off-by: Jan Kiszka > Reviewed-by: Andy Shevchenko > --- > drivers/mfd/intel_quark_i2c_gpio.c | 33 +++++++++++++-------------------- > 1 file changed, 13 insertions(+), 20 deletions(-) Applied, thanks. > diff --git a/drivers/mfd/intel_quark_i2c_gpio.c b/drivers/mfd/intel_quark_i2c_gpio.c > index 7946d6e38b87..050061320377 100644 > --- a/drivers/mfd/intel_quark_i2c_gpio.c > +++ b/drivers/mfd/intel_quark_i2c_gpio.c > @@ -58,19 +58,18 @@ struct intel_quark_mfd { > struct clk_lookup *i2c_clk_lookup; > }; > > -struct i2c_mode_info { > - const char *name; > - unsigned int i2c_scl_freq; > -}; > - > -static const struct i2c_mode_info platform_i2c_mode_info[] = { > +static const struct dmi_system_id dmi_platform_info[] = { > { > - .name = "Galileo", > - .i2c_scl_freq = 100000, > + .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "Galileo"), > + }, > + .driver_data = (void *)100000, > }, > { > - .name = "GalileoGen2", > - .i2c_scl_freq = 400000, > + .matches = { > + DMI_EXACT_MATCH(DMI_BOARD_NAME, "GalileoGen2"), > + }, > + .driver_data = (void *)400000, > }, > {} > }; > @@ -160,8 +159,7 @@ static void intel_quark_unregister_i2c_clk(struct device *dev) > > static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell) > { > - const char *board_name = dmi_get_system_info(DMI_BOARD_NAME); > - const struct i2c_mode_info *info; > + const struct dmi_system_id *dmi_id; > struct dw_i2c_platform_data *pdata; > struct resource *res = (struct resource *)cell->resources; > struct device *dev = &pdev->dev; > @@ -181,14 +179,9 @@ static int intel_quark_i2c_setup(struct pci_dev *pdev, struct mfd_cell *cell) > /* Normal mode by default */ > pdata->i2c_scl_freq = 100000; > > - if (board_name) { > - for (info = platform_i2c_mode_info; info->name; info++) { > - if (!strcmp(board_name, info->name)) { > - pdata->i2c_scl_freq = info->i2c_scl_freq; > - break; > - } > - } > - } > + dmi_id = dmi_first_match(dmi_platform_info); > + if (dmi_id) > + pdata->i2c_scl_freq = (uintptr_t)dmi_id->driver_data; > > cell->platform_data = pdata; > cell->pdata_size = sizeof(*pdata); -- Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog