mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Bernhard R. Link" <brlink@debian.org>
To: Greg KH <greg@kroah.com>
Cc: linux-kernel@vger.kernel.org, linux-parport@lists.infradead.org
Subject: Re: [PATCH] register sysfs device for lp devices
Date: Sat, 18 Feb 2006 14:00:47 +0100	[thread overview]
Message-ID: <20060218130047.GA30491@pcpool00.mathematik.uni-freiburg.de> (raw)
In-Reply-To: <20060218014541.GA17364@kroah.com>

> > + * can display it in their sysfs nodes */
> > +#define parport_set_dev(port,devptr) ((port)->dev = (devptr))
> 
> If you are going to save off a pointer to a structure, you need to
> increment it's reference count.  You aren't doing that here, and bad
> things might happen if it gets removed from under you :(

Guess I should think a bit more and copy other code a bit less.
The two examples I looked at were sound and network devices.
While they differ by calling class_device_create more directly,
this does not call a get_device either. (Or where have I missed
it?)

I thought that parport would only exist while the device exists and
is bound to the driver, when that stops it is removed anyway.
But lp.c does not implement lp_detach, so it still keeps this data
and it is really exposed even when the device vanished.

Some unrelated strage behaviour from this: When I manualy unbind
and bind an parport supplier, via 
echo -n "id" > /sys/bus/.../drivers/.../unbind
and then echo -n "id" > /sys/bus/.../drivers/.../bind
I get a new lp device every time without the old one vanishing.

Hochachtungsvoll,
	Bernhard R. Link

      reply	other threads:[~2006-02-18 13:00 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-02-17 11:38 Bernhard R. Link
2006-02-17 17:43 ` Stephen Hemminger
2006-02-18 12:05   ` Bernhard R. Link
2006-02-18  1:45 ` Greg KH
2006-02-18 13:00   ` Bernhard R. Link [this message]

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=20060218130047.GA30491@pcpool00.mathematik.uni-freiburg.de \
    --to=brlink@debian.org \
    --cc=greg@kroah.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-parport@lists.infradead.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

all inboxes | Powered by JetHome®