Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id ; Sat, 9 Nov 2002 20:44:09 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id ; Sat, 9 Nov 2002 20:44:09 -0500 Received: from h-64-105-136-52.SNVACAID.covad.net ([64.105.136.52]:37803 "EHLO freya.yggdrasil.com") by vger.kernel.org with ESMTP id ; Sat, 9 Nov 2002 20:44:08 -0500 From: "Adam J. Richter" Date: Sat, 9 Nov 2002 17:50:42 -0800 Message-Id: <200211100150.RAA27228@baldur.yggdrasil.com> To: grundler@dsl2.external.hp.com Subject: Re: [parisc-linux] Untested port of parisc_device to generic device interface Cc: andmike@us.ibm.com, hch@lst.de, James.Bottomley@steeleye.com, linux-kernel@vger.kernel.org, mochel@osdl.org, parisc-linux@lists.parisc-linux.org Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1558 Lines: 36 Grant Grundler writes: >Documentation/driver-model/overview.txt: >| Note also that it is at the _end_ of struct pci_dev. This is >| to make people think about what they're doing when switching between the bus >| driver and the global driver; and to prevent against mindless casts between >| the two. > >Until this changes, I don't see this as a useful replacement for >either PCI or parisc devices. The "mindless casts" can be fixed. >But without the ability to easily go from generic device type to >bus specific type, people will just get lost in the maze of pointers. linux-2.5.46/include/linux/kernel.h already defines container_of(ptr_to_element, parent_struct, element_name). >From : #define to_pci_dev(n) container_of(n, struct pci_dev, dev) >From : #define to_usb_device(d) container_of(d, struct usb_device, dev) >From with my parisc device patch: static inline struct parisc_device *to_parisc_dev(struct device *dev) { return container_of(dev, struct parisc_device, device); } Adam J. Richter __ ______________ 575 Oroville Road adam@yggdrasil.com \ / Miplitas, California 95035 +1 408 309-6081 | g g d r a s i l United States of America "Free Software For The Rest Of Us." - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/