From: Christoph Hellwig <hch@infradead.org>
To: Andrew Morton <akpm@osdl.org>, johnpol@2ka.mipt.ru, greg@kroah.com
Cc: linux-kernel@vger.kernel.org
Subject: Re: 2.6.11-rc2-mm1
Date: Tue, 25 Jan 2005 12:53:23 +0000 [thread overview]
Message-ID: <20050125125323.GA19055@infradead.org> (raw)
In-Reply-To: <20050124021516.5d1ee686.akpm@osdl.org>
Review of the superio subsystem sneaked in through bk-i2c.patch:
diff -Nru a/drivers/superio/Kconfig b/drivers/superio/Kconfig
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/drivers/superio/Kconfig 2005-01-23 22:34:15 -08:00
@@ -0,0 +1,56 @@
+menu "SuperIO subsystem support"
+
+config SC_SUPERIO
+ tristate "SuperIO subsystem support"
+ depends on CONNECTOR
+ help
+ SuperIO subsystem support.
+
+ This support is also available as a module. If so, the module
+ will be called superio.ko.
This doesn't mention what "SuperIO" is at all. Also please skip the .ko
postfix for the module name as the intree Kconfigs do. The boilerplate has
changed to:
To compile this driver as a module, choose M here: the
module will be called <foo>.
diff -Nru a/drivers/superio/Makefile b/drivers/superio/Makefile
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/drivers/superio/Makefile 2005-01-23 22:34:15 -08:00
@@ -0,0 +1,11 @@
+#
+# Makefile for the SuperIO subsystem.
+#
Superflous.
+
+obj-$(CONFIG_SC_SUPERIO) += superio.o
+obj-$(CONFIG_SC_GPIO) += sc_gpio.o
+obj-$(CONFIG_SC_ACB) += sc_acb.o
+obj-$(CONFIG_SC_PC8736X) += pc8736x.o
+obj-$(CONFIG_SC_SCX200) += scx200.o
+
+superio-objs := sc.o chain.o sc_conn.o
please use superio-y += so new conditional objects can be added more easily.
diff -Nru a/drivers/superio/chain.c b/drivers/superio/chain.c
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/drivers/superio/chain.c 2005-01-23 22:34:15 -08:00
@@ -0,0 +1,52 @@
+/*
+ * chain.c
superfluos, the file name is obvious. (Dito for all other files)
+ *
+ * 2004 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <asm/atomic.h>
+#include <asm/types.h>
+
+#include <linux/list.h>
+#include <linux/slab.h>
always include <asm/*> after <linux/*> headers. Please use <linux/types.h>
istead of <asm/types.h> always.
(comment applies to later files aswell)
+#include "chain.h"
+
+struct dev_chain *chain_alloc(void *ptr)
+{
+ struct dev_chain *ch;
+
+ ch = kmalloc(sizeof(struct dev_chain), GFP_ATOMIC);
+ if (!ch) {
+ printk(KERN_ERR "Failed to allocate new chain for %p.\n", ptr);
+ return NULL;
+ }
+
+ memset(ch, 0, sizeof(struct dev_chain));
+
+ ch->ptr = ptr;
+
+ return ch;
+}
+
+void chain_free(struct dev_chain *ch)
+{
+ memset(ch, 0, sizeof(struct dev_chain));
+ kfree(ch);
The memset completely defeats slab redzoning to catch bugs, don't
do that.
Also what's the reason you can't simply put the list_head into struct
logical_dev?
+static void pc8736x_fini(void)
+{
+ sc_del_sc_dev(&pc8736x_dev);
+
+ while (atomic_read(&pc8736x_dev.refcnt)) {
+ printk(KERN_INFO "Waiting for %s to became free: refcnt=%d.\n",
+ pc8736x_dev.name, atomic_read(&pc8736x_dev.refcnt));
+
+ set_current_state(TASK_INTERRUPTIBLE);
+ schedule_timeout(HZ);
+
+ if (current->flags & PF_FREEZE)
+ refrigerator(PF_FREEZE);
+
+ if (signal_pending(current))
+ flush_signals(current);
+ }
+}
And who gurantess this won't deadlock? Please use a dynamically allocated
driver model device and it's refcounting, thanks.
+int sc_add_sc_dev(struct sc_dev *__sdev)
btw, what's the reason you use those ugly __ names for local variables all over?
+ while (atomic_read(&__sdev->refcnt)) {
+ printk(KERN_INFO "Waiting SuperIO chip %s to become free: refcnt=%d.\n",
+ __sdev->name, atomic_read(&__sdev->refcnt));
+ set_current_state(TASK_UNINTERRUPTIBLE);
+ schedule_timeout(HZ);
+
+ if (current->flags & PF_FREEZE)
+ refrigerator(PF_FREEZE);
+
+ if (signal_pending(current))
+ flush_signals(current);
+ }
+}
Again as above.
+static void sc_deactivate_logical(struct sc_dev *dev, struct logical_dev *ldev)
+{
+ printk(KERN_INFO "Deactivating logical device %s in SuperIO chip %s... ",
+ ldev->name, dev->name);
+
+ if (ldev->irq)
+ {
+ free_irq(ldev->irq, ldev);
+ ldev->irq = 0;
+ }
CodingStyle: if (ldev->irq) { (also in various other places)
+static int __devinit sc_init(void)
+{
+ printk(KERN_INFO "SuperIO driver is starting...\n");
+
+ return sc_register_callback();
+}
+
+static void __devexit sc_fini(void)
+{
+ sc_unregister_callback();
+ printk(KERN_INFO "SuperIO driver finished.\n");
+}
quite noise. Please only print messages when you find an actual
device and not on unloading at all.
+ INIT_LIST_HEAD(&ldev_acb.ldev_entry);
+ spin_lock_init(&ldev_acb.lock);
these two can be initialized at compile time.
+#include "../superio/sc.h"
+#include "../superio/sc_gpio.h"
just include them normalluy, ok?
+static int scx200_pci_probe(struct pci_dev *pdev,
+ const struct pci_device_id *ent)
+{
+ private_base = pci_resource_start(pdev, 0);
+ printk(KERN_INFO "%s: GPIO base 0x%lx.\n", pci_name(pdev), private_base);
+
+ if (!request_region
+ (private_base, SCx200_GPIO_SIZE, "NatSemi SCx200 GPIO")) {
+ printk(KERN_ERR "%s: failed to request %d bytes I/O region for GPIOs.\n",
+ pci_name(pdev), SCx200_GPIO_SIZE);
+ return -EBUSY;
+ }
+
+ pci_set_drvdata(pdev, &private_base);
+ pci_enable_device(pdev);
pci_enable_device needs to be done first, and it returns and error that
should be handled.
+ pci_unregister_driver(&scx200_pci_driver);
+ if (private_base)
+ release_region(private_base, SCx200_GPIO_SIZE);
this must happen in the ->remove callback.
diff -Nru a/drivers/superio/scx200.h b/drivers/superio/scx200.h
--- /dev/null Wed Dec 31 16:00:00 196900
+++ b/drivers/superio/scx200.h 2005-01-23 22:34:15 -08:00
@@ -0,0 +1,28 @@
+/*
+ * scx200.h
+ *
+ * 2004 Copyright (c) Evgeniy Polyakov <johnpol@2ka.mipt.ru>
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#ifndef __SCX200_H
+#define __SCX200_H
+
+#define SCx200_GPIO_SIZE 0x2c
+
+#endif /* __SCX200_H */
Yeah, right - a 30 line header for a single define that's used in a
single source file..
Also your locking is broken. sdev_lock sometimes nests outside
sdev->lock and sometimes inside. Similarly dev->chain_lock nests
inside dev->lock sometimes and sometimes outside. You really need
a locking hiearchy document and the lockign should probably be
simplified a lot.
next prev parent reply other threads:[~2005-01-25 12:54 UTC|newest]
Thread overview: 153+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-01-18 7:21 [PATCH] Some fixes for compat ioctl Andi Kleen
2005-01-18 10:34 ` Michael S. Tsirkin
2005-01-18 10:45 ` [PATCH 1/5] compat_ioctl call seems to miss a security hook Michael S. Tsirkin
2005-01-18 19:22 ` Chris Wright
2005-01-20 0:28 ` Michael S. Tsirkin
2005-01-20 0:43 ` Chris Wright
2005-01-20 1:06 ` Michael S. Tsirkin
2005-01-20 1:16 ` Chris Wright
2005-01-20 1:42 ` Michael S. Tsirkin
2005-01-18 10:48 ` [PATCH 2/5] socket ioctl fix (from Andi) Michael S. Tsirkin
2005-01-18 10:55 ` Christoph Hellwig
2005-01-18 11:01 ` Andi Kleen
2005-01-18 10:52 ` [PATCH 3/5] make common ioctls apply for compat Michael S. Tsirkin
2005-01-18 10:57 ` [PATCH 4/5] reminder comment about register_ioctl32_conversion Michael S. Tsirkin
2005-01-18 11:04 ` [PATCH 5/5] symmetry between compat_ioctl and unlocked_ioctl Michael S. Tsirkin
2005-01-24 10:15 ` 2.6.11-rc2-mm1 Andrew Morton
2005-01-24 10:36 ` 2.6.11-rc2-mm1 Adrian Bunk
2005-01-24 11:17 ` 2.6.11-rc2-mm1: v4l-saa7134-module compile error Adrian Bunk
2005-01-24 13:57 ` Gerd Knorr
2005-01-24 17:45 ` Adrian Bunk
2005-01-25 10:15 ` Gerd Knorr
2005-01-25 10:38 ` Adrian Bunk
2005-01-24 11:56 ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-24 13:41 ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-24 14:35 ` 2.6.11-rc2-mm1 Florian Bohrer
2005-01-24 18:52 ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 20:44 ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 21:31 ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25 19:38 ` 2.6.11-rc2-mm1 Dave Jones
2005-01-25 19:58 ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25 20:29 ` 2.6.11-rc2-mm1 Dave Jones
2005-01-24 12:12 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-24 20:36 ` 2.6.11-rc2-mm1 Karsten Keil
2005-01-24 23:26 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-25 0:35 ` 2.6.11-rc2-mm1 Karsten Keil
2005-01-24 23:32 ` 2.6.11-rc2-mm1 Bartlomiej Zolnierkiewicz
2005-01-24 21:03 ` 2.6.11-rc2-mm1 Andrew Morton
2005-01-24 12:17 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-31 22:42 ` [patch] generic notification layer Robert Love
2005-02-07 11:57 ` 2.6.11-rc2-mm1 Ingo Molnar
2005-02-07 17:30 ` 2.6.11-rc2-mm1 Robert Love
2005-02-07 21:02 ` 2.6.11-rc2-mm1 John McCutchan
2005-01-24 12:25 ` [-mm patch] fix SuperIO compilation Adrian Bunk
2005-01-24 12:34 ` Christoph Hellwig
2005-01-24 13:04 ` Evgeniy Polyakov
2005-01-24 13:56 ` Evgeniy Polyakov
2005-01-24 14:14 ` [1/1] superio: remove unneded exports and make some functions static Evgeniy Polyakov
2005-01-25 6:19 ` Greg KH
2005-01-24 12:48 ` 2.6.11-rc2-mm1: DVB compile error Adrian Bunk
2005-01-24 23:56 ` [linux-dvb-maintainer] " Johannes Stezenbach
2005-01-24 13:52 ` 2.6.11-rc2-mm1 Roman Zippel
2005-01-24 14:24 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-24 14:58 ` 2.6.11-rc2-mm1 Benoit Boissinot
2005-01-24 15:11 ` 2.6.11-rc2-mm1 [compile fix] Benoit Boissinot
2005-01-24 17:25 ` Adrian Bunk
2005-01-24 17:54 ` 2.6.11-rc2-mm1: SuperIO scx200 breakage Adrian Bunk
2005-01-24 18:43 ` Evgeniy Polyakov
2005-01-24 18:29 ` Adrian Bunk
2005-01-24 19:19 ` Evgeniy Polyakov
2005-01-24 19:03 ` Adrian Bunk
2005-01-24 19:46 ` Evgeniy Polyakov
2005-01-24 18:41 ` Jurriaan
2005-01-24 19:23 ` Evgeniy Polyakov
2005-01-24 19:05 ` Adrian Bunk
2005-01-24 19:39 ` Evgeniy Polyakov
2005-01-24 19:32 ` Dmitry Torokhov
2005-01-24 20:28 ` Evgeniy Polyakov
2005-01-27 15:19 ` Bill Davidsen
2005-01-27 16:21 ` Evgeniy Polyakov
2005-01-27 23:12 ` Bill Davidsen
2005-01-24 20:33 ` Christoph Hellwig
2005-01-24 21:10 ` Evgeniy Polyakov
2005-01-24 21:34 ` Greg KH
2005-01-24 21:47 ` Christoph Hellwig
2005-01-25 6:02 ` Greg KH
2005-01-25 7:11 ` Christoph Hellwig
2005-01-25 18:59 ` Jean Delvare
2005-01-25 21:39 ` Evgeniy Polyakov
2005-01-25 21:40 ` Jean Delvare
2005-01-25 22:35 ` Evgeniy Polyakov
2005-01-26 9:55 ` Jean Delvare
2005-01-26 10:55 ` Evgeniy Polyakov
2005-01-26 14:34 ` Jean Delvare
2005-01-26 16:10 ` Evgeniy Polyakov
2005-01-26 19:20 ` Jean Delvare
2005-01-26 20:21 ` Evgeniy Polyakov
2005-01-26 10:14 ` Christoph Hellwig
2005-01-26 10:59 ` Evgeniy Polyakov
2005-01-26 14:00 ` Dmitry Torokhov
2005-01-26 16:38 ` Evgeniy Polyakov
2005-01-26 18:19 ` Adrian Bunk
2005-01-26 19:27 ` Evgeniy Polyakov
2005-01-27 10:20 ` Adrian Bunk
2005-01-27 11:53 ` Evgeniy Polyakov
2005-01-26 18:06 ` Adrian Bunk
2005-01-26 13:12 ` Russell King
2005-01-26 20:01 ` Christoph Hellwig
2005-01-24 18:58 ` 2.6.11-rc2-mm1 Benoit Boissinot
2005-01-24 19:09 ` 2.6.11-rc2-mm1 Adrian Bunk
2005-01-24 19:44 ` 2.6.11-rc2-mm1 - fix a typo in nfs3proc.c Benoit Boissinot
2005-01-24 20:24 ` 2.6.11-rc2-mm1 - compile fix Benoit Boissinot
2005-01-24 20:26 ` [PATCH] move common compat ioctls to hash Michael S. Tsirkin
2005-01-25 6:17 ` Andi Kleen
2005-01-26 8:40 ` Michael S. Tsirkin
2005-01-25 0:03 ` 2.6.11-rc2-mm1: fuse patch needs new libs Sytse Wielinga
2005-01-25 7:31 ` Miklos Szeredi
2005-01-27 15:45 ` Bill Davidsen
2005-01-27 15:56 ` Sytse Wielinga
2005-01-27 16:11 ` Miklos Szeredi
2005-01-27 18:09 ` Christoph Hellwig
2005-01-25 1:01 ` 2.6.11-rc2-mm1 Brice Goglin
2005-01-25 1:30 ` 2.6.11-rc2-mm1 (AE_AML_NO_OPERAND) Len Brown
2005-01-25 18:41 ` 2.6.11-rc2-mm1 Pavel Machek
2005-01-25 19:10 ` 2.6.11-rc2-mm1 Espen Fjellvær Olsen
2005-01-25 12:53 ` Christoph Hellwig [this message]
2005-01-25 14:11 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 14:23 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-25 15:24 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 15:34 ` 2.6.11-rc2-mm1 Bartlomiej Zolnierkiewicz
2005-01-25 16:04 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 18:21 ` 2.6.11-rc2-mm1 Jörn Engel
2005-01-25 21:17 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 2:20 ` 2.6.11-rc2-mm1 Jörn Engel
2005-01-25 15:36 ` 2.6.11-rc2-mm1 Paulo Marques
2005-01-25 21:08 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 16:11 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-25 21:14 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 4:57 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 8:25 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 13:46 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 14:59 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 15:26 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 15:54 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 16:25 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 16:46 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 16:55 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 17:39 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 18:26 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 20:07 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 20:22 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-27 17:33 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 22:42 ` 2.6.11-rc2-mm1 Christoph Hellwig
2005-01-26 8:31 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-26 13:32 ` 2.6.11-rc2-mm1 Dmitry Torokhov
2005-01-26 14:44 ` 2.6.11-rc2-mm1 Evgeniy Polyakov
2005-01-25 19:35 ` 2.6.11-rc2-mm1 Pavel Machek
2005-01-25 19:12 ` 2.6.11-rc2-mm1 Marcos D. Marado Torres
2005-01-25 23:07 ` 2.6.11-rc2-mm1 Barry K. Nathan
2005-01-26 2:40 ` 2.6.11-rc2-mm1 William Lee Irwin III
2005-01-26 2:40 ` 2.6.11-rc2-mm1 William Lee Irwin III
2005-01-26 4:44 ` [PATCH] ppc64: fix use kref for device_node refcounting Nathan Lynch
2005-01-27 6:18 ` 2.6.11-rc2-mm1 William Lee Irwin III
2005-01-27 9:14 ` 2.6.11-rc2-mm1 William Lee Irwin III
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=20050125125323.GA19055@infradead.org \
--to=hch@infradead.org \
--cc=akpm@osdl.org \
--cc=greg@kroah.com \
--cc=johnpol@2ka.mipt.ru \
--cc=linux-kernel@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.