linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Sandeep Singh <Sandeep.Singh@amd.com>
Cc: Jiri Kosina <jikos@kernel.org>,
	Benjamin Tissoires <benjamin.tissoires@redhat.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	linux-input <linux-input@vger.kernel.org>,
	Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio <linux-iio@vger.kernel.org>,
	Hans de Goede <hdegoede@redhat.com>,
	"Shah, Nehal-bakulchandra" <Nehal-bakulchandra.Shah@amd.com>,
	Richard Neumann <mail@richard-neumann.de>,
	Marco Felsch <m.felsch@pengutronix.de>,
	Randy Dunlap <rdunlap@infradead.org>,
	Shyam-sundar.S-k@amd.com
Subject: Re: [PATCH v7 3/4] SFH: Transport Driver to add support of AMD Sensor Fusion Hub (SFH)
Date: Wed, 19 Aug 2020 13:31:58 +0300	[thread overview]
Message-ID: <CAHp75VfO-6UOy=u+tX-iFb0XtNs_6Xfk3ZAQn6Rg9739JxULdg@mail.gmail.com> (raw)
In-Reply-To: <20200810213055.103962-4-Sandeep.Singh@amd.com>

On Tue, Aug 11, 2020 at 12:31 AM Sandeep Singh <Sandeep.Singh@amd.com> 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 <linux/dma-mapping.h>
> +#include <linux/hid.h>
> +#include <linux/list.h>
> +#include <linux/slab.h>
> +#include <linux/workqueue.h>

> +#include <uapi/asm-generic/errno-base.h>

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

  reply	other threads:[~2020-08-19 10:32 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-10 21:30 [PATCH v7 0/4] SFH: Add Support for AMD Sensor Fusion Hub Sandeep Singh
2020-08-10 21:30 ` [PATCH v7 1/4] SFH: Add maintainers and documentation for AMD SFH based on HID framework Sandeep Singh
2020-08-10 23:23   ` Randy Dunlap
2020-08-19 10:23   ` Andy Shevchenko
2020-08-10 21:30 ` [PATCH v7 2/4] SFH: PCIe driver to add support of AMD sensor fusion hub Sandeep Singh
2020-08-10 23:03   ` Randy Dunlap
2020-08-11 13:54   ` Marco Felsch
2020-08-10 21:30 ` [PATCH v7 3/4] SFH: Transport Driver to add support of AMD Sensor Fusion Hub (SFH) Sandeep Singh
2020-08-19 10:31   ` Andy Shevchenko [this message]
2020-08-10 21:30 ` [PATCH v7 4/4] SFH: Create HID report to Enable support of AMD sensor fusion " Sandeep Singh

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAHp75VfO-6UOy=u+tX-iFb0XtNs_6Xfk3ZAQn6Rg9739JxULdg@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=Nehal-bakulchandra.Shah@amd.com \
    --cc=Sandeep.Singh@amd.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=benjamin.tissoires@redhat.com \
    --cc=hdegoede@redhat.com \
    --cc=jic23@kernel.org \
    --cc=jikos@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-input@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=m.felsch@pengutronix.de \
    --cc=mail@richard-neumann.de \
    --cc=rdunlap@infradead.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).