platform-driver-x86.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Shravan S <s.shravan@intel.com>
Cc: Hans de Goede <hdegoede@redhat.com>,
	Mark Gross <mgross@linux.intel.com>,
	Platform Driver <platform-driver-x86@vger.kernel.org>,
	"An, Sudhakar" <sudhakar.an@intel.com>
Subject: Re: [PATCH V2 1/1] [x86]: BIOS Dynamic SAR driver for Intel M.2 Modem
Date: Thu, 24 Jun 2021 13:24:36 +0300	[thread overview]
Message-ID: <CAHp75Ve_=mv5MbLvqxGwu8GAuxAjBLpRHE9KNua-yvmzUNKuKw@mail.gmail.com> (raw)
In-Reply-To: <20210510074016.31627-2-s.shravan@intel.com>

On Wed, Jun 23, 2021 at 5:04 PM Shravan S <s.shravan@intel.com> wrote:

Besides the fact of missed documentation, this code is far from the
upstream-ready quality.
Send a new version to our internal mailing list for the detailed review.

And as I said, the interface should be provided by WWAN subsystem (or
whatever subsystem(s) for this will be suitable *), while this should
be a driver between actual implementation and the abstract interface.
I believe this kind of feature will be needed (if not used already) by
non-Intel hardware and we should have a more unified interface from
day 1. Is it possible?

*) maybe you need to introduce a layer which will provide a common
interface between subsystems and hardware blocks for this kind of
functionality. Either way, lack of documentation is perceptible.

> V2 :
> * Changes to the remove netlink and introduce sysfs to communicate to Userspace via notify
> * Handled review comments by changing ioctl calls to sysfs
> * "sar" name change for platform_device_id to "intc1092"
> * sar_init and sar_exit is modified as per review to minimal initialization
> * Inclusion of debug only enabling of device mode change parameters

You mixed up changelog / commit message / cover letter altogether.
...

> +config INTEL_SAR
> +       tristate "Intel Specific Absorption Rate Driver"
> +       depends on ACPI
> +       help
> +         This driver limit the exposure of human body to RF frequency by informing
> +         the Intel M.2 modem to regulate the RF power based on SAR data obtained
> +         from the sensorscaptured in the BIOS. ACPI interface exposes this data

sensors captured

> +         from the BIOS to SAR driver. The front end application in userspace
> +         will interact with SAR driver to obtain information like the device mode,
> +         Antenna index,baseband index, SAR table index and use available communication
> +         like MBIM interface to enable data communication to modem for RF power regulation.

...

> +static void sar_send_notify(void)
> +{
> +               if (!context) {

> +                       pr_alert("%s: context is null\n", __func__);

Is it dead code?

> +                       return;
> +               }
> +               pr_debug("%s: %d, %d, %d, %d\n", __func__, context->sar_data.device_mode,
> +                        context->sar_data.bandtable_index, context->sar_data.antennatable_index,
> +                        context->sar_data.sartable_index);
> +               sysfs_notify(context->sar_kobject, NULL, "intc_data");
> +}

...

> +static void update_sar_data(void)
> +{
> +               pr_debug("%s: Update SAR data\n", __func__);
> +               if (context->config_data[context->reg_value].device_mode_info &&
> +                   context->sar_data.device_mode <=
> +                   context->config_data[context->reg_value].total_dev_mode) {
> +                       context->sar_data.antennatable_index =
> +                       context->config_data[context->reg_value]
> +                       .device_mode_info[context->sar_data.device_mode].antennatable_index;
> +                       context->sar_data.bandtable_index =
> +                       context->config_data[context->reg_value]
> +                       .device_mode_info[context->sar_data.device_mode].bandtable_index;
> +                       context->sar_data.sartable_index =
> +                       context->config_data[context->reg_value]
> +                       .device_mode_info[context->sar_data.device_mode].sartable_index;

Oy vey, this is quite hard to read, use temporary variables.

> +                       pr_debug("bandtable_index: %d\n", context->sar_data.bandtable_index);
> +                       pr_debug("antennatable_index : %d\n", context->sar_data.antennatable_index);
> +                       pr_debug("sartable_index: %d\n", context->sar_data.sartable_index);

No way. Drop debug prints from production code.


> +               } else {
> +                       pr_err("%s: sar data not assigned! Dev mode: %d, total_dev_mode: %d\n",
> +                              __func__, context->sar_data.device_mode,
> +                              context->config_data[context->reg_value].total_dev_mode);
> +               }
> +}


--
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2021-06-24 10:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-10  7:40 [PATCH V2 0/1] [x86] BIOS SAR Driver for M.2 Intel Modems Shravan S
2021-05-10  7:40 ` [PATCH V2 1/1] [x86]: BIOS Dynamic SAR driver for Intel M.2 Modem Shravan S
2021-06-24 10:24   ` Andy Shevchenko [this message]
2021-06-28 15:12     ` Hans de Goede
2021-06-28 17:47       ` Enrico Weigelt, metux IT consult
2021-06-28 18:20         ` Hans de Goede
2021-06-29 10:08           ` Enrico Weigelt, metux IT consult
2021-06-28 14:45   ` Enrico Weigelt, metux IT consult
2021-07-15 16:20   ` Hans de Goede
2021-07-27 14:38     ` Shravan, S

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='CAHp75Ve_=mv5MbLvqxGwu8GAuxAjBLpRHE9KNua-yvmzUNKuKw@mail.gmail.com' \
    --to=andy.shevchenko@gmail.com \
    --cc=hdegoede@redhat.com \
    --cc=mgross@linux.intel.com \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=s.shravan@intel.com \
    --cc=sudhakar.an@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).