X86 platform drivers
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy@kernel.org>
To: Hans de Goede <hdegoede@redhat.com>
Cc: Mark Gross <markgross@kernel.org>, platform-driver-x86@vger.kernel.org
Subject: Re: [PATCH 2/9] platform/x86: x86-android-tablets: Move core code into new core.c file
Date: Tue, 21 Feb 2023 11:55:38 +0200	[thread overview]
Message-ID: <Y/SVGhEhC94ICG39@smile.fi.intel.com> (raw)
In-Reply-To: <20230220221212.196009-3-hdegoede@redhat.com>

On Mon, Feb 20, 2023 at 11:12:05PM +0100, Hans de Goede wrote:
> Move the helpers to get irqs + gpios as well as the core code for
> instantiating all the devices missing from ACPI into a new core.c file.

...

> +static int gpiochip_find_match_label(struct gpio_chip *gc, void *data)
> +{
> +	return gc->label && !strcmp(gc->label, data);
> +}

Can we actually export find_chip_by_name() from GPIOLIB and reuse it here?
(Perhaps it may require a separate patch(es) to be added)

...

> +	case X86_ACPI_IRQ_TYPE_GPIOINT:
> +		/* Like acpi_dev_gpio_irq_get(), but without parsing ACPI resources */
> +		ret = x86_android_tablet_get_gpiod(data->chip, data->index, &gpiod);
> +		if (ret)
> +			return ret;
> +
> +		irq = gpiod_to_irq(gpiod);
> +		if (irq < 0) {
> +			pr_err("error %d getting IRQ %s %d\n", irq, data->chip, data->index);
> +			return irq;
> +		}
> +
> +		irq_type = acpi_dev_get_irq_type(data->trigger, data->polarity);
> +		if (irq_type != IRQ_TYPE_NONE && irq_type != irq_get_trigger_type(irq))
> +			irq_set_irq_type(irq, irq_type);
> +
> +		return irq;

Similar Q here.

...

> +static void x86_android_tablet_cleanup(void)
> +{
> +	int i;

unsigned?

> +	for (i = 0; i < serdev_count; i++) {
> +		if (serdevs[i])

Interesting that serdev requires this check in the callers.

> +			serdev_device_remove(serdevs[i]);
> +	}
> +
> +	kfree(serdevs);
> +
> +	for (i = 0; i < pdev_count; i++)
> +		platform_device_unregister(pdevs[i]);
> +
> +	kfree(pdevs);
> +
> +	for (i = 0; i < i2c_client_count; i++)
> +		i2c_unregister_device(i2c_clients[i]);
> +
> +	kfree(i2c_clients);
> +
> +	if (exit_handler)
> +		exit_handler();
> +
> +	for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> +		gpiod_remove_lookup_table(gpiod_lookup_tables[i]);
> +
> +	software_node_unregister(bat_swnode);
> +}

...

> +extern const struct dmi_system_id x86_android_tablet_ids[];

Why not in the header?

...

> +	gpiod_lookup_tables = dev_info->gpiod_lookup_tables;
> +	for (i = 0; gpiod_lookup_tables && gpiod_lookup_tables[i]; i++)
> +		gpiod_add_lookup_table(gpiod_lookup_tables[i]);

gpiod_add_lookup_tables() ?

...

> +#ifndef __X86_ANDROID_TABLETS_H
> +#define __X86_ANDROID_TABLETS_H

> +#include <linux/gpio/consumer.h>
> +#include <linux/gpio/machine.h>

I don't see users of these headers here (forward declarations may do the job).

...

> +#include <linux/platform_device.h>

Ditto.

And seems missing other forward declaration(s?), like software_node.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-02-21  9:56 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-02-20 22:12 [PATCH 0/9] platform/x86: x86-android-tablets: Split into multiple files + gpio_keys rework Hans de Goede
2023-02-20 22:12 ` [PATCH 1/9] platform/x86: x86-android-tablets: Move into its own subdir Hans de Goede
2023-02-21  9:41   ` Andy Shevchenko
2023-02-20 22:12 ` [PATCH 2/9] platform/x86: x86-android-tablets: Move core code into new core.c file Hans de Goede
2023-02-21  9:55   ` Andy Shevchenko [this message]
2023-02-20 22:12 ` [PATCH 3/9] platform/x86: x86-android-tablets: Move DMI match table into its own dmi.c file Hans de Goede
2023-02-21  9:57   ` Andy Shevchenko
2023-02-20 22:12 ` [PATCH 4/9] platform/x86: x86-android-tablets: Move shared power-supply fw-nodes to a separate file Hans de Goede
2023-02-21  9:58   ` Andy Shevchenko
2023-02-21  9:59     ` Andy Shevchenko
2023-02-20 22:12 ` [PATCH 5/9] platform/x86: x86-android-tablets: Move Asus tablets to their own file Hans de Goede
2023-02-20 22:12 ` [PATCH 6/9] platform/x86: x86-android-tablets: Move Lenovo " Hans de Goede
2023-02-20 22:12 ` [PATCH 7/9] platform/x86: x86-android-tablets: Move remaining tablets to other.c Hans de Goede
2023-02-20 22:12 ` [PATCH 8/9] platform/x86: x86-android-tablets: Add gpio_keys support to x86_android_tablet_init() Hans de Goede
2023-02-21 10:04   ` Andy Shevchenko
2023-02-20 22:12 ` [PATCH 9/9] platform/x86: x86-android-tablets: Add support for the Dolby button on Peaq C1010 Hans de Goede

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=Y/SVGhEhC94ICG39@smile.fi.intel.com \
    --to=andy@kernel.org \
    --cc=hdegoede@redhat.com \
    --cc=markgross@kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    /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