From patchwork Sat Sep 19 17:10:47 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 7222281 Return-Path: X-Original-To: patchwork-linux-input@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 720B7BEEC1 for ; Sat, 19 Sep 2015 17:11:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9965D206DF for ; Sat, 19 Sep 2015 17:11:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 8E23B206DE for ; Sat, 19 Sep 2015 17:11:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755135AbbISRLA (ORCPT ); Sat, 19 Sep 2015 13:11:00 -0400 Received: from mail-pa0-f45.google.com ([209.85.220.45]:34494 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755133AbbISRK7 (ORCPT ); Sat, 19 Sep 2015 13:10:59 -0400 Received: by padhy16 with SMTP id hy16so77950961pad.1 for ; Sat, 19 Sep 2015 10:10:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-type:content-disposition:in-reply-to:user-agent; bh=fQSu/sUMH7NrqCEj70+JV2dtNf+JXEJ1vBu0MmxbAfQ=; b=KCu54IK/bTcEY9o8qHq85HcYyUgZhuHitywRIA34isqwWnRbt2Pn5zzbVHXn4ZDPuB 0LHBVRI2QZXx6Lm1DtN/hpPYB2X0jbR9L0SFFKN1dyro1qoq6Bb976cu3KvnKRTPTeEk gZo7l/wfmVWItq9LqkQdWPVRQfY/mvKIyhLvv/N5OcCQMidGw99l8pAfcxkwDwp7fHLG NRVzoOzxMKAcIyRTl+iWYLJ2wT/0x951EdV2SvmbrihbGMzye6+3SMxdRUlycjqHvGpz LEUz3WdcVv5HIcDiwuVd6OgIR9OnxNSyDD/y0+cIFvLVa7+RI5BIZd6taNYfaT/BJ3tp Y+jw== X-Received: by 10.68.132.234 with SMTP id ox10mr14030642pbb.128.1442682658836; Sat, 19 Sep 2015 10:10:58 -0700 (PDT) Received: from dtor-ws ([2620:0:1000:1301:49a8:b934:2faf:9e7c]) by smtp.gmail.com with ESMTPSA id bi2sm15423810pbb.45.2015.09.19.10.10.48 (version=TLS1_2 cipher=AES128-SHA256 bits=128/128); Sat, 19 Sep 2015 10:10:56 -0700 (PDT) Date: Sat, 19 Sep 2015 10:10:47 -0700 From: Dmitry Torokhov To: Daniel Drake Cc: dusonlin@emc.com.tw, jprvita@gmail.com, linux-input@vger.kernel.org Subject: Re: [PATCH v2] elan_i2c - Don't require known iap version Message-ID: <20150919171047.GA7081@dtor-ws> References: <1442583495-4593-1-git-send-email-drake@endlessm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1442583495-4593-1-git-send-email-drake@endlessm.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-input-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, T_DKIM_INVALID, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Daniel, On Fri, Sep 18, 2015 at 07:38:15AM -0600, Daniel Drake wrote: > The Asus X456UA has an ELAN1000 touchpad with IAP version 0xe. > This is unknown to elan_get_fwinfo() so driver probe fails and I > am left with an unusable touchpad. > > However, the fwinfo is not required for general driver usage, > it is only needed if the user decides to upload new firmware. > > Adjust the driver so that fwinfo is only calculated and used > when it is really needed. I do not like the fact that the fact that the version of IAP is unknown is not known to the driver until we try to flash the firmware. I'd rather we check it upfront and warn user. How about the version of the patch below? Thanks! diff --git a/drivers/input/mouse/elan_i2c_core.c b/drivers/input/mouse/elan_i2c_core.c index fa94530..7cad819 100644 --- a/drivers/input/mouse/elan_i2c_core.c +++ b/drivers/input/mouse/elan_i2c_core.c @@ -266,11 +266,10 @@ static int elan_query_device_info(struct elan_tp_data *data) error = elan_get_fwinfo(data->iap_version, &data->fw_validpage_count, &data->fw_signature_address); - if (error) { - dev_err(&data->client->dev, - "unknown iap version %d\n", data->iap_version); - return error; - } + if (error) + dev_warn(&data->client->dev, + "unexpected iap version %#04x (ic type: %#04x), firmware update will not work\n", + data->iap_version, data->ic_type); return 0; } @@ -486,6 +485,9 @@ static ssize_t elan_sysfs_update_fw(struct device *dev, const u8 *fw_signature; static const u8 signature[] = {0xAA, 0x55, 0xCC, 0x33, 0xFF, 0xFF}; + if (data->fw_validpage_count == 0) + return -EINVAL; + /* Look for a firmware with the product id appended. */ fw_name = kasprintf(GFP_KERNEL, ETP_FW_NAME, data->product_id); if (!fw_name) {