mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Alan Cox <alan@lxorguk.ukuu.org.uk>
To: "David Härdeman" <david@hardeman.nu>
Cc: linux-kernel@vger.kernel.org, jesse.barnes@intel.com, terry@beam.ltd.uk
Subject: Re: [RFC/PATCH] Winbond CIR driver for the WPCD376I chip (ACPI/PNP id WEC1022)
Date: Wed, 24 Jun 2009 23:45:01 +0100	[thread overview]
Message-ID: <20090624234501.3d35642f@lxorguk.ukuu.org.uk> (raw)
In-Reply-To: <20090624213645.GA18843@hardeman.nu>

> Lots of drivers support one or more logical devices provided by 
> different SuperI/O chips, but there seems to be no synchronisation 
> between the different drivers? Since my driver gets all info from ACPI, 
> it's no real problem here, but I'm curious...shouldn't there be some 
> kind of synchronisation between SuperI/O drivers which might all be 
> changing global registers, such as the logical device select register?

I'm looking at a similar case (clash between super I/O config for serial
and watchdog) at the moment that affects a proposed driver for some
serial port save/restore config stuff. We can request_region to avoid
collisions but there is no wait mechanism for super I/O devices which
probably wants fixing with a simple list of super I/O ports and a helper
lib. I was thinking something like

	handle = superio_request(name, dev, start, len);

	EBUSY - someone else has the I/O space registered other than
	super I/O. The super I/O lib would then request the I/O space and
	hog it.

	superio_claim(handle, block)

	Claim the super I/O providing another person isn't using it,
	optionally wait if so

	superio_release(handle);

	Give back the claim

	superio_free(handle)

	Free allocation


>    2) Location of driver
> 
> Where should this driver go in the tree? drivers/platform/x86/?

Not if the device is not x86 specific - eg a generic super I/O device

>    6) Reclaiming the serial port
> 
> The serial port which the WPCD376I uses for IR TX/RX is only useful for 
> Consumer IR, but it looks enough like a "normal" uart for the serial 
> driver to claim the port. I currently have to boot with 
> "8250.nr_uarts=1" to stop the serial driver from using the IR uart 
> (there is one "real" serial port in the chip). However, that's not a 
> very elegant or user-friendly option. Is there a way to blacklist the 
> port in the serial driver and/or to reclaim the port from the serial 
> driver when the CIR driver is loaded?

How similar is it to a normal UART and if it looks like a normal UART why
not drive it as one ?

>    7) kmalloc and spinlocks
> 
> In wbcir_setkeycode the driver might need to kmalloc memory for a new 
> keytable entry, but kmalloc isn't allowed with rwlocks held so I've 
> currently written the driver to do a kmalloc before taking the rwlock 
> and then to kfree it later if it wasn't necessary, which feels quite 
> inelegant to me. Any suggestions on a better approach

Thats actually a common way to do it and usually cleaner than the
alternatives.

  parent reply	other threads:[~2009-06-24 22:44 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-06-24 21:36 David Härdeman
2009-06-24 22:13 ` Jesse Barnes
2009-06-25 11:46   ` David Härdeman
2009-06-25 16:20     ` Jesse Barnes
2009-06-24 22:45 ` Alan Cox [this message]
2009-06-25 12:28   ` David Härdeman
2009-06-25 12:49     ` Alan Cox
2009-06-25 13:14       ` David Härdeman
2009-06-25 13:17         ` Alan Cox
2009-06-25 13:28           ` David Härdeman
2009-06-25 13:35             ` Alan Cox
2009-10-06  7:32               ` Sean Young

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=20090624234501.3d35642f@lxorguk.ukuu.org.uk \
    --to=alan@lxorguk.ukuu.org.uk \
    --cc=david@hardeman.nu \
    --cc=jesse.barnes@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=terry@beam.ltd.uk \
    /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

all inboxes | Powered by JetHome®