From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 25601C433DF for ; Tue, 16 Jun 2020 11:02:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id EA819207C4 for ; Tue, 16 Jun 2020 11:02:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1725901AbgFPLCZ (ORCPT ); Tue, 16 Jun 2020 07:02:25 -0400 Received: from jabberwock.ucw.cz ([46.255.230.98]:54364 "EHLO jabberwock.ucw.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725768AbgFPLCZ (ORCPT ); Tue, 16 Jun 2020 07:02:25 -0400 Received: by jabberwock.ucw.cz (Postfix, from userid 1017) id 3FC5A1C0C0F; Tue, 16 Jun 2020 13:02:23 +0200 (CEST) Date: Tue, 16 Jun 2020 13:02:16 +0200 From: Pavel Machek To: Fengping Yu Cc: Dmitry Torokhov , Matthias Brugger , Catalin Marinas , Yingjoe Chen , Jacek Anaszewski , linux-input@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org Subject: Re: [PATCH v1 2/3] drivers: input: misc: Add mtk vibrator driver Message-ID: <20200616110216.GK1718@bug> References: <20200615114203.116656-1-fengping.yu@mediatek.com> <20200615114203.116656-3-fengping.yu@mediatek.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20200615114203.116656-3-fengping.yu@mediatek.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org Hi! > +static int mt_vibra_parse_dt(struct device *dev, > + struct reg_vibr_config *vibr_conf) > +{ > + int ret; > + > + if (device_property_read_u32(dev, "min-limit", > + &vibr_conf->min_limit)) > + vibr_conf->min_limit = DEFAULT_MIN_LIMIT; > + vibr_conf->min_limit = max_t(unsigned int, > + vibr_conf->min_limit, DEFAULT_MIN_LIMIT); > + > + if (device_property_read_u32(dev, "max-limit", > + &vibr_conf->max_limit)) > + vibr_conf->max_limit = 0; Is max_limit useful? Do you enforce it in useful way? > + if (!vibr_conf->max_limit && > + vibr_conf->max_limit < vibr_conf->min_limit) { > + dev_err(dev, "error load dts: get error limitation(min > max)\n"); > + return -EINVAL; > + } Condition looks wrong. > +static struct attribute *sysfs_attrs[] = { + &dev_attr_activate.attr, + > &dev_attr_state.attr, + &dev_attr_duration.attr, + NULL, +}; + +static struct > attribute_group vibr_group = { + .attrs = sysfs_attrs, +}; + +static int > regulator_oc_event(struct notifier_block *nb, + unsigned long event, void *data) +{ + Do you need custom attributes? Why? Where is their documentation? Pavel -- (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html