Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp242231imj; Wed, 13 Feb 2019 07:36:54 -0800 (PST) X-Google-Smtp-Source: AHgI3IbBp5nhaOMHUL8O1fdCjHkfUNueokF2aerGe7CaG7EPP1prnpkWs5Fj5o5IRMrduWBcm/CE X-Received: by 2002:a62:31c1:: with SMTP id x184mr1105248pfx.204.1550072214448; Wed, 13 Feb 2019 07:36:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550072214; cv=none; d=google.com; s=arc-20160816; b=NRI0biGdsqH/Z6t+9tKT05le1e1ATFml8D9C1hE1RWn3rMBf9Bc8PwPJqrBtZUwZzj 3GXdonLKlGXtDp8n1vXx2N4hqeowrJaOys1wo8ITUWr+54s3Fe4SjEVUwg2CpSbNOxUO J2FU/itsuJKELH7LY2g8IyaZ37ogH2yFKlDuPGcysScwf7f3s+0tXt9ZCrfngTKV6Dis QWNI73agOq4Movtqgc7GpwGIhpiHpAIfQQN6O/aWO3yHxLJI2jA6eeWGY0mFrCVXVH6n HKbnVnZyPrKrKHtHOcG3v72WVOwr09jvF8u+757hedZDbLS1vGFZMBVFKUw2ELycenBh rtXw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=SKvnZE8FRNSDrOi2i7LIYAhX4r86ogk967jOuzBNxJ8=; b=usw7FqmtLwF2YQ75RCpxs7vGfdxAoJPuv2A+zGyC3HRmgQ/KiRamrFRd2+Lo1vfKQq PUljLmOcn25SkSiKM/tGF3zyjySt+4bYJJ96oKc20gV9CPLq1UjcxDlkvEp6HWmepdh3 8cyNdal98svc9QGgqK3k8wxEEiLx+7MYnGEE/83brlaXTRofOY0/49Pi7b3xwW71iYMl 8RBSNcysiqpdmXFaAjg1v1DBryTLhrNplADCS5meLn6QLIx4HabWkHXGlfFFRGr2y6cX XQKuZ2+pQHYZfrHD4pqZtqrXngjHi3CnFTP+Ssw0hrMqmwRW5NB3gvotmYp1R/NGgSsu 2r/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZB6jQM0B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id v22si15182998plo.129.2019.02.13.07.36.38; Wed, 13 Feb 2019 07:36:54 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=ZB6jQM0B; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2404093AbfBMPFR (ORCPT + 99 others); Wed, 13 Feb 2019 10:05:17 -0500 Received: from mail-wm1-f67.google.com ([209.85.128.67]:51861 "EHLO mail-wm1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726317AbfBMPFQ (ORCPT ); Wed, 13 Feb 2019 10:05:16 -0500 Received: by mail-wm1-f67.google.com with SMTP id b11so2847690wmj.1; Wed, 13 Feb 2019 07:05:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=SKvnZE8FRNSDrOi2i7LIYAhX4r86ogk967jOuzBNxJ8=; b=ZB6jQM0BV+40kIie7WHvQcTe4kxy+1PHRNwAb0StxGRm6J6jAylTx7ASPg/OjKdSHA 1GQZ1qb7u0cz3zQTt8fhos29G/vLKQ1P/LKBq7xFr1qIEjpN9M4t5CV5L84g8A/jn7D0 trzyphRGSCWSoXzIYYfQ5moiRK2W7LUkwOG0uyBwY46FkyE0RapIQh2t9fibtk6NcoD+ sC1FM8/0ILtosBed363QhikfMTH535RFM6cXmedD45J0YbZ5MqSNh9sgPN5fEyjc2KFM MZOfcLMi+xlWOi+CinczIR8wRcwbjCTqixSB8mPGkYZqF4UocZ9sdIZygpWgPO0kNJxx 08SA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=SKvnZE8FRNSDrOi2i7LIYAhX4r86ogk967jOuzBNxJ8=; b=Wab1ZDf7nySpgWQwpR492BmEnAB6eV9DV+21kLNJ/sAeJNYOt5qTBJ9qfcHqreKMI6 FeX8LZchZMjwtWVqOW2Qd54KLHgYVxXR6Be3M27igqNr5By6dumefZtSPbomsy0W0VKi HxHsM+10ZHPj47Ae3HvVCQefc3QwjatDGXZlbn44fhEasZkq4BXQu6vAgfo7Bn3GahT/ iNMVpW+CxsoA0b6r0dTcl+7Oo0iw6HOgnQM+OMrUGEyHcF/mDB4mHdrvf8Tbw3wLtiav UeoiPNvklmrNKOY2X2DVIIAPyagd43EE2qeeenNi/UzBrJLmen1qEEPFUzqMnu08WEq4 h8Cg== X-Gm-Message-State: AHQUAubt21UiMHvXmmnWslYfY0LoA2a4BaEAb+/Zy6VlwUzbEyS/HySy dVzfIn22fTsHMfqHpa90DB8raRg0chQ= X-Received: by 2002:a1c:8088:: with SMTP id b130mr663511wmd.96.1550070313917; Wed, 13 Feb 2019 07:05:13 -0800 (PST) Received: from fuji.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id f187sm7533959wma.4.2019.02.13.07.05.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Feb 2019 07:05:13 -0800 (PST) From: Mathieu Othacehe To: thierry.reding@gmail.com, robh+dt@kernel.org, mark.rutland@arm.com Cc: linux-pwm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, Mathieu Othacehe Subject: [PATCH v2 1/3] pwm: hibvt: Use individual struct per of-data. Date: Wed, 13 Feb 2019 16:05:06 +0100 Message-Id: <20190213150508.11499-1-m.othacehe@gmail.com> X-Mailer: git-send-email 2.17.1 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Split pwm-soc array in one struct per soc and point to the corresponding on in of-data. Signed-off-by: Mathieu Othacehe --- drivers/pwm/pwm-hibvt.c | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/drivers/pwm/pwm-hibvt.c b/drivers/pwm/pwm-hibvt.c index 27c107e78d59..ffc803818c3c 100644 --- a/drivers/pwm/pwm-hibvt.c +++ b/drivers/pwm/pwm-hibvt.c @@ -49,15 +49,19 @@ struct hibvt_pwm_chip { struct clk *clk; void __iomem *base; struct reset_control *rstc; + const struct hibvt_pwm_soc *soc; }; struct hibvt_pwm_soc { u32 num_pwms; }; -static const struct hibvt_pwm_soc pwm_soc[2] = { - { .num_pwms = 4 }, - { .num_pwms = 8 }, +static const struct hibvt_pwm_soc hi3516cv300_soc_info = { + .num_pwms = 4, +}; + +static const struct hibvt_pwm_soc hi3519v100_soc_info = { + .num_pwms = 8, }; static inline struct hibvt_pwm_chip *to_hibvt_pwm_chip(struct pwm_chip *chip) @@ -198,6 +202,7 @@ static int hibvt_pwm_probe(struct platform_device *pdev) pwm_chip->chip.npwm = soc->num_pwms; pwm_chip->chip.of_xlate = of_pwm_xlate_with_flags; pwm_chip->chip.of_pwm_n_cells = 3; + pwm_chip->soc = soc; res = platform_get_resource(pdev, IORESOURCE_MEM, 0); pwm_chip->base = devm_ioremap_resource(&pdev->dev, res); @@ -250,8 +255,10 @@ static int hibvt_pwm_remove(struct platform_device *pdev) } static const struct of_device_id hibvt_pwm_of_match[] = { - { .compatible = "hisilicon,hi3516cv300-pwm", .data = &pwm_soc[0] }, - { .compatible = "hisilicon,hi3519v100-pwm", .data = &pwm_soc[1] }, + { .compatible = "hisilicon,hi3516cv300-pwm", + .data = &hi3516cv300_soc_info }, + { .compatible = "hisilicon,hi3519v100-pwm", + .data = &hi3519v100_soc_info }, { } }; MODULE_DEVICE_TABLE(of, hibvt_pwm_of_match); -- 2.17.1