From: Arnd Bergmann <arndb@de.ibm.com>
To: "J.E.J. Bottomley" <James.Bottomley@steeleye.com>
Cc: Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Scsi <linux-scsi@vger.kernel.org>,
Linux Kernel <linux-kernel@vger.kernel.org>,
Linux Scsi <linux-scsi@vger.kernel.org>,
Mike Anderson <andmike@us.ibm.com>
Subject: Re: [RFC][PATCH] move dma_mask into struct device
Date: Sat, 16 Nov 2002 20:56:54 +0100 [thread overview]
Message-ID: <200211162056.54008.arndb@de.ibm.com> (raw)
In-Reply-To: <200211161701.gAGH1xF03711@localhost.localdomain>
On Saturday 16 November 2002 18:01, J.E.J. Bottomley wrote:
> However, in order to divorce DMA from the
> PCI bus, it has to be obtainable from the generic device, without requiring
> knowledge of the bus. In OO terms, it would be in a dmaable_device which
> inherits from device, but for expediency in layering all this into the
> kernel means I'd have to break almost every driver and introduce them to
> the concept of
> dmaable_device, so it's just easier to expand device by a pointer.
The Scsi_Host is already derived from struct device and since you need the
dma_mask only for Scsi_Host, there is no need to expand the base class.
You can easily keep out the pci stuff if you do something like
this:
static inline void scsi_set_device(struct Scsi_Host *shost,
struct device *dev)
{
shost->dev = dev;
shost->host_driverfs_dev.parent = dev;
}
static inline void scsi_set_pci_device(struct Scsi_Host *shost,
struct pci_dev *pdev)
{
scsi_set_device(shost, &pdev->dev);
shost->dma_mask = pdev->dma_mask;
}
static inline void scsi_set_foobus_device(struct Scsi_Host *shost,
struct foo_dev *fdev)
{
scsi_set_device(shost, fdev->dev);
shost->dma_mask = fdev->foo_dma_mask;
}
You can even avoid Scsi_Host::dev completely if you make its only
remaining user (scsi_ioctl_get_pci) use host_sysfs_dev->parent.bus_id
instead.
Arnd <><
next prev parent reply other threads:[~2002-11-16 17:53 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <arndb@de.ibm.com>
2002-11-16 17:23 ` [RFC][PATCH] move dma_mask into struct device Arnd Bergmann
2002-11-16 15:33 ` J.E.J. Bottomley
2002-11-16 18:26 ` Arnd Bergmann
2002-11-16 17:01 ` J.E.J. Bottomley
2002-11-16 19:56 ` Arnd Bergmann [this message]
2002-11-16 18:12 ` J.E.J. Bottomley
2002-11-16 20:46 ` Arnd Bergmann
2002-11-15 20:34 J.E.J. Bottomley
2002-11-16 0:19 ` Mike Anderson
2002-11-16 14:48 ` J.E.J. Bottomley
2002-11-16 20:33 ` Patrick Mansfield
2002-11-17 15:07 ` J.E.J. Bottomley
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=200211162056.54008.arndb@de.ibm.com \
--to=arndb@de.ibm.com \
--cc=James.Bottomley@steeleye.com \
--cc=andmike@us.ibm.com \
--cc=ibm.com@arndb.de \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@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