Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3279357imm; Sun, 13 May 2018 07:57:37 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqXRhByocU1EKmToHZnBl8KApP9Q/4V8SdyqsplzNOkseUlotg1NzbHz7AJ5LYPbGIZIw6F X-Received: by 2002:a63:9612:: with SMTP id c18-v6mr5544381pge.361.1526223457778; Sun, 13 May 2018 07:57:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1526223457; cv=none; d=google.com; s=arc-20160816; b=dwQWhSQ00GExQ2rRd/v6abQFMjDNkdteL1BzrY66hDd99UsLygr5pIUyctyRurEPMy CXfW3x4sEG2vWqg07gcIHY6HCKTH3N9NNx9ai9sxTC5zxv8WNrVKWTYLifLuibp3XSNg sPfKthjgKQGQEzfUntF4+tGTZ9Sd3g6ev/WlJfb2AUqZm98PoBCekXHA4Gazlx32c4KI Y8wGbZVVXb/bD6NjPQvjhgcSgFqzOtse+tnRQLPd0EC7+3KcR0cwBNoqAJZ1RHGJAgz8 OofabGmI5kWP9kzlz/isZjjsCt7SDdENS+68k9zqK71vaxfzr1PmuHfZ7urSoaG+YeaP LNWA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=qxD9TKhljda7IsmM3wQY1dIw/JWtTkexxYSNIsa1BbY=; b=LjA2zlC9ECYEAh3mxf1+XrcVfSt3bUCngd1cEbeEWRfbLBWrVZzPYaxDEuy8lemAcB eAPLeNqQzxJsciJ3UrMZIKSdj13p5xdMIzt4YID4p1AcbHwRnzM/Pb8vIY2IZlfGaKpS p5vLk4zzKbGz867KKBJLcIqcRNyqjrmxjAz24v1JRkRUaPQ6XZxwfglMoDhmEFme4ton Axp55QpuMnoRKaGNVMy9TyBmFMFIimK7qsiy7NU0d6l6SXBrxCkTS+Ag30Afgb0XyOcK uaGWC3rESqMrI0O50V4uq5MeQahnkXZOktBdIIOXewyS500TAAXq/YkITUQiHuBCTsHH 1F1g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=vWMxaqYY; 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 t5-v6si7309867plo.113.2018.05.13.07.56.54; Sun, 13 May 2018 07:57:37 -0700 (PDT) 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=vWMxaqYY; 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 S1751739AbeEMO4q (ORCPT + 99 others); Sun, 13 May 2018 10:56:46 -0400 Received: from mail-qt0-f196.google.com ([209.85.216.196]:33205 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751270AbeEMO4o (ORCPT ); Sun, 13 May 2018 10:56:44 -0400 Received: by mail-qt0-f196.google.com with SMTP id e8-v6so13100604qth.0; Sun, 13 May 2018 07:56:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=qxD9TKhljda7IsmM3wQY1dIw/JWtTkexxYSNIsa1BbY=; b=vWMxaqYYG/rS0hWJ7PRG/ow0xWyc+WiSB+4zFx4Magb8zgCGD3y1YukshWC1vNEjs3 28SgYFS1JnGlqz9nKNgGZpYpnd46jVz7jbhyzNjXxF6T2cGUmoepqPhuMxEKjhV2rDh9 5vZoRZCeRMgtPaeMjh9QsZIrdk5Il7lt20hmOFmLJlpnbrMn5SG5qMfUjSEqw0qLxz7Q dZdZFvVt5gq7iArpmpN/LFsNhj7N3tpgb0tx0bP0ovO+bxie/SZM8uxSsbxR1MMplohr k+Xo+1W8a4z29LXkSq6tPTcLa1tRtJkA/KYtYCMveYwsr81cTyvM+uAuF480jF1THj6j M74g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=qxD9TKhljda7IsmM3wQY1dIw/JWtTkexxYSNIsa1BbY=; b=tocfA+1aSEO6fchQSMZq3ZMkvVCRLmilQYY06WanIdAwa8bzGta0wXa7gYaiJUfuMR c3iGH0MhzgDuICd4x+aspSSxRyZkiAdkGNT9DzI/8jSnNmmFII3W/pUe0iuucKre5L2F SaGaZMtoFnCwM/7Pn0e9mHpHEcCaW27jI4Uk214yWYAwA1HpkM8uiucKp4ygLMr0M/UF EL/1e7Avj4TQUBr9JLEqgxR17pJWfNZzMF7/4uB1wkUfFxbG+9c4FwRaaO22vNcvqMBZ 8WAhnh2byQGozHSZMf+xRcYIbKCYi/6PIpwsVLE/VCBF4G7SDCU95EbRNf5TcL6Q9JJ/ 5Kpw== X-Gm-Message-State: ALKqPwfyOA4yv/a4Dse7YwPYt/5lfp5SyXwjWadFHYYLvUCrhiAiAl2c NBLjESLCY5uF9sUZtXyHxZI2PBOnjrYBPI5rrYM= X-Received: by 2002:ac8:354f:: with SMTP id z15-v6mr5542049qtb.295.1526223403924; Sun, 13 May 2018 07:56:43 -0700 (PDT) MIME-Version: 1.0 Received: by 10.12.152.150 with HTTP; Sun, 13 May 2018 07:56:43 -0700 (PDT) In-Reply-To: <1526048528-3613-1-git-send-email-mark.jonas@de.bosch.com> References: <1521651874-15379-1-git-send-email-mark.jonas@de.bosch.com> <1526048528-3613-1-git-send-email-mark.jonas@de.bosch.com> From: Andy Shevchenko Date: Sun, 13 May 2018 17:56:43 +0300 Message-ID: Subject: Re: [PATCH v3] Input: add bu21029 touch driver To: Mark Jonas Cc: Dmitry Torokhov , Rob Herring , Mark Rutland , linux-input , devicetree , Linux Kernel Mailing List , Heiko Schocher , Zhu Yi Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, May 11, 2018 at 5:22 PM, Mark Jonas wrote: > Add Rohm BU21029 resistive touch panel controller support with I2C > interface. > +#include This becomes redundant (see below). > +#define STOP_DELAY_US 50L > +#define START_DELAY_MS 2L > +#define BUF_LEN 8L No need to use L for such small numbers. Integer promotion is a part of C standard. > +#define SCALE_12BIT (1 << 12) > +#define MAX_12BIT ((1 << 12) - 1) BIT(12) GENMASK(11, 0) > +static int bu21029_touch_report(struct bu21029_ts_data *bu21029) > +{ > + struct i2c_client *i2c = bu21029->client; > + u8 buf[BUF_LEN]; > + int error = bu21029_touch_report(bu21029); > + Redundant empty line. > + if (error) { > + dev_err(&i2c->dev, "failed to report (error: %d)\n", error); Potential spamming case. > + return IRQ_NONE; > + } > +static void bu21029_stop_chip(struct input_dev *dev) > +{ > + struct bu21029_ts_data *bu21029 = input_get_drvdata(dev); > + > + disable_irq(bu21029->client->irq); > + del_timer_sync(&bu21029->timer); > + > + /* put chip into reset */ > + gpiod_set_value_cansleep(bu21029->reset_gpios, 1); > + udelay(STOP_DELAY_US); udelay() ?! > +} > + > +static int bu21029_start_chip(struct input_dev *dev) > +{ > + u16 hwid; > + > + /* take chip out of reset */ > + gpiod_set_value_cansleep(bu21029->reset_gpios, 0); > + mdelay(START_DELAY_MS); mdelay()?! > + > + error = i2c_smbus_read_i2c_block_data(i2c, > + BU21029_HWID_REG, > + 2, > + (u8 *)&hwid); > + if (error < 0) { > + dev_err(&i2c->dev, "failed to read HW ID\n"); > + goto out; > + } > + > + if (cpu_to_be16(hwid) != SUPPORTED_HWID) { Hmm... Why cpu_to_be16() is required? > + dev_err(&i2c->dev, "unsupported HW ID 0x%x\n", hwid); > + error = -ENODEV; > + goto out; > + } > +} > +static int bu21029_parse_dt(struct bu21029_ts_data *bu21029) You can get rid of DT requirement by... > +{ > + struct device *dev = &bu21029->client->dev; > + struct device_node *np = dev->of_node; > + u32 val32; > + int error; > + if (!np) { > + dev_err(dev, "no device tree data\n"); > + return -EINVAL; > + } (this becomes redundant) > + > + bu21029->reset_gpios = devm_gpiod_get(dev, "reset", GPIOD_OUT_HIGH); > + if (IS_ERR(bu21029->reset_gpios)) { > + error = PTR_ERR(bu21029->reset_gpios); > + if (error != -EPROBE_DEFER) > + dev_err(dev, "invalid 'reset-gpios':%d\n", error); > + return error; > + } > + > + if (of_property_read_u32(np, "rohm,x-plate-ohms", &val32)) { ...simple calling device_property_read_u32() instead. > + dev_err(dev, "invalid 'x-plate-ohms' supplied\n"); > + return -EINVAL; > + } > + bu21029->x_plate_ohms = val32; > + > + touchscreen_parse_properties(bu21029->in_dev, false, &bu21029->prop); > + > + return 0; > +} > +#ifdef CONFIG_PM_SLEEP Instead... > +static int bu21029_suspend(struct device *dev) ...use __maby_unused annotation. > +static int bu21029_resume(struct device *dev) Ditto. -- With Best Regards, Andy Shevchenko