Thread (18 messages) flat view 18 messages, 4 authors, 2012-01-30
STALE5314d

Revision v1 of 12 in this series.

Revisions (12)
  1. v1 [diff vs current]
  2. v1 [diff vs current]
  3. v1 [diff vs current]
  4. v1 [diff vs current]
  5. v1 [diff vs current]
  6. v1 [diff vs current]
  7. v1 current
  8. v1 [diff vs current]
  9. v1 [diff vs current]
  10. v1 [diff vs current]
  11. v1 [diff vs current]
  12. v1 [diff vs current]

[PATCH 2/6] drivers/base: add bus for System-on-Chip devices

From: arnd@arndb.de (Arnd Bergmann)
Date: 2012-01-30 17:58:24

On Saturday 28 January 2012, Greg KH wrote:
On Sat, Jan 21, 2012 at 05:08:03PM +0000, Lee Jones wrote:
quoted
diff --git a/drivers/base/Kconfig b/drivers/base/Kconfig
index 7be9f79..9aa618a 100644
--- a/drivers/base/Kconfig
+++ b/drivers/base/Kconfig
@@ -176,6 +176,9 @@ config GENERIC_CPU_DEVICES
 	bool
 	default n
 
+config SOC_BUS
+	bool
That's nice, but you do need some kind of help text here, right?
Wouldn't hurt, but most silent options have no help text, because that
would never be visible in the kconfig tools, only in the source code.
quoted
+
+static struct ida soc_ida;
+static spinlock_t soc_lock;
+
+static ssize_t soc_info_get(struct device *dev,
+			    struct device_attribute *attr,
+			    char *buf);
+
Why not put the whole function here, well a few lines lower, so no
forward declaration is needed, saving a few extra lines.
You made the same comment in a previous review round and then agreed
that it's correct after all. A small comment why the forward declaration
is required here would probably be appropriate here, otherwise the
next person reading this would have the same thought.
quoted
+
+static mode_t soc_attribute_mode(struct kobject *kobj,
+                                 struct attribute *attr,
+                                 int index)
+{
+	struct device *dev = container_of(kobj, struct device, kobj);
+	struct soc_device *soc_dev = container_of(dev, struct soc_device, dev);
+
+	if ((attr == &dev_attr_machine.attr)
+	    && (soc_dev->attr->machine != NULL))
+		return attr->mode;
+	if ((attr == &dev_attr_family.attr)
+	    && (soc_dev->attr->family != NULL))
+		return attr->mode;
+	if ((attr == &dev_attr_revision.attr)
+	    && (soc_dev->attr->revision != NULL))
+		return attr->mode;
+	if ((attr == &dev_attr_soc_id.attr)
+	    && (soc_dev->attr->soc_id != NULL))
+	        return attr->mode;
+
FWIW, the function compares the attribute pointers, so it needs to
see their delarations, while the attribute definition requires the
declaration of the function to be visible.

	Arnd
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help