Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp362458pxa; Wed, 19 Aug 2020 03:33:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzHaOXU8HO2FCXZw/jmJ5KKjF7j47oKVF9KyjFs7W9PFP+vgDUZtSFPo9mJx9uCBHbYqJc5 X-Received: by 2002:aa7:da0e:: with SMTP id r14mr24371257eds.236.1597833201881; Wed, 19 Aug 2020 03:33:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597833201; cv=none; d=google.com; s=arc-20160816; b=BR8KThPnMOyU9qFdSE+GJFDkxOdmTqTPKA15zIr96C9hHWLAgIndLgmRRINYTjGBrO 8NgsOuWB39U2AYSnaaJRVK5bG3rPzkhnyar+RKRMj0lEiRwa/jo0a2NtCamMqhStjpkp rZrJsZc4R//B92bTYq1baV7mugvR4nIRC7M+JO/T5e+58diPb5XBvwLiH4CKw5p3j7zZ 6EFl9q2CA+1uabW36DWSFKCLPtmeQwcEKxi2U7XVF2tGdM7i+QznsZQVosq/MwOz+VPx QcCNGMoTpCQ8QI6oKk5gXVC4YrGqtRHsWpoNJzHDMsI3yMlyuHkqt4I84tn3QBv8nFLL zsMQ== 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 :in-reply-to:references:mime-version:dkim-signature; bh=anNefZypNBNyeAiop+Awx8oJbDXiIkICXZ8m5YrLk34=; b=NyqBy11aRxlAwLO5D0BnpWhOEwq7Xz3XxXDQhsaoALnR9AbjchWmTEkPKSbu6G7V3K yeIZXDi3BvsXN2FenT1DoG1w1eaIlrf/MAFrHXbYLvq6d5hJvBOsi5BsSJjMOw371Lv4 RGJjxU3tM7Gk+zzodvM9wvzNsHDiKJVe3j8mUG1GE2qiKPYuSQ+/VD4G2O4rizmNjIYg GVccFSFQ3pReJ92FENxAvLI2mT++h+yaifmcsH/myZnNTMqGUvXx5e89BO1xxJ7kNcpE Zd7d/8m93hKuYALJ868o94BJv/pr7iCDO48XFlcgmHJ6aiLNmmlBPM5RnfV6U80tWe6Y l0aw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OcjB70+i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id a26si14390533eds.337.2020.08.19.03.32.57; Wed, 19 Aug 2020 03:33:21 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=OcjB70+i; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1727102AbgHSKcX (ORCPT + 99 others); Wed, 19 Aug 2020 06:32:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726642AbgHSKcS (ORCPT ); Wed, 19 Aug 2020 06:32:18 -0400 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 12B02C061757; Wed, 19 Aug 2020 03:32:15 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id f193so11448160pfa.12; Wed, 19 Aug 2020 03:32:15 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=anNefZypNBNyeAiop+Awx8oJbDXiIkICXZ8m5YrLk34=; b=OcjB70+iaINz8+km8ALYsIDidVUELFZ5RZJb7PaZ37nIwMbCOssnD8pIZH11dawT+J 4AbF3evMUTKdRnWlphEkKXkEfW8N0fda5qiej4LW75S3Z/fb8cepse7hvQWoI5jjJG5I IfX9Uzp7QxgfOcW0btEWH9WHxj4Cjs/P6XVW/TRmsSlMOd81+cWZl9FSXh6KMI0CPc5A +hJYQ8yqYwKvmlfxKuu97tedKwQNbOneZK3YKzaa+3VuN+vlW+dRLGq1demCof337wEb SoZo5p0KnC13KZh5Q4salCJzr29uCqv6j1iMySqUasFpo2ZomL883zHHK2ZuHb0VhtRY diiQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=anNefZypNBNyeAiop+Awx8oJbDXiIkICXZ8m5YrLk34=; b=GqIIRwFDb+/Xui029976StX6YeUam+vZhX4pJvOUQ3AK4zbXmA/pfBScL0H5bFNxAS Mq6ga0BziId4cyW6efLmQg9wbPfl+zH6ayKNwXJZ6P95vzar/Kw7udxDFz6IUOJhN1Mv 9PSSrzGAV5bzDe9hsLiGKAaLO1buOPbIQBUstcLTFPDUY5Bb52VqV16i2fnWNttjSCDo 5AR9FKV0PdGrgFajkijLhkc6cCvBp3ZC1k8aQ3AUpw5SJ+VG5O0VcSROHdgDKr3eZHCt VLbnvufOORVl/zMstP4n3J/9ch2FjLoC4p/Umx9mUGm/Muv/alKKQEiJ7byTwPkEiUUy rZQw== X-Gm-Message-State: AOAM531Ib1DOnP/S7d2Y/KwESSlQB2CWX9PTM1Qym3WDMhBizP8mlUV+ 4TlzTlguXI/e0cDBjWxU/RILNPi0jVs+1wli47s= X-Received: by 2002:a63:ec18:: with SMTP id j24mr15765794pgh.74.1597833134742; Wed, 19 Aug 2020 03:32:14 -0700 (PDT) MIME-Version: 1.0 References: <20200810213055.103962-1-Sandeep.Singh@amd.com> <20200810213055.103962-4-Sandeep.Singh@amd.com> In-Reply-To: <20200810213055.103962-4-Sandeep.Singh@amd.com> From: Andy Shevchenko Date: Wed, 19 Aug 2020 13:31:58 +0300 Message-ID: Subject: Re: [PATCH v7 3/4] SFH: Transport Driver to add support of AMD Sensor Fusion Hub (SFH) To: Sandeep Singh Cc: Jiri Kosina , Benjamin Tissoires , Linux Kernel Mailing List , linux-input , Srinivas Pandruvada , Jonathan Cameron , linux-iio , Hans de Goede , "Shah, Nehal-bakulchandra" , Richard Neumann , Marco Felsch , Randy Dunlap , Shyam-sundar.S-k@amd.com 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 Tue, Aug 11, 2020 at 12:31 AM Sandeep Singh wrote: > This part of module will provide the interaction between HID framework of the module > and client layer.This module will registered client layer with register > HID framework. ... > +/* Is it kernel doc or not? Fix this in all occurrences. > + * amdtp_hid_parse() - hid-core .parse() callback > + * @hid: hid device instance > + * > + * This function gets called during call to hid_add_device > + * > + * Return: 0 on success and non zero on error > + */ ... > +static void amdtp_hid_request(struct hid_device *hid, struct hid_report *rep, int reqtype) > +{ > + int rc; > + > + switch (reqtype) { > + case HID_REQ_GET_REPORT: > + rc = amd_sfh_get_report(hid, rep->id, rep->type); > + if (rc) > + pr_err("AMDSFH get report error "); Use dev_err() and similar in the other places. > + break; > + case HID_REQ_SET_REPORT: > + amd_sfh_set_report(hid, rep->id, reqtype); > + break; > + default: > + break; > + } > +} ... > + if (!cli_data->request_done[i]) > + ret = wait_event_interruptible_timeout(hid_data->hid_wait, > + cli_data->request_done[i], 1500); Magic number! > + if (ret > 0) > + return 0; Usually we return errors first... > + else if (ret == -ERESTARTSYS) > + return -ERESTARTSYS; > + else > + return -ETIMEDOUT; > +} ... > + hid = hid_allocate_device(); > + if (IS_ERR(hid)) { > + rc = PTR_ERR(hid); > + return rc; Why do you need two lines here? > + } ... > + hid_data = kzalloc(sizeof(*hid_data), GFP_KERNEL); devm_kzalloc() ? > + if (!hid_data) { > + rc = -ENOMEM; > + goto err_hid_data; > + } ... > +#define AMD_SFH_HID_VENDOR 1022 Decimal?! > +#define AMD_SFH_HID_PRODUCT 0x0001 ... > +#include > +#include > +#include > +#include > +#include > +#include Huh?! linux/errno.h + blank line here. > +#include "hid_descriptor/amd_sfh_hid_descriptor.h" > +#include "amdsfh_hid.h" > +#include "amd_mp2_pcie.h" ... > +#define PERIOD 200 Too generic name (namespace?), absence of unit. ... > + for (i = 0; i < cli_data->num_hid_devices; i++) { > + if (cli_data->hid_sensor_hubs[i] == hid) { if (!...) continue; ? > + struct request_list *new = kzalloc(sizeof(*new), GFP_KERNEL); > + > + if (!new) > + return -ENOMEM; > + new->current_index = i; > + new->sensor_idx = cli_data->sensor_idx[i]; > + new->hid = hid; > + new->report_type = report_type; > + new->report_id = report_id; > + cli_data->report_id[i] = report_id; > + cli_data->request_done[i] = false; > + list_add(&new->list, &req_list.list); > + break; > + } > + } -- With Best Regards, Andy Shevchenko