Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp3358945imj; Tue, 19 Feb 2019 02:01:34 -0800 (PST) X-Google-Smtp-Source: AHgI3IZ4LwwwnBJjCZZU1/ZLTDYJuOMlo7vq+rboNFeJ6qO1ErizcJFY1op2S0x7e/aLZbQBz3/h X-Received: by 2002:a63:5964:: with SMTP id j36mr23090685pgm.210.1550570494125; Tue, 19 Feb 2019 02:01:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550570494; cv=none; d=google.com; s=arc-20160816; b=uFCliZESvwPUELFepRBvIqMR4aCGhxkFB6o3TeTuRzljL412QIZDAL+UntilOZmrq3 JuiL+bLfn9JXkOMp9couNCdxfox1eS+TyfniQt1JfKexLzoZhH/xs5Zp/xAnP9zZtjDP Z9Xhj3lV3jS8+TOdMBza9bNit+1uBQ3sPkofNna6APiO2mUyJsyn1b07aESCP80SRUEp Cr8d9aFp+PmcL8ILgAJ2J8008yXHmsztlp3EDyNd5IUINsaM9rRX/obtXlvEweABzzkg kDal48SpiGje2MJPIEA4rCRaG5eicvzFXhM7BMQ5fGgfVW4lQGdlK5Flls2dFYFcGtrE XpDg== 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=Csam0aHoPlPF6G9oDYw/RUABZHjBV3sf0fgbVkO/87UrFSDl4uwHWy6ucvMAVINHU/ o6q9eWhqxThjA44Vxc51F5GBAn3YW+BAqfPARXhS1LCrtPmnPk6RKYvL/mMaSdotJVe6 dQA9LXyOiLEL+f08ed82InSG4WLcvlEqNO3Tje2Hx+N0gBMYch9fHmVThfA882wmxKd9 pVXEIqUPVKfHla0mzWyKkMHfjHWxpTZpddPWRFcwfQALFakuMAZUDUMF6FC3zU/HwM0V kX+4ydyQp/yK2ZnOj1EbjHAZvt4TSQqmUwiCXUppIK7gQO27quDak2Mhtxfg/g9web+l 3WIA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=gmZYJq3E; 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 j135si15469192pgc.517.2019.02.19.02.01.18; Tue, 19 Feb 2019 02:01:34 -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=gmZYJq3E; 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 S1728231AbfBSJ67 (ORCPT + 99 others); Tue, 19 Feb 2019 04:58:59 -0500 Received: from mail-wr1-f65.google.com ([209.85.221.65]:41604 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727501AbfBSJ6Y (ORCPT ); Tue, 19 Feb 2019 04:58:24 -0500 Received: by mail-wr1-f65.google.com with SMTP id n2so9288516wrw.8; Tue, 19 Feb 2019 01:58:22 -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=gmZYJq3EVs/GLEYLKTki9zHJ0/gH7q1NM5Wr67MBcFn4on04RaJvIppP0LBCix+wjx QgRpbf3A25ui8nVgPUwR+uJFIXU0jCxExbx2A+sjgZwx5LnEdannR6RiWhR3ZTewWy6w UHOMButpLrk8sRedjlOIYFw/f6KvIVWPHygPD8jEJI0IfEv3yhrusX+hhbvJJe5Z+dz9 +THieDH+Y8638ptIpPasL2eTgIEks5/pOypEj2YWK3dCg3U1s+vf4PXnga+9FbO7BwkD /WPQNJ5syuax/6qs/yz9HiAcYY8FBtaoBlnahxuIyleFffCiOfblivF/5YtIaohUyznN lU8w== 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=JxMoULt1OEA2oZ0l9GGMicD7eNFLz9L2VzyCal3DDvx9k7/pVZOzA+MFCKKTv43SNG r04gRCTDVWBcbGizS6gD4JaAjy+owOmwJtjj4xGKQkhwvb2ZYK9oUegNIc/nqhMp8M0v QodZE9FnfMORwSRgALRSH/Y8e7g1fYmwCSMsJgRoqeH4J2x1PaZWDgNwU1VKqZ6PQXLP VTjRuyIaMw6e9dj9MoUyA8e8gYA5feVHyDlJOABOP7ZyJQeUjCIrALWKGgibQUOIrwzm 7A6lApjJI5YehH05kN/ZHWPBA47iVDx84Hy2fpHiQJbuprPv7shlgnVBCwD/UJQAzVOl PLfg== X-Gm-Message-State: AHQUAuavu6U7bxhsfwL525UKaT0zsO413RhH074Tv0qUfLBFIyG5MGxA IcZKscojGU/3Oe6JEeDcRC8= X-Received: by 2002:adf:c752:: with SMTP id b18mr20122745wrh.105.1550570301773; Tue, 19 Feb 2019 01:58:21 -0800 (PST) Received: from fuji.Parrot.Biz (smtp.parrot.biz. [62.23.167.188]) by smtp.gmail.com with ESMTPSA id k20sm31639220wre.41.2019.02.19.01.58.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 19 Feb 2019 01:58:20 -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 v3 1/3] pwm: hibvt: Use individual struct per of-data. Date: Tue, 19 Feb 2019 10:58:06 +0100 Message-Id: <20190219095808.12059-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