* Re: amd64 bus error
From: James Courtier-Dutton @ 2006-04-05 20:34 UTC (permalink / raw)
To: Eric Shattow; +Cc: alsa-devel
In-Reply-To: <2c746f620604051315w53d94a5bo5236778a28397959@mail.gmail.com>
Eric Shattow wrote:
> This may be a hardware error on your computer platform. Is the bug
> reproducible? If not, you should try replacing the CPU/ram of your
> test machine.
>
> Eric
>
> On 4/5/06, James Courtier-Dutton <James@superbug.co.uk> wrote:
>> Here is a backtrace of a alsa application that ran for about 1 hour
>> before giving this:
>>
>> [New Thread 1098918240 (LWP 23392)]
>>
>> Program received signal SIGBUS, Bus error.
>> [Switching to Thread 1098918240 (LWP 23392)]
>> 0x00002aaaac51bcc8 in ao_alsa_loop (iarg=<value optimized out>)
>> at start_alsa.c:494
>> 494 if (poll (pfd, nfds, 200000) < 0) {
>>
>>
>> Have we had any bus error type fixes to alsa-driver between the current
>> ubuntu alsa version and the latest?
>> The poll() call above is with alsa file descriptors.
>>
>> James
>>
I ran one cycle of memtest86+ on it, and it has no errors.
I don't think this is a hardware problem.
James
-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
^ permalink raw reply
* Re: Q on audit, audit-syscall
From: Valdis.Kletnieks @ 2006-04-05 20:36 UTC (permalink / raw)
To: Herbert Rosmanith; +Cc: Kyle Moffett, Robin Holt, linux-kernel
In-Reply-To: <200604052004.k35K4u56010157@wildsau.enemy.org>
[-- Attachment #1: Type: text/plain, Size: 3877 bytes --]
On Wed, 05 Apr 2006 22:04:55 +0200, Herbert Rosmanith said:
> (1) CONFIG_AUDIT and CONFIG_AUDITSYSCALL: how do I use that from
> userspace? is it possible at all (1.1) to use this from userspace or
> (1.2) is this a "kernel-only" infrastructure provided for other
> kernel-modules only (such as e.g. LSM?). is there a description
> of this interface and how and where to use it? I cannot find it.
> clear enough?
'man auditd' and friends. This is providing after-the-fact reporting
of security-related events for audit and forensic analysis. We have *no*
idea if it will fill your needs, because you have explained what you're
trying to *do* with ptrace. If you merely need a record that a syscall
happened, this is what you want. If you want to apply a security restriction,
you want to look at SELinux or perhaps a custom LSM. If you have some
other need, you need some other tool.
So what problem are you trying to solve by using ptrace()?
> (2) in linux/Documentation/devices.txt I've found an "audit device":
>
> 103 block Audit device
> 0 = /dev/audit Audit device
>
> which software implements this device? I see no block-device
> registration in linux/kernel/audit.c nor in linux/kernel/auditsc.c.
> Booting a kernel with CONFIG_AUDIT* enabled does not show this
> device in /proc/devices.
>
> so, what the deal with this block device? clear enough?
"That is an old worn-out magic word" -- ADVENT.FOR
I think that's a leftover from before the audit subsystem was converted
to use netlink.
> (3) audit-1.1.5/lib is using "socket(PF_NETLINK,SOCK_RAW,NETLINK_AUDIT)"
> is this the way to communicate with the audit-system enabled by
> CONFIG_AUDIT/_AUDITSYSCALL? or is this something different.
Well, this is how auditd talks to the netlink socket. Whether it supports
the functionality you need in a unpatched kernel depends on what you're
trying to do (which you still haven't explained).
> > otherwise it's impossible to help you. You want to trace and
> > intercept syscalls, no?
>
> > It implicitly doesn't make any sense to try to trace and intercept syscalls
> > from one process in more than one other.
>
> I'm pretty sure I can find a quote from the fortune program saying
> that "if something does not make sense for you, that doesnt mean that it wont
> make sense for someone else". In fact, it makes sense for me.
Good. Please enlighten us what the proper system behavior is, if *two* processes
are ptrace()ing the same target process - and one specifies PTRACE_CONT and
the other PTRACE_SINGLESTEP (or other conflicting pairs of requests...)
Handling two PTRACE_{GET|POKE}* requests for the same data looks massively
racy as well, as there's no defined way to say what order to handle them.
But hey - if you're comfortable and get warm fuzzies about the idea that one
process could use PTRACE_POKEDATA to set the variable 'a_upper_lim' to 23, and
the other could use it to set a_upper_lim to -10, and then execution resumes
with no clear indication of which one actually gets used, that's OK by us...
(Or for more fun - what if one process sends a PTRACE_CONT before the other one
gets a shot at it to do the PTRACE_POKEDATA, at which point you're storing into
a already-running process (bonus points for knowing if the live value is in a
register or in memory at the time you get there with a non-stopped process ;)
> I wonder if IBM and SuSE/Novell are right when they write in~\ref{1}:
>
> \begin{quote}
> The vanilla 2.6 Linux kernel does not provide a mechanism to
> trace syscalls in the desired way, nor does it contain the
> capability to to track process and generate an audit trail.
> \end{quote}
LAuS was a long-ago predecessor of the current audit system. At the time
it was written, it was correct, but it no longer is.
[-- Attachment #2: Type: application/pgp-signature, Size: 226 bytes --]
^ permalink raw reply
* Re: [PATCH] Add a /proc/self/exedir link
From: Eric W. Biederman @ 2006-04-05 20:39 UTC (permalink / raw)
To: Mike Hearn; +Cc: linux-kernel, akpm
In-Reply-To: <4431A93A.2010702@plan99.net>
Mike Hearn <mike@plan99.net> writes:
> Alright, Andrew Morton indicated that he liked this patch but the idea needed
> discussion and mindshare. I asked Con Kolivas if it made sense to go in his
> desktop patchset for people to try: he said he liked it too but it's not his
> area, and that it should be discussed here.
>
> To clarify, I'm proposing this patch for eventual mainline inclusion.
>
> It adds a simple bit of API - a symlink in /proc/pid - which makes it easy to
> build relocatable software:
>
> ./configure --prefix=/proc/self/exedir/..
>
> This is useful for a variety of purposes:
>
> * Distributing programs that are runnable from CD or USB key (useful for
> Linux magazine cover disks)
>
> * Binary packages that can be installed anywhere, for instance, to your
> home directory
>
> * Network admins can more easily place programs on network mounts
>
> I'm sure you can think of others. You can patch software to be relocatable
> today, but it's awkward and error prone. A simple patch can allow us to get it
> "for free" on any UNIX software that uses the idiomatic autotools build system.
>
> So .... does anybody have any objections to this? Would you like to see it go
> in? Speak now or forever hold your peace! :)
You patch needs to move proc_exedir_link into base.c instead
of replicating it twice (that is a maintenance problem).
I think if we can fix namespaces you don't have to be root to use
them that is a superioir approach, and will cover more cases.
I have concerns about security policy in this case because a proc
symlink is not a symlink. So if you chmod an intermediate directory
in your prefix to 000 you will still be able to access it.
I'm not at all certain I like applications depending on the fact
that I have procfs mounted on /proc. It's bad enough that system
libraries are beginning to care. This means I can not run any of
your relocatable executalbes in a chroot environment unless I mount
proc.
If we add this it will never be removed from /proc, so we should
be certain we want this.
Given how long we have been without this I doubt many people actually
care, or their software would be written so it was relocatable from
day one.
I'm not certain the directory of an inode even makes sense, and
that is what you are asking for us to export.
Eric
^ permalink raw reply
* Re: [PATCH 0/5] clocksource patches
From: Roman Zippel @ 2006-04-05 20:44 UTC (permalink / raw)
To: Thomas Gleixner; +Cc: johnstul, linux-kernel, Andrew Morton, Ingo Molnar
In-Reply-To: <1144236167.5344.581.camel@localhost.localdomain>
Hi,
On Wed, 5 Apr 2006, Thomas Gleixner wrote:
> > Thomas, I would really appreciate if you actually started to argue your
> > point instead of just disagreeing with me every time. I have no problem to
> > admit that I'm wrong, but it takes a bit more than you just saying it is
> > so.
>
> I on my side would appreciate, if you would stop to take every line I
> write as a personal offense.
Believe me, I'm trying very hard and I'm not easily offended, but you
don't exactly make it easy.
For example I get very little positive feedback from you and I'd be happy
if you gave me at least constructive criticism, but you mainly just
contradict me. An important indicator here is asking questions, you barely
ask me any questions, which would show you're interested in my opinion and
would help to avoid misunderstandings as shown further below.
> > For example above you bascially only state that your clock event source
> > is superior and the correct way of doing this without any explanation why
> > (and the "No, thanks." doesn't exactly imply that you're even interested
> > in alternatives).
>
> The question arises, who is not interested in alternatives. You are well
> aware about the efforts others made, but you don't even think about
> working together with them. Do you really expect people to jump on your
> train, when you entirely ignore their work and efforts and just propose
> your own view of the world?
First off please leave other people out of this, I get along with other
people quite well, it's you I continuously have these problems with.
Secondly considering my contributions to John's work, it's fucking rude of
you to accuse me of "not interested in alternatives" and "don't even
think about working together". There is a simple reason that e.g. I'm not
working on the -rt tree - lack of time. For weeks now I already had no
time to work on the m68k tree, for months now I already sit on a batch of
kconfig patches I'm trying to make ready. As long as your stuff doesn't
appear on lkml, I consider as in development and I spent my time on more
important things (which may be not so important to you).
> I did nowhere say that I'm not interested in alternative solutions. You
> interpret it into my words for whatever reason.
>
> Your way to rip out a single statement of its context and making your
> argument on that is simply annoying.
>
> Thats the original quote:
> > How should a combo solution allow to add special hardware, which
> > provides only one of the services ? By using "something else
> > internally" ? No, thanks.
>
> It is entirely clear, that "No thanks" is related to "something else
> internally".
The interesting part is that I never said "something else internally",
more specifically I said "internally use another clocksource". It's you
who made the generalization and then only talks about clock events, so
it's easy to come to the conclusion that the "No, thanks." is not related
to something specific I said, but to the generic "something else (than
clock events)". I had nothing "to rip out".
> Thats the point I made further up in my first reply. It was your
> proposal to combine clock sources and clock events.
This is the point were you could have saved us a lot of grief by simply
asking me instead of jumping to conclusions. Nowhere in my initial mail
did I make such a proposal, I'm not even mentioning clock events.
The original quote:
> > AFAICT it's
> > more common that the subsystem which is used to read the time is also used
> > as timer (i.e. for the scheduler tick), this means the clocksource driver
> > should also include the interrupt setup.
>
> I don't think so. Coupling the clock sources to clock event sources is
> wrong.
What I had in mind is the _current_ setup, that e.g. the scheduler tick
can be generated by a clock event is a possibility, but since your
clockevent patch is not even in -mm, it wasn't something I had in mind
when I wrote this comment. This comment was specifically about the
_current_ way time.c sets up the timer interrupt and i8253.c sets up the
timer hardware.
I also specifically said "This is not important right now, but ...
something to keep in mind" to indicate this needs further discussion,
nowhere did I ever exclude the possibility to do this via clock events,
but you just jumped at me with "this is wrong".
> Why are those seperate items ?
>
> Looking at the various hardware implementations there are three types of
> devices:
>
> 1. Read only devices (e.g. TSC)
> 2. Next interrupt only devices (e.g. various timer implementations on
> SoC CPUs)
> 3. Devices which combine both functions
>
> Building an abstraction layer which handles all device types requires
> either
>
> - that e.g. a read only device needs to be combined with a next
> interrupt device in some way. This introduces artifical combos of
> functionality which can and should be handled completely seperate.
>
> or
>
> - to handle all the corner cases where a device has to be handled which
> only provides one of the functionalies. Also the selection of different
> combinations of devices will introduce extra handling code.
Neither excludes a basic clock source abstraction, which can create any
kind of clock events. The basic question is should any clock source be
able to create every kind of clock events?
The problem here is that we may have to synchronize reading time with the
timer interrupt. To make an extreme example let's assume the TSC clock is
updated every 1msec and the PIT generates an interrupt every 1.01msec,
this means jiffies is updated every 100th interrupt by 2. Also the NTP
error adjustment algorithm works better with small offsets, my latest
version compensates better for that, but a smaller offset still means a
smaller jitter.
These kinds of problems I had in mind when I wrote "Something like TSC
should internally use another clocksource" and if you had asked I could
have explained this, but I had no chance as you simply jumped to your own
conclusions. :-(
> So we have two functional domains, which provide a high level interface:
>
> The clock source abstraction provides:
> - gettimeofday()
> - getmonotonic()
> - settimeofday()
> - clock skew adjustment functions()
>
> The clock event source abstraction provides:
> - setup periodic events()
> - setup one shot events()
> - associate services (function to call on an event) to a clock event
> source
>
> This is a clear seperation and there is no combined functionality.
Unfortunately it's not that simple, e.g. generating gettimeofday()
requires a periodic event. At some point you have to combine
functionality, whether it's done inside the clocksource or by something
else is a different discussion. My proposal to do it inside the clock
source was because we don't have that "something else" yet (which may be
your clock events, I don't know).
I have to skip the rest of your mail, as it's so generic and so out of
context that I don't really disagree with it, if there was something
important, please put back it into some context.
bye, Roman
^ permalink raw reply
* Re: [PATCH] Make saved environment available for remove event rules
From: Kay Sievers @ 2006-04-05 20:46 UTC (permalink / raw)
To: linux-hotplug
In-Reply-To: <200604052151.09087.arvidjaar@mail.ru>
[-- Attachment #1: Type: text/plain, Size: 1546 bytes --]
On Wed, Apr 05, 2006 at 09:51:06PM +0400, Andrey Borzenkov wrote:
> The patch assures that saved environment is available when processing
> rules for 'remove' event. It enables mathing on previously set variables.
> Among others it makes REMOVE_CMD really works (Debian bug 360855).
>
> This is slightly modified version of patch from this thread:
> http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2
>
> Signed-off-by: Andrey Borzenkov <arvidjaar@mail.ru>
>
> ---
> Patch attached due to kmail customarily mangling long lines :(
>
> -andrey
> Subject: [PATCH] Make saved environment available for remove event rules
>
> From: Andrey Borzenkov <arvidjaar@mail.ru>
>
> The patch assures that saved environment is available when processing
> rules for 'remove' event. It enables mathing on previously set variables.
> Among others it makes REMOVE_CMD really works (Debian bug 360855).
>
> This is slightly modified version of patch from this thread:
> http://marc.theaimsgroup.com/?l=linux-hotplug-devel&m=114416867706787&w=2
This looks fine, but I already played around with merging the node
handling code into one file and moving the database calls out of the
node functions.
It's a preparation for a future extension to be able to store data
for devices that don't create a node.
Attached is the pretty big patch (looks smaller in git) and it's not
really tested. I changed the call to the db like your patch is doing.
Would be nice if you can have a look if that is correct and would work
for you.
Thanks,
Kay
[-- Attachment #2: udev-unify-event-02.patch --]
[-- Type: text/plain, Size: 18202 bytes --]
diff --git a/Makefile b/Makefile
index 1ce1abe..42c2bf2 100644
--- a/Makefile
+++ b/Makefile
@@ -69,8 +69,7 @@ HEADERS = \
UDEV_OBJS = \
udev_device.o \
udev_config.o \
- udev_add.o \
- udev_remove.o \
+ udev_node.o \
udev_db.o \
udev_sysfs.o \
udev_rules.o \
diff --git a/udev.h b/udev.h
index 2652d46..615253a 100644
--- a/udev.h
+++ b/udev.h
@@ -117,12 +117,10 @@ extern struct sysfs_device *sysfs_device
extern struct sysfs_device *sysfs_device_get_parent_with_subsystem(struct sysfs_device *dev, const char *subsystem);
extern char *sysfs_attr_get_value(const char *devpath, const char *attr_name);
-/* udev_add.c */
-extern int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid);
-extern int udev_add_device(struct udevice *udev);
-
-/* udev_remove.c */
-extern int udev_remove_device(struct udevice *udev);
+/* udev_node.c */
+extern int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid);
+extern int udev_node_add(struct udevice *udev);
+extern int udev_node_remove(struct udevice *udev);
/* udev_db.c */
extern int udev_db_add_device(struct udevice *dev);
diff --git a/udev_device.c b/udev_device.c
index 5db2709..14c8d39 100644
--- a/udev_device.c
+++ b/udev_device.c
@@ -1,7 +1,7 @@
/*
- * udev_utils.c - generic stuff used by udev
+ * udev_device.c - main udev data object
*
- * Copyright (C) 2004, 2005 Kay Sievers <kay.sievers@vrfy.org>
+ * Copyright (C) 2004-2006 Kay Sievers <kay.sievers@vrfy.org>
*
* 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
@@ -26,6 +26,9 @@
#include <fcntl.h>
#include <errno.h>
#include <ctype.h>
+#include <stropts.h>
+#include <net/if.h>
+#include <linux/sockios.h>
#include "udev.h"
#include "udev_rules.h"
@@ -77,48 +80,122 @@ dev_t udev_device_get_devt(struct udevic
return makedev(0, 0);
}
+static int rename_net_if(struct udevice *udev)
+{
+ int sk;
+ struct ifreq ifr;
+ int retval;
+
+ info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name);
+ if (udev->test_run)
+ return 0;
+
+ sk = socket(PF_INET, SOCK_DGRAM, 0);
+ if (sk < 0) {
+ err("error opening socket: %s", strerror(errno));
+ return -1;
+ }
+
+ memset(&ifr, 0x00, sizeof(struct ifreq));
+ strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ);
+ strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
+
+ retval = ioctl(sk, SIOCSIFNAME, &ifr);
+ if (retval != 0)
+ err("error changing net interface name: %s", strerror(errno));
+ close(sk);
+
+ return retval;
+}
+
int udev_device_event(struct udev_rules *rules, struct udevice *udev)
{
int retval = 0;
- /* device node or netif */
- if ((major(udev->devt) != 0 || strcmp(udev->dev->subsystem, "net") == 0) &&
- strcmp(udev->action, "add") == 0) {
- dbg("device node or netif add '%s'", udev->dev->devpath);
+ /* add device node */
+ if (major(udev->devt) != 0 && strcmp(udev->action, "add") == 0) {
+ dbg("device node add '%s'", udev->dev->devpath);
udev_rules_get_name(rules, udev);
if (udev->ignore_device) {
info("device event will be ignored");
- return 0;
+ goto exit;
}
- /* create node, store in db */
- if (udev->name[0] != '\0')
- retval = udev_add_device(udev);
- else
+ if (udev->name[0] == '\0') {
info("device node creation supressed");
- return retval;
+ goto exit;
+ }
+ /* create node, store in db */
+ retval = udev_node_add(udev);
+ if (retval == 0)
+ udev_db_add_device(udev);
+ goto exit;
}
+ /* add netif */
+ if (strcmp(udev->dev->subsystem, "net") == 0 && strcmp(udev->action, "add") == 0) {
+ dbg("netif add '%s'", udev->dev->devpath);
+ udev_rules_get_name(rules, udev);
+ if (udev->ignore_device) {
+ info("device event will be ignored");
+ goto exit;
+ }
+
+ /* look if we want to change the name of the netif */
+ if (strcmp(udev->name, udev->dev->kernel_name) != 0) {
+ char *pos;
+
+ retval = rename_net_if(udev);
+ if (retval != 0)
+ goto exit;
+ info("renamed netif to '%s'", udev->name);
+
+ /* now fake the devpath, because the kernel name changed silently */
+ pos = strrchr(udev->dev->devpath, '/');
+ if (pos != NULL) {
+ pos[1] = '\0';
+ strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath));
+ strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name));
+ setenv("DEVPATH", udev->dev->devpath, 1);
+ setenv("INTERFACE", udev->name, 1);
+ }
+ }
+ goto exit;
+ }
+
+ /* remove device node */
if (major(udev->devt) != 0 && strcmp(udev->action, "remove") == 0) {
struct name_entry *name_loop;
+ /* import and delete database entry */
+ if (udev_db_get_device(udev, udev->dev->devpath) == 0) {
+ udev_db_delete_device(udev);
+ if (udev->ignore_remove) {
+ dbg("remove event for '%s' requested to be ignored by rule", udev->name);
+ return 0;
+ }
+ /* restore stored persistent data */
+ list_for_each_entry(name_loop, &udev->env_list, node)
+ putenv(name_loop->name);
+ } else {
+ dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name);
+ strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name));
+ }
+
udev_rules_get_run(rules, udev);
if (udev->ignore_device) {
info("device event will be ignored");
- return 0;
+ goto exit;
}
- /* get data from db, remove db-entry, delete node */
- retval = udev_remove_device(udev);
- /* restore stored persistent data */
- list_for_each_entry(name_loop, &udev->env_list, node)
- putenv(name_loop->name);
- return retval;
+ retval = udev_node_remove(udev);
+ goto exit;
}
- /* default devices without a node */
+ /* default devices */
udev_rules_get_run(rules, udev);
if (udev->ignore_device)
info("device event will be ignored");
+exit:
return retval;
}
diff --git a/udev_add.c b/udev_node.c
similarity index 67%
rename from udev_add.c
rename to udev_node.c
index 6c023ab..9d6e89c 100644
--- a/udev_add.c
+++ b/udev_node.c
@@ -1,5 +1,5 @@
/*
- * udev-add.c
+ * udev-node.c - device node handling
*
* Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
* Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
@@ -29,17 +29,13 @@
#include <grp.h>
#include <sys/stat.h>
#include <sys/types.h>
-#include <sys/socket.h>
-#include <sys/ioctl.h>
-#include <net/if.h>
-#include <linux/sockios.h>
#include "udev.h"
#include "udev_rules.h"
#include "udev_selinux.h"
-int udev_make_node(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid)
+int udev_node_mknod(struct udevice *udev, const char *file, dev_t devt, mode_t mode, uid_t uid, gid_t gid)
{
struct stat stats;
int retval = 0;
@@ -94,7 +90,7 @@ exit:
return retval;
}
-static int create_node(struct udevice *udev)
+int udev_node_add(struct udevice *udev)
{
char filename[PATH_SIZE];
struct name_entry *name_loop;
@@ -102,6 +98,9 @@ static int create_node(struct udevice *u
gid_t gid;
int tail;
int i;
+ int retval = 0;
+
+ selinux_init();
snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name);
filename[sizeof(filename)-1] = '\0';
@@ -140,8 +139,10 @@ static int create_node(struct udevice *u
filename, major(udev->devt), minor(udev->devt), udev->mode, uid, gid);
if (!udev->test_run)
- if (udev_make_node(udev, filename, udev->devt, udev->mode, uid, gid) != 0)
- goto error;
+ if (udev_node_mknod(udev, filename, udev->devt, udev->mode, uid, gid) != 0) {
+ retval = -1;
+ goto exit;
+ }
setenv("DEVNAME", filename, 1);
@@ -166,7 +167,7 @@ static int create_node(struct udevice *u
snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i);
partitionname[sizeof(partitionname)-1] = '\0';
part_devt = makedev(major(udev->devt), minor(udev->devt) + i);
- udev_make_node(udev, partitionname, part_devt, udev->mode, uid, gid);
+ udev_node_mknod(udev, partitionname, part_devt, udev->mode, uid, gid);
}
}
}
@@ -176,7 +177,6 @@ static int create_node(struct udevice *u
char symlinks[512] = "";
list_for_each_entry(name_loop, &udev->symlink_list, node) {
- int retval;
char linktarget[PATH_SIZE];
snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name);
@@ -208,11 +208,9 @@ static int create_node(struct udevice *u
if (!udev->test_run) {
unlink(filename);
selinux_setfscreatecon(filename, NULL, S_IFLNK);
- retval = symlink(linktarget, filename);
+ if (symlink(linktarget, filename) != 0)
+ err("symlink(%s, %s) failed: %s", linktarget, filename, strerror(errno));
selinux_resetfscreatecon();
- if (retval != 0)
- err("symlink(%s, %s) failed: %s",
- linktarget, filename, strerror(errno));
}
strlcat(symlinks, filename, sizeof(symlinks));
@@ -223,78 +221,87 @@ static int create_node(struct udevice *u
setenv("DEVLINKS", symlinks, 1);
}
- return 0;
-error:
- return -1;
+exit:
+ selinux_exit();
+ return retval;
}
-static int rename_net_if(struct udevice *udev)
+int udev_node_remove(struct udevice *udev)
{
- int sk;
- struct ifreq ifr;
+ char filename[PATH_SIZE];
+ char partitionname[PATH_SIZE];
+ struct name_entry *name_loop;
+ struct stat stats;
int retval;
+ int i;
+ int num;
- info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name);
- if (udev->test_run)
- return 0;
-
- sk = socket(PF_INET, SOCK_DGRAM, 0);
- if (sk < 0) {
- err("error opening socket: %s", strerror(errno));
- return -1;
- }
+ if (!list_empty(&udev->symlink_list)) {
+ char symlinks[512] = "";
- memset(&ifr, 0x00, sizeof(struct ifreq));
- strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ);
- strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
-
- retval = ioctl(sk, SIOCSIFNAME, &ifr);
- if (retval != 0)
- err("error changing net interface name: %s", strerror(errno));
- close(sk);
+ list_for_each_entry(name_loop, &udev->symlink_list, node) {
+ snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name);
+ filename[sizeof(filename)-1] = '\0';
- return retval;
-}
+ if (stat(filename, &stats) != 0) {
+ dbg("symlink '%s' not found", filename);
+ continue;
+ }
+ if (udev->devt && stats.st_rdev != udev->devt) {
+ info("symlink '%s' points to a different device, skip removal", filename);
+ continue;
+ }
-int udev_add_device(struct udevice *udev)
-{
- char *pos;
- int retval = 0;
+ info("removing symlink '%s'", filename);
+ unlink(filename);
- dbg("adding name='%s'", udev->name);
- selinux_init();
+ if (strchr(filename, '/'))
+ delete_path(filename);
- if (major(udev->devt)) {
- retval = create_node(udev);
- if (retval != 0)
- goto exit;
+ strlcat(symlinks, filename, sizeof(symlinks));
+ strlcat(symlinks, " ", sizeof(symlinks));
+ }
- if (udev_db_add_device(udev) != 0)
- dbg("udev_db_add_dev failed, remove might not work for custom names");
- } else if (strcmp(udev->dev->subsystem, "net") == 0) {
- /* look if we want to change the name of the netif */
- if (strcmp(udev->name, udev->dev->kernel_name) != 0) {
- retval = rename_net_if(udev);
- if (retval != 0)
- goto exit;
-
- info("renamed netif to '%s'", udev->name);
- /* we've changed the name, now fake the devpath, because the
- * original kernel name sleeps with the fishes and we don't
- * get an event from the kernel with the new name
- */
- pos = strrchr(udev->dev->devpath, '/');
- if (pos != NULL) {
- pos[1] = '\0';
- strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath));
- strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name));
- setenv("DEVPATH", udev->dev->devpath, 1);
- setenv("INTERFACE", udev->name, 1);
- }
+ remove_trailing_chars(symlinks, ' ');
+ if (symlinks[0] != '\0')
+ setenv("DEVLINKS", symlinks, 1);
+ }
+
+ snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name);
+ filename[sizeof(filename)-1] = '\0';
+
+ if (stat(filename, &stats) != 0) {
+ dbg("device node '%s' not found", filename);
+ return -1;
+ }
+ if (udev->devt && stats.st_rdev != udev->devt) {
+ info("device node '%s' points to a different device, skip removal", filename);
+ return -1;
+ }
+
+ info("removing device node '%s'", filename);
+ retval = unlink_secure(filename);
+ if (retval)
+ return retval;
+
+ setenv("DEVNAME", filename, 1);
+
+ num = udev->partitions;
+ if (num > 0) {
+ info("removing all_partitions '%s[1-%i]'", filename, num);
+ if (num > 255) {
+ info("garbage from udev database, skip all_partitions removal");
+ return -1;
+ }
+ for (i = 1; i <= num; i++) {
+ snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i);
+ partitionname[sizeof(partitionname)-1] = '\0';
+ unlink_secure(partitionname);
}
}
-exit:
- selinux_exit();
+ if (strchr(udev->name, '/'))
+ delete_path(filename);
+
return retval;
}
diff --git a/udev_remove.c b/udev_remove.c
deleted file mode 100644
index 6de6cf5..0000000
--- a/udev_remove.c
+++ /dev/null
@@ -1,135 +0,0 @@
-/*
- * udev-remove.c
- *
- * Copyright (C) 2003 Greg Kroah-Hartman <greg@kroah.com>
- * Copyright (C) 2004 Kay Sievers <kay.sievers@vrfy.org>
- *
- * 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 version 2 of the License.
- *
- * 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.,
- * 675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-
-#include <stdlib.h>
-#include <string.h>
-#include <stddef.h>
-#include <stdio.h>
-#include <fcntl.h>
-#include <unistd.h>
-#include <errno.h>
-#include <sys/stat.h>
-
-#include "udev.h"
-
-static int delete_node(struct udevice *udev)
-{
- char filename[PATH_SIZE];
- char partitionname[PATH_SIZE];
- struct name_entry *name_loop;
- struct stat stats;
- int retval;
- int i;
- int num;
-
- if (!list_empty(&udev->symlink_list)) {
- char symlinks[512] = "";
-
- list_for_each_entry(name_loop, &udev->symlink_list, node) {
- snprintf(filename, sizeof(filename), "%s/%s", udev_root, name_loop->name);
- filename[sizeof(filename)-1] = '\0';
-
- if (stat(filename, &stats) != 0) {
- dbg("symlink '%s' not found", filename);
- continue;
- }
- if (udev->devt && stats.st_rdev != udev->devt) {
- info("symlink '%s' points to a different device, skip removal", filename);
- continue;
- }
-
- info("removing symlink '%s'", filename);
- unlink(filename);
-
- if (strchr(filename, '/'))
- delete_path(filename);
-
- strlcat(symlinks, filename, sizeof(symlinks));
- strlcat(symlinks, " ", sizeof(symlinks));
- }
-
- remove_trailing_chars(symlinks, ' ');
- if (symlinks[0] != '\0')
- setenv("DEVLINKS", symlinks, 1);
- }
-
- snprintf(filename, sizeof(filename), "%s/%s", udev_root, udev->name);
- filename[sizeof(filename)-1] = '\0';
-
- if (stat(filename, &stats) != 0) {
- dbg("device node '%s' not found", filename);
- return -1;
- }
- if (udev->devt && stats.st_rdev != udev->devt) {
- info("device node '%s' points to a different device, skip removal", filename);
- return -1;
- }
-
- info("removing device node '%s'", filename);
- retval = unlink_secure(filename);
- if (retval)
- return retval;
-
- setenv("DEVNAME", filename, 1);
-
- num = udev->partitions;
- if (num > 0) {
- info("removing all_partitions '%s[1-%i]'", filename, num);
- if (num > 255) {
- info("garbage from udev database, skip all_partitions removal");
- return -1;
- }
- for (i = 1; i <= num; i++) {
- snprintf(partitionname, sizeof(partitionname), "%s%d", filename, i);
- partitionname[sizeof(partitionname)-1] = '\0';
- unlink_secure(partitionname);
- }
- }
-
- if (strchr(udev->name, '/'))
- delete_path(filename);
-
- return retval;
-}
-
-/*
- * look up the sysfs path in the database to get the node name to remove
- * If we can't find it, use kernel name for lack of anything else to know to do
- */
-int udev_remove_device(struct udevice *udev)
-{
- if (major(udev->devt) == 0)
- return 0;
-
- if (udev_db_get_device(udev, udev->dev->devpath) == 0) {
- if (udev->ignore_remove) {
- dbg("remove event for '%s' requested to be ignored by rule", udev->name);
- return 0;
- }
- dbg("remove name='%s'", udev->name);
- udev_db_delete_device(udev);
- } else {
- dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name);
- strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name));
- }
-
- return delete_node(udev);
-}
diff --git a/udev_rules.c b/udev_rules.c
index 1aedb11..09a299f 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -610,7 +610,7 @@ found:
snprintf(udev->tmp_node, sizeof(udev->tmp_node), "%s/.tmp-%u-%u",
udev_root, major(udev->devt), minor(udev->devt));
udev->tmp_node[sizeof(udev->tmp_node)-1] = '\0';
- udev_make_node(udev, udev->tmp_node, udev->devt, 0600, 0, 0);
+ udev_node_mknod(udev, udev->tmp_node, udev->devt, 0600, 0, 0);
}
strlcat(string, udev->tmp_node, maxsize);
dbg("substitute temporary device node name '%s'", udev->tmp_node);
diff --git a/udevstart.c b/udevstart.c
index e5ce7af..0d9b4f4 100644
--- a/udevstart.c
+++ b/udevstart.c
@@ -130,7 +130,6 @@ static int add_device(const char *devpat
/* override built-in sysfs device */
udev->dev = dev;
strcpy(udev->action, "add");
- udev->devt = udev_device_get_devt(udev);
if (strcmp(udev->dev->subsystem, "net") != 0) {
udev->devt = udev_device_get_devt(udev);
@@ -148,7 +147,7 @@ static int add_device(const char *devpat
goto exit;
}
if (udev->name[0] != '\0')
- retval = udev_add_device(udev);
+ retval = udev_device_event(&rules, udev);
else
info("device node creation supressed");
^ permalink raw reply related
* clone return code
From: Daniel 'NebuchadnezzaR' Dehennin @ 2006-04-05 20:46 UTC (permalink / raw)
To: sparclinux
Hello,
Sorry if that question seems idiot but is it normal that clone return
the parent pid in the child ?
Is seems that on other architectures it have the same behavior than
fork: return 0 in the child.
Regards.
--
Daniel 'NebuchadnezzaR' Dehennin
Récupérer ma clef GPG:
gpg --keyserver pgp.mit.edu --recv-keys 0x2A408F69
^ permalink raw reply
* Re: [Xenomai-help] Questions porting existing rtai-24.1.12 app to xenomai (PART II)
From: Randy Smith @ 2006-04-05 20:54 UTC (permalink / raw)
Cc: xenomai
In-Reply-To: <4433F441.2080309@domain.hid>
Philippe Gerum wrote:
> Wrt 2.4 kernels, the project provides patches against snapshots of
> Denx's development tree, accessible from
> http://www.denx.de/en/Software/CVS. The date of the snapshot was
> missing in the patch filenames, which introduced a fair amount of
> confusion; this has been fixed in the repository. All 2.4-based Adeos
> patches for ppc have been built against Denx's devel tree as of
> 2005-11-09 so far. The Adeos version is always given by the trailing
> rev. number of any patch filename, e.g. 1.0-04 is the latest Adeos
> rev. for 2.4/ppc kernels.
>
> For 2.6/ppc kernels, we provide patches against vanilla kernel trees
> as released by kernel.org.
Thanks, That clears that up.
>
> Ok, it's a bit early for Xmas gifts, but anyway, try this patch on
> 2.4.25-11 as shipped with the ELDK 3.1:
>
> http://download.gna.org/adeos/patches/v2.4/ppc/adeos-ipipe-2.4.25-11-ppc-denx-1.0-04.patch
>
>
I have downloaded the patch and will try it over the next few days and
report back. Thanks again and Feliz Navidad or perhaps I should say
Joyeux Noël?
-Randy
^ permalink raw reply
* Netfilter problem..
From: Admin on sosi.sk @ 2006-04-05 20:54 UTC (permalink / raw)
To: netfilter
In-Reply-To: <20060405173107.74543229166@sosi.sk>
Hi all,
I have interfaces:
eth0 - WAN
eth1 - LAN
eth2 - free
ath0 - Atheros AP
Then I have made a bridge br0(192.168.1.1) from ath0(0.0.0.0), eth1(0.0.0.0)
because I want wired and wireless metwork in one address range 192.168.1.0 -
192.168.1.255
and I run dhcp server over bridge br0.
Over eth1(wired network) works all fine.
I can not obtain IP address from dhcp over wifi interface ath0 and I get
this message in
tcpdump -vv -i br0
-------------------------------------------------------------------------------
br_netfilter: Argh!! br_nf_post_routing: bad mac.raw pointer.[eth1][br0]
head:c35d23e0, raw:c35d23fe, data:c35d23fe
-------------------------------------------------------------------------------
/var/log/messages
-------------------------------------------------------------------------------
Apr 4 22:38:23 sosiba kernel: IN=eth0 OUT=
MAC=ff:ff:ff:ff:ff:ff:00:e0:4c:67:66:d6:08:00 SRC=195.46.67.248
DST=255.255.255.255 LEN=128 TOS=0x00 PREC=0x00 TTL=128 ID=40800 PROTO=UDP
SPT=164 DPT=164 LEN=108
Apr 4 22:43:54 sosiba kernel: br_netfilter: Argh!! br_nf_post_routing: bad
mac.raw pointer.[eth1][br0] head:c2af95e0, raw:c2af95fe, data:c2af95fe
Apr 4 22:44:05 sosiba kernel: IN=br0 OUT= PHYSIN=ath0 PHYSOUT=eth1
MAC=ff:ff:ff:ff:ff:ff:00:07:0e:b4:50:a5:08:00 SRC=0.0.0.0
DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=128 ID=540 PROTO=UDP
SPT=68 DPT=67 LEN=308
Apr 4 22:44:05 sosiba dhcpd: DHCPREQUEST for 192.168.1.33 from
00:07:0e:b4:50:a5 via br0
Apr 4 22:44:05 sosiba dhcpd: DHCPACK on 192.168.1.33 to 00:07:0e:b4:50:a5
via br0
Apr 4 22:44:10 sosiba kernel: IN=br0 OUT= PHYSIN=ath0 PHYSOUT=eth1
MAC=ff:ff:ff:ff:ff:ff:00:07:0e:b4:50:a5:08:00 SRC=0.0.0.0
DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=128 ID=541 PROTO=UDP
SPT=68 DPT=67 LEN=308
Apr 4 22:44:10 sosiba dhcpd: DHCPREQUEST for 192.168.1.33 from
00:07:0e:b4:50:a5 via br0
Apr 4 22:44:10 sosiba dhcpd: DHCPACK on 192.168.1.33 to 00:07:0e:b4:50:a5
via br0
Apr 4 22:44:19 sosiba kernel: IN=br0 OUT= PHYSIN=ath0 PHYSOUT=eth1
MAC=ff:ff:ff:ff:ff:ff:00:07:0e:b4:50:a5:08:00 SRC=0.0.0.0
DST=255.255.255.255 LEN=328 TOS=0x00 PREC=0x00 TTL=128 ID=542 PROTO=UDP
SPT=68 DPT=67 LEN=308
Apr 4 22:44:19 sosiba dhcpd: DHCPREQUEST for 192.168.1.33 from
00:07:0e:b4:50:a5 via br0
Apr 4 22:44:19 sosiba dhcpd: DHCPACK on 192.168.1.33 to 00:07:0e:b4:50:a5
via br0
-------------------------------------------------------------------------------
my iptables settings
-------------------------------------------------------------------------------
# Generated by iptables-save v1.2.9 on Fri Mar 18 11:14:11 2005
*mangle
:PREROUTING ACCEPT [1043684:865001650]
:INPUT ACCEPT [1041756:864643520]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [892707:425469139]
:POSTROUTING ACCEPT [892775:425458561]
COMMIT
# Completed on Fri Mar 18 11:14:11 2005
# Generated by iptables-save v1.2.9 on Fri Mar 18 11:14:11 2005
*nat
:OUTPUT ACCEPT [0:0]
:PREROUTING ACCEPT [0:0]
:POSTROUTING ACCEPT [0:0]
-A POSTROUTING -s 192.168.1.0/24 -o eth0 -j MASQUERADE
-A POSTROUTING -s 192.168.2.0/24 -o eth0 -j MASQUERADE
-A PREROUTING -s 192.168.0.0/16 -i eth0 -j DROP
-A PREROUTING -s 172.16.0.0/12 -i eth0 -j DROP
-A PREROUTING -s 10.0.0.0/8 -i eth0 -j DROP
COMMIT
# Completed on Fri Mar 18 11:14:11 2005
# Generated by iptables-save v1.2.9 on Fri Mar 18 11:14:11 2005
*filter
:FORWARD ACCEPT [0:0]
:INPUT ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
:syn_flood - [0:0]
-A INPUT -p udp -m udp -m multiport -j LOG --dports 67,68
-A INPUT -m state --state ESTABLISHED,RELATED -j ACCEPT
# ICMP pakety
-A INPUT -p icmp -m icmp -i eth0 --icmp-type echo-reply -j ACCEPT
-A INPUT -p icmp -m icmp -i eth0 --icmp-type destination-unreachable -j
ACCEPT
-A INPUT -p icmp -m icmp -m limit -i eth0 --icmp-type echo-request --limit
1/s --limit-burst 5 -j ACCEPT
-A INPUT -p icmp -m icmp -i eth0 --icmp-type time-exceeded -j ACCEPT
-A INPUT -p tcp -m tcp -i eth0 --dport 113 -j REJECT
-A INPUT -p tcp -m tcp -m multiport -i eth0 -j ACCEPT --dports
4662,4663,4711
-A INPUT -p udp -m udp -i eth0 --dport 4672 -j ACCEPT
# sshd
-A INPUT -p tcp -m tcp -s 217.75.72.98 -i eth0 --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp -s 62.152.224.131 -i eth0 --dport 22 -j ACCEPT
-A INPUT -p tcp -m tcp -s 195.46.69.224/29 -i eth0 --dport 22 -j ACCEPT
# Prepustim toto na eth0
-A INPUT -p tcp -m tcp -m multiport -i eth0 -j ACCEPT --dports
20,21,80,443,901,10000
# Prepustim toto na eth1, eth2
-A INPUT -i br0 -j ACCEPT
-A INPUT -i eth2 -j ACCEPT
-A OUTPUT -p udp -m udp -m multiport -j LOG --dports 67,68
-A OUTPUT -p udp -m udp -m multiport -j LOG --sports 67,68
-A OUTPUT -o lo -j ACCEPT
-A OUTPUT -m state --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A OUTPUT -s 127.0.0.1 -j ACCEPT
-A OUTPUT -s 192.168.1.1 -j ACCEPT
-A OUTPUT -s 192.168.2.1 -j ACCEPT
-A OUTPUT -s 195.46.69.228 -j ACCEPT
-A OUTPUT -m limit --limit 3/hour --limit-burst 5 -j LOG
-A FORWARD -m state -i br0 --state NEW,ESTABLISHED,RELATED -j ACCEPT
-A syn_flood -m limit --limit 1/s --limit-burst 5 -j RETURN
-A syn_flood -j DROP
# Prepustim toto na eth1
-A INPUT -i lo -j ACCEPT
-A INPUT -p udp -m udp -m multiport -j LOG --dports 67,68
-A INPUT -p tcp -i eth0 -j syn_flood --syn
# log DoS
-A INPUT -m limit --limit 3/hour --limit-burst 5 -j LOG
# Vsetko ostatne zabi!
-A INPUT -j DROP
-A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT
-A FORWARD -p udp -m udp -m multiport -j LOG --dports 67,68
-A FORWARD -p udp -m udp -m multiport -j LOG --sports 67,68
COMMIT
# Completed on Fri Mar 18 11:14:11 2005
-------------------------------------------------------------------------------
I am runing kernel-2.6.12-17mdk.
Please what could be wrong?
Robert.
^ permalink raw reply
* Re: [PATCH] unusual_devs.h, kernel 2.6.15.6
From: Greg KH @ 2006-04-05 20:54 UTC (permalink / raw)
To: Denis Sunko; +Cc: linux-kernel, akpm, david
In-Reply-To: <20060404141520.7778.qmail@web35506.mail.mud.yahoo.com>
On Tue, Apr 04, 2006 at 07:15:20AM -0700, Denis Sunko wrote:
> This patch adds an UNUSUAL_DEV entry which prevents a particular usb
> drive from flooding the console with useless SCSI messages. It is
> patterned after similar ones for other manufacturers. I also took the
> opportunity to correct the order of entries, manufacturer 0x0451 was
> out of order.
>
> I thank David H?rdeman for help with this one.
This has already been submitted, sorry, someone beat you :)
thanks,
greg k-h
^ permalink raw reply
* [U-Boot-Users] [PATCH] objcopy for srec and bin files should be done on .o files
From: Wolfgang Denk @ 2006-04-05 21:04 UTC (permalink / raw)
To: u-boot
In-Reply-To: <20060405185908.GW27792@bork.org>
In message <20060405185908.GW27792@bork.org> you wrote:
>
> > Plewase explain what "fails for me means" (error message(s), used
> > toolchain and versions of the binutils, host environment etc.).
>
> mort at descartes:~/src/targa/u-boot2$ make ASH405_config CROSS_COMPILE=powerpc-405-linux-gnu-
> Configuring for ASH405 board...
> mort at descartes:~/src/targa/u-boot2$ make CROSS_COMPILE=powerpc-405-linux-gnu-
>
> [snip]
>
> powerpc-405-linux-gnu-gcc -g -Os -fPIC -ffixed-r14 -meabi -fno-strict-aliasing -D__KERNEL__ -DTEXT_BASE=0xFFFC0000 -I/home/mort/src/targa/u-boot2/include -fno-builtin -ffreestanding -nostdinc -isystem /home/mort/src/targa/powerpc-linux/gcc-3.4.5-glibc-2.3.6/powerpc-405-linux-gnu/bin/../lib/gcc/powerpc-405-linux-gnu/3.4.5/include -pipe -DCONFIG_PPC -D__powerpc__ -DCONFIG_4xx -ffixed-r2 -ffixed-r29 -mstring -Wa,-m405 -mcpu=405 -msoft-float -Wall -Wstrict-prototypes -c -o stubs.o stubs.c
> powerpc-405-linux-gnu-ar crv libstubs.a ppc_longjmp.o ppc_setjmp.o stubs.o
> r - ppc_longjmp.o
> r - ppc_setjmp.o
> r - stubs.o
> make[1]: *** No rule to make target `hello_world.srec', needed by `all'. Stop.
SSounds as if your Makefile is corrupted. Of course there is a
hello_world.srec target in it. Or your version of "make" is broken...
> That's your git HEAD. The problem is also present at the 1.1.4 tag.
> I"m not actually using the ASH405, but I just used it as an example...
Me too. Works perfectly fine here:
-> ./MAKEALL ASH405
Configuring for ASH405 board...
text data bss dec hex filename
189384 9768 37456 236608 39c40 u-boot
->
No errors, no warnings.
> The compiler is a gcc-3.4.5/binutils-2.15 (and glibc-2.3.6) x86->ppc405
> cross compiler built by crosstools-0.42
Well, this is IMHO a toolchain problem. The code builds fine with
ELDK 3.x (GC-3.3.3 / binutils 2.14) and ELDK 4.x (GCC-4.0.0 /
binutils 2.16.1).
I think I reject your patch.
Best regards,
Wolfgang Denk
--
Software Engineering: Embedded and Realtime Systems, Embedded Linux
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
"It is easier to port a shell than a shell script." - Larry Wall
^ permalink raw reply
* Re: Cygwin can't handle huge packfiles?
From: Christopher Faylor @ 2006-04-05 21:08 UTC (permalink / raw)
To: Johannes Schindelin, Kees-Jan Dijkzeul, git
In-Reply-To: <Pine.LNX.4.63.0604051612200.25304@wbgn013.biozentrum.uni-wuerzburg.de>
On Wed, Apr 05, 2006 at 04:14:20PM +0200, Johannes Schindelin wrote:
>> Inspired by a patch of Alex Riesen (thanks, Alex), I tried to use the
>> regular mmap for mapping pack files, only to discover that I compile
>> without defining "NO_MMAP", so I've been using the stock mmap all
>> along. So now I'm thinking that the cygwin mmap also does a
>> malloc-and-read, just like git does with NO_MMAP. So I'll continue to
>> investigate in that direction.
>
>I think cygwin's mmap() is based on the Win32 API equivalent, which could
>mean that it *is* memory mapped, but in a special area (which is smaller
>than 1.5 gigabyte). In this case, it would make sense to limit the pack
>size, thereby having several packs, and mmap() them as they are needed.
Yes, cygwin's mmap uses CreateFileMapping and MapViewOfFile. IIRC,
Windows might have a 2G limitation lurking under the hood somewhere but
I think that might be tweakable with some registry setting.
cgf
^ permalink raw reply
* Re: [uml-devel] [RFC][PATCH] include /usr/lib/uml in PATH
From: Mattia Dongili @ 2006-04-05 21:11 UTC (permalink / raw)
To: Blaisorblade; +Cc: user-mode-linux-devel, Geert Uytterhoeven, Jeff Dike
In-Reply-To: <200604040239.45495.blaisorblade@yahoo.it>
[-- Attachment #1: Type: text/plain, Size: 1281 bytes --]
On Tue, Apr 04, 2006 at 02:39:44AM +0200, Blaisorblade wrote:
> On Sunday 02 April 2006 21:54, Mattia Dongili wrote:
[...]
> Thanks for the patch, we'll possibly apply it, but we need to reimplement (or
> copy and fix from glibc) a two-phase execvp(). I've not done it because I've
> felt unconfortable with the idea but it's the better I could think of for
> now.
Hmm. I see.
> However, probably the patch can be merged anyway, or at least its idea...
[...]
> *) I'd agree with Geert, but you're indeed correct for that...
> *) Saying "19" gets a "NO"
I'm sorry... damn lazy programmers :)
>
> #define UML_LIB_PATH ":/usr/lib/uml"
what about a config option instead? CONFIG_UML_NET_PATH
> 19 -> strlen(UML_LIB_PATH)
> in snprintf, "PATH=%s:/usr/lib/uml" -> "PATH=%s" UML_LIB_PATH
>
> (using string literal concatenation)
here's an updated patch, I added a check for current PATH=="" to avoid
touching the PATH variable when empty (again, kind of keeping the same
behaviour of a clean execvp, I mean it makes no sense to append
/usr/lib/uml and not /bin:/usr/bin too).
Description:
append /usr/lib/uml to the existing PATH environment variable to let
execvp search uml_net in FHS compliant locations.
Signed-off-by: Mattia Dongili <malattia@linux.it>
--
mattia
:wq!
[-- Attachment #2: uml_net-2.diff --]
[-- Type: text/plain, Size: 1280 bytes --]
diff --git a/arch/um/os-Linux/main.c b/arch/um/os-Linux/main.c
index 2878e89..774a3d7 100644
--- a/arch/um/os-Linux/main.c
+++ b/arch/um/os-Linux/main.c
@@ -74,6 +74,38 @@ static void last_ditch_exit(int sig)
exit(1);
}
+#define UML_LIB_PATH ":/usr/lib/uml"
+
+static void setup_env_path(void) {
+ char *new_path = NULL;
+ char *old_path = NULL;
+ int path_len = 0;
+
+ old_path = getenv("PATH");
+ if (!old_path) {
+ /* if no PATH variable is set, just use
+ * the default + /usr/lib/uml
+ */
+ putenv("PATH=:/bin:/usr/bin/" UML_LIB_PATH);
+ return;
+ }
+
+ /* do nothing if the PATH variable exists but is empty */
+ path_len = strlen(old_path);
+ if (!path_len)
+ return;
+
+ /* append /usr/lib/uml to the existing path */
+ path_len += strlen("PATH=" UML_LIB_PATH) + 1;
+ new_path = malloc(path_len * sizeof(char));
+ if (!new_path) {
+ perror("coudn't malloc to set a new PATH");
+ return;
+ }
+ snprintf(new_path, path_len, "PATH=%s" UML_LIB_PATH, old_path);
+ putenv(new_path);
+}
+
extern int uml_exitcode;
extern void scan_elf_aux( char **envp);
@@ -114,6 +146,8 @@ int main(int argc, char **argv, char **e
set_stklim();
+ setup_env_path();
+
new_argv = malloc((argc + 1) * sizeof(char *));
if(new_argv == NULL){
perror("Mallocing argv");
^ permalink raw reply related
* Re: [LARTC] QoS - Ping problem
From: Jody Shumaker @ 2006-04-05 21:11 UTC (permalink / raw)
To: lartc
In-Reply-To: <44340CD6.1030907@cnett.com.br>
> CLASS="/sbin/tc class add dev $DL parent"
> $CLASS 1: classid 1:1 htb rate 3072Kbit
> $CLASS 1:1 classid 1:10 htb rate 1024Kbit ceil 1024Kbit
> $CLASS 1:1 classid 1:20 htb rate 1536Kbit ceil 2560Kbit
> $CLASS 1:1 classid 1:30 htb rate 512Kbit ceil 1024Kbit
> $CLASS 1:1 classid 1:40 htb rate 512Kbit ceil 1024Kbit
> $CLASS 1:1 classid 1:50 htb rate 512Kbit ceil 1024Kbit
>
For starters you might want to fix these rates.
1024+1536+512+512+512 != 3072
Over allocating may be causing the high number of dropped packets, and
its at least worth fixing before trying anything else. Make sure child
classes rates never add up to greater than the parents rate, in your
case 3072Kbit. Beyond that though I don't see anything obvious. You're
using sfq which what I usually see recommended to increase the queue
size and avoid dropped packets.
- Jody
_______________________________________________
LARTC mailing list
LARTC@mailman.ds9a.nl
http://mailman.ds9a.nl/cgi-bin/mailman/listinfo/lartc
^ permalink raw reply
* freescale lite 5200 board and kernel 2.6
From: Domenico Andreoli @ 2006-04-05 21:06 UTC (permalink / raw)
To: linuxppc-embedded
hi all,
i've got a freescale lite 5200 evaluation board (1 pci slot), i need
it to develop the driver for a industrial labeler machine. i was given
also some old evaluation version of metrowerks PCS and BSP stuff.
guess it.. i want to throw that software away and start from scratch
using kernel 2.6, maybe 2.6.16.
i made a cross-compiler, i built a vanilla 2.6.16 and put it on the
board's flash. i'd like to use rootfs from nfs. everything looks
promising, but vanilla 2.6.16 is not enough.
i've got some patches from patchwork.ozlabs.org (don't ask me which,
i'm not finding them any more.. one is named bcomm-to-split.diff),
re-compiled the kernel and now the board has also a network interface.
but i suspect the nic does not work correctly. sometimes kernel mounts
the rootfs, some (more) times it does not. when it does, i'm also able
to ping it from the network. conversely, i'm not.
i'm pretty confident that kernel network configuration is always right,
it is saved in the u-boot environment. network is a private one, two
hosts only.
i played a couple of days on this but i've to take a decision, time
is against me. start to develop for the old kernel 2.4 in the PCS &
BSP stuff or start with a shiny 2.6 (i've also a brand new rubini's
3rd edition "linux device drivers"!)
is there any patchset i can use for kernel 2.6? is it production-ready?
why isn't already in vanilla 2.6? has any sense to stay with kernel 2.4?
any help or hint is appreciated. thank you.
cheers
domenico
-----[ Domenico Andreoli, aka cavok
--[ http://people.debian.org/~cavok/gpgkey.asc
---[ 3A0F 2F80 F79C 678A 8936 4FEE 0677 9033 A20E BC50
^ permalink raw reply
* Re: 2.6.17-rc1-mm1
From: Luck, Tony @ 2006-04-05 21:17 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Zou Nan hai, Andrew Morton, LKML, linux-ia64
In-Reply-To: <200604051015.34217.bjorn.helgaas@hp.com>
On Wed, Apr 05, 2006 at 10:15:34AM -0600, Bjorn Helgaas wrote:
> Huh. Intel firmware used to just not mention the VGA framebuffer
> (0xa0000-0xc0000) at all in the EFI memory map. I think that was
> clearly a bug. So maybe they fixed that by marking it WB (and
> hopefully UC as well).
Nope ... not fixed (at least not in the f/w that I'm running). The
VGA buffer is still simply not mentioned in the EFI memory map.
The problem looks to come from this code in vgacon.c:
vga_vram_base = VGA_MAP_MEM(vga_vram_base);
vga_vram_end = VGA_MAP_MEM(vga_vram_end);
vga_vram_size = vga_vram_end - vga_vram_base;
vga_vram_base is 0xb8000, and this call gets a UC return of
c0000000000b8000. But vga_vram_end is 0xc0000 ... which is
the address of the start of a block of memory that is both
WB and UC capable. So ioremap() gives us e0000000000c0000
(which means that vga_vram_size is 2000000000008000, surely
the biggest, baddest video card in the history of the world!).
Perhaps the right fix is to subtract 1 from vga_vram_end and pass
that into VGA_MAP_MEM(), and then add the 1 byte back when computing
the size? But I don't know whether that might do something bad on
some other architecture that uses vgacon.c. If this is not
acceptable, then we can fall back and use the Nanhai/Bjorn fix
of using ioremap_nocache().
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d5a04b6..4ca9877 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -484,8 +484,8 @@ #endif
}
vga_vram_base = VGA_MAP_MEM(vga_vram_base);
- vga_vram_end = VGA_MAP_MEM(vga_vram_end);
- vga_vram_size = vga_vram_end - vga_vram_base;
+ vga_vram_end = VGA_MAP_MEM(vga_vram_end - 1);
+ vga_vram_size = vga_vram_end - vga_vram_base + 1;
/*
* Find out if there is a graphics card present.
^ permalink raw reply related
* Re: 2.6.17-rc1-mm1
From: Luck, Tony @ 2006-04-05 21:17 UTC (permalink / raw)
To: Bjorn Helgaas; +Cc: Zou Nan hai, Andrew Morton, LKML, linux-ia64
In-Reply-To: <200604051015.34217.bjorn.helgaas@hp.com>
On Wed, Apr 05, 2006 at 10:15:34AM -0600, Bjorn Helgaas wrote:
> Huh. Intel firmware used to just not mention the VGA framebuffer
> (0xa0000-0xc0000) at all in the EFI memory map. I think that was
> clearly a bug. So maybe they fixed that by marking it WB (and
> hopefully UC as well).
Nope ... not fixed (at least not in the f/w that I'm running). The
VGA buffer is still simply not mentioned in the EFI memory map.
The problem looks to come from this code in vgacon.c:
vga_vram_base = VGA_MAP_MEM(vga_vram_base);
vga_vram_end = VGA_MAP_MEM(vga_vram_end);
vga_vram_size = vga_vram_end - vga_vram_base;
vga_vram_base is 0xb8000, and this call gets a UC return of
c0000000000b8000. But vga_vram_end is 0xc0000 ... which is
the address of the start of a block of memory that is both
WB and UC capable. So ioremap() gives us e0000000000c0000
(which means that vga_vram_size is 2000000000008000, surely
the biggest, baddest video card in the history of the world!).
Perhaps the right fix is to subtract 1 from vga_vram_end and pass
that into VGA_MAP_MEM(), and then add the 1 byte back when computing
the size? But I don't know whether that might do something bad on
some other architecture that uses vgacon.c. If this is not
acceptable, then we can fall back and use the Nanhai/Bjorn fix
of using ioremap_nocache().
Signed-off-by: Tony Luck <tony.luck@intel.com>
---
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c
index d5a04b6..4ca9877 100644
--- a/drivers/video/console/vgacon.c
+++ b/drivers/video/console/vgacon.c
@@ -484,8 +484,8 @@ #endif
}
vga_vram_base = VGA_MAP_MEM(vga_vram_base);
- vga_vram_end = VGA_MAP_MEM(vga_vram_end);
- vga_vram_size = vga_vram_end - vga_vram_base;
+ vga_vram_end = VGA_MAP_MEM(vga_vram_end - 1);
+ vga_vram_size = vga_vram_end - vga_vram_base + 1;
/*
* Find out if there is a graphics card present.
^ permalink raw reply related
* Re: Issues with symbol names
From: Sam Ravnborg @ 2006-04-05 21:18 UTC (permalink / raw)
To: Kristis Makris; +Cc: linux-kernel
In-Reply-To: <1144268838.8306.16.camel@syd.mkgnu.net>
> So in summary:
>
> - Can the kernel from now on start being linked with --warn-common ?
Please try this with an allyesconfig build a enjoy the result.
There is a huge effort involded before getting remotely warning free in
this area.
Your approch seems to neglect the fact that the linker may rearrange
functions if it decide to do so.
And on X86_64 we actually do so with CONFIG_REORDER.
Someone on the list will probarly have som inputs how to do what you try
in a more protable way.
Sam
^ permalink raw reply
* Re: [Alsa-devel] Slab corruptions & Re: 2.6.17-rc1: Oops in sound applications
From: Ken Moffat @ 2006-04-05 21:19 UTC (permalink / raw)
To: Jan Niehusmann; +Cc: Takashi Iwai, Ken Moffat, linux-kernel, alsa-devel
In-Reply-To: <20060405121537.GA4807@knautsch.gondor.com>
[-- Warning: decoded text below may be mangled, UTF-8 assumed --]
[-- Attachment #1: Type: TEXT/PLAIN; charset=X-UNKNOWN, Size: 515 bytes --]
On Wed, 5 Apr 2006, Jan Niehusmann wrote:
> On Wed, Apr 05, 2006 at 01:14:54PM +0200, Takashi Iwai wrote:
> > Try the patch below. The change in pcm_native.c may be unnecessary,
> > but it's better so.
> > If it works, I'll submit the patches with a proper log.
>
> The patch (applied to 2.6.17-rc1) does fix the oops, but sound is still
> garbled with twinkle using /dev/dsp.
As a simple user of (only) playback, it fixes it. Thanks to you both.
Ken
--
das eine Mal als Tragödie, das andere Mal als Farce
^ permalink raw reply
* Re: patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree
From: Rene Herman @ 2006-04-05 21:22 UTC (permalink / raw)
To: dtor_core
Cc: Greg KH, alsa-devel, linux-kernel, tiwai, Andrew Morton,
Russell King
In-Reply-To: <d120d5000604050759k576133a9t90dd02c35fce91af@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
Dmitry Torokhov wrote:
> You need to let go of the model that driver that drives hardware also
> do the device discovery and it will all fall into place.
It's not possible to sanely let go of that model. ISA discovery involves
(as an example) poking at the same I/O ports as using does, meaning you
will have to share a request_region() over discovery and use for one --
you can't decouple that due to obvious races.
>> Anyways, the additional method would, I feel, be the conceptually
>> cleanest approach. Practically speaking though, simply doing a manual
>> probe and only calling platform_register() after everything is found to
>> be present and accounted for is not much of a problem either.
>>
>
> Unfortunately it breaks manual driver binding/unbinding through sysfs
> so I don't think it is a good long-term solution.
Yes. I don't see a significantly cleaner solution then than the slightly
hackish "using drvdata as a private success flag" that I posted before.
Example patch versus snd_adlib attached again. This seems to work well.
Takashi: do you agree? If the probe() method return is not going to be
propagated up, there are few other options.
(Continuing the loop on IS_ERR(device) is then also a bit questionable
again as the IS_ERR then signifies an eror in the bowels of the device
model, but I feel it's still the correct thing to do)
Rene.
[-- Attachment #2: adlib_unregister.diff --]
[-- Type: text/plain, Size: 1033 bytes --]
Index: local/sound/isa/adlib.c
===================================================================
--- local.orig/sound/isa/adlib.c 2006-04-05 02:00:55.000000000 +0200
+++ local/sound/isa/adlib.c 2006-04-05 02:05:45.000000000 +0200
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(str
struct snd_card *card;
struct snd_opl3 *opl3;
- int error;
- int i = device->id;
+ int error, i = device->id;
if (port[i] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR DRV_NAME ": please specify port\n");
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(str
return 0;
out1: snd_card_free(card);
- out0: error = -EINVAL; /* FIXME: should be the original error code */
- return error;
+out0: return error;
}
static int __devexit snd_adlib_remove(struct platform_device *device)
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(v
if (IS_ERR(device))
continue;
+ if (!platform_get_drvdata(device)) {
+ platform_device_unregister(device);
+ continue;
+ }
+
devices[i] = device;
cards++;
}
^ permalink raw reply
* Re: patch bus_add_device-losing-an-error-return-from-the-probe-method.patch added to gregkh-2.6 tree
From: Rene Herman @ 2006-04-05 21:22 UTC (permalink / raw)
To: dtor_core
Cc: Greg KH, alsa-devel, linux-kernel, tiwai, Andrew Morton,
Russell King
In-Reply-To: <d120d5000604050759k576133a9t90dd02c35fce91af@mail.gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1379 bytes --]
Dmitry Torokhov wrote:
> You need to let go of the model that driver that drives hardware also
> do the device discovery and it will all fall into place.
It's not possible to sanely let go of that model. ISA discovery involves
(as an example) poking at the same I/O ports as using does, meaning you
will have to share a request_region() over discovery and use for one --
you can't decouple that due to obvious races.
>> Anyways, the additional method would, I feel, be the conceptually
>> cleanest approach. Practically speaking though, simply doing a manual
>> probe and only calling platform_register() after everything is found to
>> be present and accounted for is not much of a problem either.
>>
>
> Unfortunately it breaks manual driver binding/unbinding through sysfs
> so I don't think it is a good long-term solution.
Yes. I don't see a significantly cleaner solution then than the slightly
hackish "using drvdata as a private success flag" that I posted before.
Example patch versus snd_adlib attached again. This seems to work well.
Takashi: do you agree? If the probe() method return is not going to be
propagated up, there are few other options.
(Continuing the loop on IS_ERR(device) is then also a bit questionable
again as the IS_ERR then signifies an eror in the bowels of the device
model, but I feel it's still the correct thing to do)
Rene.
[-- Attachment #2: adlib_unregister.diff --]
[-- Type: text/plain, Size: 1033 bytes --]
Index: local/sound/isa/adlib.c
===================================================================
--- local.orig/sound/isa/adlib.c 2006-04-05 02:00:55.000000000 +0200
+++ local/sound/isa/adlib.c 2006-04-05 02:05:45.000000000 +0200
@@ -43,8 +43,7 @@ static int __devinit snd_adlib_probe(str
struct snd_card *card;
struct snd_opl3 *opl3;
- int error;
- int i = device->id;
+ int error, i = device->id;
if (port[i] == SNDRV_AUTO_PORT) {
snd_printk(KERN_ERR DRV_NAME ": please specify port\n");
@@ -95,8 +94,7 @@ static int __devinit snd_adlib_probe(str
return 0;
out1: snd_card_free(card);
- out0: error = -EINVAL; /* FIXME: should be the original error code */
- return error;
+out0: return error;
}
static int __devexit snd_adlib_remove(struct platform_device *device)
@@ -134,6 +132,11 @@ static int __init alsa_card_adlib_init(v
if (IS_ERR(device))
continue;
+ if (!platform_get_drvdata(device)) {
+ platform_device_unregister(device);
+ continue;
+ }
+
devices[i] = device;
cards++;
}
^ permalink raw reply
* Re: clone return code
From: David S. Miller @ 2006-04-05 21:21 UTC (permalink / raw)
To: sparclinux
In-Reply-To: <87psjvu4wa.fsf@thorr.asgardr.info>
From: Daniel 'NebuchadnezzaR' Dehennin <sparc@asgardr.info>
Date: Wed, 05 Apr 2006 22:46:45 +0200
> Sorry if that question seems idiot but is it normal that clone return
> the parent pid in the child ?
>
> Is seems that on other architectures it have the same behavior than
> fork: return 0 in the child.
The system call convention follows that of SunOS on which
the syscall handling was based. Return "1" in the %o1
register in the child and "0" in the parent, and that's how
the the call sites distinguish the two cases.
GLIBC's fork() and clone() stubs interpret this properly and
give the expected return values.
If you want to implement your own direct calls to these
system calls you'll need to handle the return values
properly, else just call the glibc provided stubs directly
which will do this for you.
Why is this an issue?
^ permalink raw reply
* FIQ Handler
From: Matt Callow @ 2006-04-05 21:22 UTC (permalink / raw)
To: linux-omap-open-source
Hi,
I've been trying to install a FIQ handler for an omap 5910 board
(actually the amstrad E3) but I seem to get a data abort exception as
soon as I read the SIR_FIQ_CODE register.
I note in the omap source (arch/arm/mach-omap1/irq.c) it says read the
mailing list threads on FIQ handlers if you are planning to add a FIQ
handler. So, I've looked through the archives but can only find a
reference to http://lkml.org/lkml/2005/6/22/111
Is there more information that I'm missing. If so, could someone point
me in the right direction please.
Matt
^ permalink raw reply
* [PATCH] net: Broadcast ARP packets on link local addresses (Version2).
From: David Daney @ 2006-04-05 21:22 UTC (permalink / raw)
To: netdev; +Cc: linux-kernel, pgf, freek
From: David Daney
Here is a new version of the patch I sent March 31. For background,
this is my description from the first patch:
> When an internet host joins a network where there is no DHCP server,
> it may auto-allocate an IP address by the method described in RFC
> 3927. There are several user space daemons available that implement
> most of the protocol (zcip, busybox, ...). The kernel's APR driver
> should function in the normal manner except that it is required to
> broadcast all ARP packets that it originates in the link local address
> space (169.254.0.0/16). RFC 3927 section 2.5 explains the requirement.
> The current ARP code is non-compliant because it does not broadcast
> some ARP packets as required by RFC 3927.
> This patch to net/ipv4/arp.c checks the source address of all ARP
> packets and if the fall in 169.254.0.0/16, they are broadcast instead
> of unicast.
All of that is still true.
The changes in this version are that it tests the source IP address
instead of the destination. The test now matches the test described
in the RFC. Also a small cleanup as suggested by Herbert Xu.
Some comments on the first version of the patch suggested that I do
'X' instead. Where 'X' was behavior different than that REQUIRED by
the RFC (the RFC's always seem to capitalize the word 'required').
The reason that I implemented the behavior required by the RFC is so
that a device running the kernel can pass compliance tests that
mandate RFC compliance.
If the patch is deemed good and correct, great, please apply it.
Othwise comments about how to improve it are always welcome. But keep
in mind that I would like to end up with something that complies with
the RFC.
This patch is against 2.6.16.1
Signed-off-by: David Daney <ddaney@avtrex.com>
---
--- net/ipv4/arp.c.orig 2006-03-31 13:44:50.000000000 -0800
+++ net/ipv4/arp.c 2006-04-05 13:33:19.000000000 -0700
@@ -690,6 +690,11 @@ void arp_send(int type, int ptype, u32 d
if (dev->flags&IFF_NOARP)
return;
+ /* If link local address (169.254.0.0/16) we must broadcast
+ * the ARP packet. See RFC 3927 section 2.5 for details. */
+ if ((src_ip & htonl(0xFFFF0000UL)) == htonl(0xA9FE0000UL))
+ dest_hw = NULL;
+
skb = arp_create(type, ptype, dest_ip, dev, src_ip,
dest_hw, src_hw, target_hw);
if (skb == NULL) {
^ permalink raw reply
* Re: freescale lite 5200 board and kernel 2.6
From: Matthias Fechner @ 2006-04-05 21:27 UTC (permalink / raw)
To: linuxppc-embedded
In-Reply-To: <20060405210654.GA16848@raptus.dandreoli.com>
Hello Domenico,
* Domenico Andreoli <cavokz@gmail.com> [05-04-06 23:06]:
> is there any patchset i can use for kernel 2.6? is it production-ready?
> why isn't already in vanilla 2.6? has any sense to stay with kernel 2.4?
I'm not sure if this helps, but I was successfully in getting a kernel
2.6 running with the icecube board. I have written a short docu in my
wiki (booting with tftp and rootnfs over NFS):
http://wiki.idefix.fechner.net/index.php/IceCube#Writing_kernel_modules_for_2.6
Maybe this will help.
Please give me some feedback.
Best regards,
Matthias
^ permalink raw reply
* [-mm patch] drivers/media/video/ks0127.c: code cleanup
From: Martin Samuelsson @ 2006-04-05 21:28 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, mchehab, js, v4l-dvb-maintainer
Code cleanup and coding style compliance changes:
- Extraneous spaces within parentheses, brackets and braces removed.
- Unnecessary initializations removed.
- All lines shorter than 80 columns.
- Constant msgs size of 2 replaced with ARRAY_SIZE(msgs).
- Single statement braces banished.
- udelay() -> msleep().
- Unused ks0127_getcrop() removed.
- schedule_timeout() -> schedule_timeout_interruptible().
- current->state = TASK_INTERRUPTIBLE removed.
- module_init/module_exit corrected.
- Removed the Emacs stuff.
Signed-off-by: Martin Samuelsson <sam@home.se>
---
ks0127.c | 443 +++++++++++++++++++++++++++++++-----------------------------
1 files changed, 236 insertions(+), 207 deletions(-)
The gigantic list of register name definitions; should it be moved to ks0127.h?
--- linux-2.6.17-rc1-mm1-ab-avs6eyes/drivers/media/video/ks0127-old.c 2006-04-06 00:26:07.000000000 +0200
+++ linux-2.6.16-git15-avs6eyes/drivers/media/video/ks0127.c 2006-04-06 00:37:52.000000000 +0200
@@ -1,5 +1,5 @@
/*
- * Video Capture Driver ( Video for Linux 1/2 )
+ * Video Capture Driver (Video for Linux 1/2)
* for the Matrox Marvel G200,G400 and Rainbow Runner-G series
*
* This module is an interface to the KS0127 video decoder chip.
@@ -216,24 +216,25 @@ struct ks0127 {
};
-static int debug = 0; /* insmod parameter */
+static int debug; /* insmod parameter */
module_param(debug, int, 0);
MODULE_PARM_DESC(debug, "Debug output");
MODULE_LICENSE("GPL");
-static u8 reg_defaults[ 64 ];
+static u8 reg_defaults[64];
static void init_reg_defaults(void)
{
- u8* table = reg_defaults;
+ u8 *table = reg_defaults;
table[KS_CMDA] = 0x2c; /* VSE=0, CCIR 601, autodetect standard */
table[KS_CMDB] = 0x12; /* VALIGN=0, AGC control and input */
table[KS_CMDC] = 0x00; /* Test options */
- table[KS_CMDD] = 0x01; /* clock & input select, write 1 to PORTA */
+ /* clock & input select, write 1 to PORTA */
+ table[KS_CMDD] = 0x01;
table[KS_HAVB] = 0x00; /* HAV Start Control */
table[KS_HAVE] = 0x00; /* HAV End Control */
table[KS_HS1B] = 0x10; /* HS1 Start Control */
@@ -253,15 +254,18 @@ static void init_reg_defaults(void)
table[KS_SAT] = 0x00; /* Color Saturation Control*/
table[KS_HUE] = 0x00; /* Hue Control */
table[KS_VERTIA] = 0x00; /* Vertical Processing Control A */
- table[KS_VERTIB] = 0x12; /* Vertical Processing Control B, luma 1 line delayed */
+ /* Vertical Processing Control B, luma 1 line delayed */
+ table[KS_VERTIB] = 0x12;
table[KS_VERTIC] = 0x0b; /* Vertical Processing Control C */
table[KS_HSCLL] = 0x00; /* Horizontal Scaling Ratio Low */
table[KS_HSCLH] = 0x00; /* Horizontal Scaling Ratio High */
table[KS_VSCLL] = 0x00; /* Vertical Scaling Ratio Low */
table[KS_VSCLH] = 0x00; /* Vertical Scaling Ratio High */
- table[KS_OFMTA] = 0x30; /* 16 bit YCbCr 4:2:2 output; I can't make the bt866 like 8 bit /Sam */
+ /* 16 bit YCbCr 4:2:2 output; I can't make the bt866 like 8 bit /Sam */
+ table[KS_OFMTA] = 0x30;
table[KS_OFMTB] = 0x00; /* Output Control B */
- table[KS_VBICTL] = 0x5d; /* VBI Decoder Control; 4bit fmt: avoid Y overflow */
+ /* VBI Decoder Control; 4bit fmt: avoid Y overflow */
+ table[KS_VBICTL] = 0x5d;
table[KS_CCDAT2] = 0x00; /* Read Only register */
table[KS_CCDAT1] = 0x00; /* Read Only register */
table[KS_VBIL30] = 0xa8; /* VBI data decoding options */
@@ -277,8 +281,8 @@ static void init_reg_defaults(void)
table[KS_VAVB] = 0x07; /* VAV Begin */
table[KS_VAVE] = 0x00; /* VAV End */
table[KS_CTRACK] = 0x00; /* Chroma Tracking Control */
- table[KS_POLCTL] = 0x41; //0x01; /* Timing Signal Polarity Control */
- table[KS_REFCOD] = 0x80; /*0xa4;*/ /* Reference Code Insertion Control */
+ table[KS_POLCTL] = 0x41; /* Timing Signal Polarity Control */
+ table[KS_REFCOD] = 0x80; /* Reference Code Insertion Control */
table[KS_INVALY] = 0x10; /* Invalid Y Code */
table[KS_INVALU] = 0x80; /* Invalid U Code */
table[KS_INVALV] = 0x80; /* Invalid V Code */
@@ -288,11 +292,14 @@ static void init_reg_defaults(void)
table[KS_USRSAV] = 0x00; /* reserved */
table[KS_USREAV] = 0x00; /* reserved */
table[KS_SHS1A] = 0x00; /* User Defined SHS1 A */
- table[KS_SHS1B] = 0x80; /* User Defined SHS1 B, ALT656=1 on 0127B */
+ /* User Defined SHS1 B, ALT656=1 on 0127B */
+ table[KS_SHS1B] = 0x80;
table[KS_SHS1C] = 0x00; /* User Defined SHS1 C */
table[KS_CMDE] = 0x00; /* Command Register E */
table[KS_VSDEL] = 0x00; /* VS Delay Control */
- table[KS_CMDF] = 0x02; /* Command Register F, update -immediately- (there might come no vsync)*/
+ /* Command Register F, update -immediately- */
+ /* (there might come no vsync)*/
+ table[KS_CMDF] = 0x02;
}
@@ -311,40 +318,40 @@ static void init_reg_defaults(void)
*/
-static u8 ks0127_read( struct ks0127* ks, u8 reg )
+static u8 ks0127_read(struct ks0127 *ks, u8 reg)
{
struct i2c_client *c = ks->client;
char val = 0;
struct i2c_msg msgs[] = {
- { c->addr, 0, sizeof(reg), ® },
- { c->addr, I2C_M_RD | I2C_M_NO_RD_ACK, sizeof(val), &val}};
+ {c->addr, 0, sizeof(reg), ®},
+ {c->addr, I2C_M_RD | I2C_M_NO_RD_ACK, sizeof(val), &val}};
int ret;
- ret = i2c_transfer(c->adapter, msgs, 2);
- if (ret != 2)
- dprintk( "ks0127_write error\n" );
+ ret = i2c_transfer(c->adapter, msgs, ARRAY_SIZE(msgs));
+ if (ret != ARRAY_SIZE(msgs))
+ dprintk("ks0127_write error\n");
return val;
}
-static void ks0127_write( struct ks0127* ks, u8 reg, u8 val )
+static void ks0127_write(struct ks0127 *ks, u8 reg, u8 val)
{
- char msg[] = { reg, val };
+ char msg[] = {reg, val};
- if ( i2c_master_send(ks->client, msg, sizeof(msg) ) != sizeof(msg) ) {
- dprintk( "ks0127_write error\n" );
- }
- ks->regs[ reg ] = val;
+ if (i2c_master_send(ks->client, msg, sizeof(msg)) != sizeof(msg))
+ dprintk("ks0127_write error\n");
+
+ ks->regs[reg] = val;
}
/* generic bit-twiddling */
-static void ks0127_and_or( struct ks0127* ks, u8 reg, u8 and_v, u8 or_v )
+static void ks0127_and_or(struct ks0127 *ks, u8 reg, u8 and_v, u8 or_v)
{
- u8 val = ks->regs[ reg ];
+ u8 val = ks->regs[reg];
val = (val & and_v) | or_v;
- ks0127_write( ks, reg, val );
+ ks0127_write(ks, reg, val);
}
@@ -352,29 +359,30 @@ static void ks0127_and_or( struct ks0127
/****************************************************************************
* ks0127 private api
****************************************************************************/
-static void ks0127_reset( struct ks0127* ks )
+static void ks0127_reset(struct ks0127* ks)
{
int i;
- u8* table = reg_defaults;
+ u8 *table = reg_defaults;
ks->ks_type = KS_TYPE_UNKNOWN;
- dprintk( "ks0127: reset\n" );
- udelay(1000);
+ dprintk("ks0127: reset\n");
+ msleep(1);
- /* initialize all registers to known values (except STAT, 0x21, 0x22, TEST and 0x38,0x39 ) */
+ /* initialize all registers to known values */
+ /* (except STAT, 0x21, 0x22, TEST and 0x38,0x39) */
- for(i = 1; i < 33; i++ )
- ks0127_write( ks, i, table[i] );
+ for(i = 1; i < 33; i++)
+ ks0127_write(ks, i, table[i]);
for(i = 35; i < 40; i++)
- ks0127_write( ks, i, table[i] );
+ ks0127_write(ks, i, table[i]);
for(i = 41; i < 56; i++)
- ks0127_write( ks, i, table[i] );
+ ks0127_write(ks, i, table[i]);
for(i = 58; i < 64; i++)
- ks0127_write( ks, i, table[i] );
+ ks0127_write(ks, i, table[i]);
if ((ks0127_read(ks, KS_STAT) & 0x80) == 0) {
@@ -401,32 +409,8 @@ static void ks0127_reset( struct ks0127*
}
}
-
-void ks0127_getcrop(struct ks0127 *ks, int *xstart, int *xend, int *ystart, int *yend)
-{
- *xstart = ((ks0127_read(ks, KS_HXTRA) & 0xe0) << 3) +
- ks0127_read(ks, KS_HAVB);
-
- *xend = ((ks0127_read(ks, KS_HXTRA) & 0x1c) << 6) +
- ks0127_read(ks, KS_HAVE);
-
- if ((*xstart) & 0x400)
- *xstart |= ~0x3ff;
-
- if ((*xend) & 0x400)
- *xend |= ~0x3ff;
-
- *ystart = ks0127_read(ks, KS_VAVB) >> 2;
- *yend = ks0127_read(ks, KS_VAVE);
- dprintk("ks0127: ystart=%d yend=%d\n", *ystart, *yend);
-
- *ystart = (*ystart - 2) * 2;
- *yend = (*yend - 2) * 2;
-}
-
-
-static int
-ks0127_command(struct i2c_client *client, unsigned int cmd, void *arg)
+static int ks0127_command(struct i2c_client *client,
+ unsigned int cmd, void *arg)
{
struct ks0127 *ks = i2c_get_clientdata(client);
@@ -434,195 +418,244 @@ ks0127_command(struct i2c_client *client
int status;
- if( !ks )
+ if (!ks)
return -ENODEV;
switch (cmd) {
case DECODER_INIT:
- dprintk( "ks0127: command DECODER_INIT\n" );
- ks0127_reset( ks );
+ dprintk("ks0127: command DECODER_INIT\n");
+ ks0127_reset(ks);
break;
case DECODER_SET_INPUT:
- switch( *iarg ) {
+ switch(*iarg) {
case KS_INPUT_COMPOSITE_1:
case KS_INPUT_COMPOSITE_2:
case KS_INPUT_COMPOSITE_3:
case KS_INPUT_COMPOSITE_4:
case KS_INPUT_COMPOSITE_5:
case KS_INPUT_COMPOSITE_6:
- dprintk( "ks0127: command DECODER_SET_INPUT %d: Composite\n", *iarg );
- ks0127_and_or( ks, KS_CMDA, 0xfc, 0x00 ); /* autodetect 50/60 Hz */
- ks0127_and_or( ks, KS_CMDA, ~0x40, 0x00 ); /* VSE=0 */
- ks0127_and_or( ks, KS_CMDB, 0xb0, *iarg ); /* set input line */
- ks0127_and_or( ks, KS_CMDC, 0x70, 0x0a ); /* non-freerunning mode */
- ks0127_and_or( ks, KS_CMDD, 0x03, 0x00 ); /* analog input */
- ks0127_and_or( ks, KS_CTRACK, 0xcf, 0x00 ); /* enable chroma demodulation */
- ks0127_and_or( ks, KS_LUMA, 0x00, (reg_defaults[KS_LUMA])|0x0c ); /* chroma trap, HYBWR=1 */
- ks0127_and_or( ks, KS_VERTIA, 0x08, 0x81 ); /* scaler fullbw, luma comb off */
- ks0127_and_or( ks, KS_VERTIC, 0x0f, 0x90 ); /* manual chroma comb .25 .5 .25 */
-
- ks0127_and_or( ks, KS_CHROMB, 0x0f, 0x90 ); /* chroma path delay */
-
- ks0127_write( ks, KS_UGAIN, reg_defaults[KS_UGAIN] );
- ks0127_write( ks, KS_VGAIN, reg_defaults[KS_VGAIN] );
- ks0127_write( ks, KS_UVOFFH, reg_defaults[KS_UVOFFH] );
- ks0127_write( ks, KS_UVOFFL, reg_defaults[KS_UVOFFL] );
+ dprintk("ks0127: command DECODER_SET_INPUT %d: "
+ "Composite\n", *iarg);
+ /* autodetect 50/60 Hz */
+ ks0127_and_or(ks, KS_CMDA, 0xfc, 0x00);
+ /* VSE=0 */
+ ks0127_and_or(ks, KS_CMDA, ~0x40, 0x00);
+ /* set input line */
+ ks0127_and_or(ks, KS_CMDB, 0xb0, *iarg);
+ /* non-freerunning mode */
+ ks0127_and_or(ks, KS_CMDC, 0x70, 0x0a);
+ /* analog input */
+ ks0127_and_or(ks, KS_CMDD, 0x03, 0x00);
+ /* enable chroma demodulation */
+ ks0127_and_or(ks, KS_CTRACK, 0xcf, 0x00);
+ /* chroma trap, HYBWR=1 */
+ ks0127_and_or(ks, KS_LUMA, 0x00,
+ (reg_defaults[KS_LUMA])|0x0c);
+ /* scaler fullbw, luma comb off */
+ ks0127_and_or(ks, KS_VERTIA, 0x08, 0x81);
+ /* manual chroma comb .25 .5 .25 */
+ ks0127_and_or(ks, KS_VERTIC, 0x0f, 0x90);
+
+ /* chroma path delay */
+ ks0127_and_or(ks, KS_CHROMB, 0x0f, 0x90);
+
+ ks0127_write(ks, KS_UGAIN, reg_defaults[KS_UGAIN]);
+ ks0127_write(ks, KS_VGAIN, reg_defaults[KS_VGAIN]);
+ ks0127_write(ks, KS_UVOFFH, reg_defaults[KS_UVOFFH]);
+ ks0127_write(ks, KS_UVOFFL, reg_defaults[KS_UVOFFL]);
break;
case KS_INPUT_SVIDEO_1:
case KS_INPUT_SVIDEO_2:
case KS_INPUT_SVIDEO_3:
- dprintk( "ks0127: command DECODER_SET_INPUT %d: S-Video\n", *iarg );
- ks0127_and_or( ks, KS_CMDA, 0xfc, 0x00 ); /* autodetect 50/60 Hz */
- ks0127_and_or( ks, KS_CMDA, ~0x40, 0x00 ); /* VSE=0 */
- ks0127_and_or( ks, KS_CMDB, 0xb0, *iarg ); /* set input line */
- ks0127_and_or( ks, KS_CMDC, 0x70, 0x0a ); /* non-freerunning mode */
- ks0127_and_or( ks, KS_CMDD, 0x03, 0x00 ); /* analog input */
- ks0127_and_or( ks, KS_CTRACK, 0xcf, 0x00 ); /* enable chroma demodulation */
- ks0127_and_or( ks, KS_LUMA, 0x00, reg_defaults[KS_LUMA] );
- ks0127_and_or( ks, KS_VERTIA, 0x08, (reg_defaults[KS_VERTIA]&0xf0)|0x01 ); /* disable luma comb */
- ks0127_and_or( ks, KS_VERTIC, 0x0f, reg_defaults[KS_VERTIC]&0xf0 );
-
- ks0127_and_or( ks, KS_CHROMB, 0x0f, reg_defaults[KS_CHROMB]&0xf0 );
-
- ks0127_write( ks, KS_UGAIN, reg_defaults[KS_UGAIN] );
- ks0127_write( ks, KS_VGAIN, reg_defaults[KS_VGAIN] );
- ks0127_write( ks, KS_UVOFFH, reg_defaults[KS_UVOFFH] );
- ks0127_write( ks, KS_UVOFFL, reg_defaults[KS_UVOFFL] );
+ dprintk("ks0127: command DECODER_SET_INPUT %d: "
+ "S-Video\n", *iarg);
+ /* autodetect 50/60 Hz */
+ ks0127_and_or(ks, KS_CMDA, 0xfc, 0x00);
+ /* VSE=0 */
+ ks0127_and_or(ks, KS_CMDA, ~0x40, 0x00);
+ /* set input line */
+ ks0127_and_or(ks, KS_CMDB, 0xb0, *iarg);
+ /* non-freerunning mode */
+ ks0127_and_or(ks, KS_CMDC, 0x70, 0x0a);
+ /* analog input */
+ ks0127_and_or(ks, KS_CMDD, 0x03, 0x00);
+ /* enable chroma demodulation */
+ ks0127_and_or(ks, KS_CTRACK, 0xcf, 0x00);
+ ks0127_and_or(ks, KS_LUMA, 0x00,
+ reg_defaults[KS_LUMA]);
+ /* disable luma comb */
+ ks0127_and_or(ks, KS_VERTIA, 0x08,
+ (reg_defaults[KS_VERTIA]&0xf0)|0x01);
+ ks0127_and_or(ks, KS_VERTIC, 0x0f,
+ reg_defaults[KS_VERTIC]&0xf0);
+
+ ks0127_and_or(ks, KS_CHROMB, 0x0f,
+ reg_defaults[KS_CHROMB]&0xf0);
+
+ ks0127_write(ks, KS_UGAIN, reg_defaults[KS_UGAIN]);
+ ks0127_write(ks, KS_VGAIN, reg_defaults[KS_VGAIN]);
+ ks0127_write(ks, KS_UVOFFH, reg_defaults[KS_UVOFFH]);
+ ks0127_write(ks, KS_UVOFFL, reg_defaults[KS_UVOFFL]);
break;
case KS_INPUT_YUV656:
- dprintk( "ks0127: command DECODER_SET_INPUT 15: YUV656\n" );
- if (ks->norm == VIDEO_MODE_NTSC || ks->norm == KS_STD_PAL_M) {
- ks0127_and_or( ks, KS_CMDA, 0xfc, 0x03 ); /* force 60 Hz */
- } else {
- ks0127_and_or( ks, KS_CMDA, 0xfc, 0x02 ); /* force 50 Hz */
- }
-
- ks0127_and_or( ks, KS_CMDA, 0xff, 0x40 ); /* VSE=1 */
- ks0127_and_or( ks, KS_CMDB, 0xb0, (*iarg | 0x40)); /* set input line and VALIGN */
- ks0127_and_or( ks, KS_CMDC, 0x70, 0x87 ); /* freerunning mode, TSTGEN = 1 TSTGFR=11 TSTGPH=0 TSTGPK=0 VMEM=1*/
- ks0127_and_or( ks, KS_CMDD, 0x03, 0x08); /* digital input, SYNDIR = 0 INPSL=01 CLKDIR=0 EAV=0 */
- ks0127_and_or( ks, KS_CTRACK, 0xcf, 0x30 ); /* disable chroma demodulation */
- ks0127_and_or( ks, KS_LUMA, 0x00, 0x71 ); /* HYPK =01 CTRAP = 0 HYBWR=0 PED=1 RGBH=1 UNIT=1 */
- ks0127_and_or( ks, KS_VERTIC, 0x0f, reg_defaults[KS_VERTIC]&0xf0 );
-
- ks0127_and_or( ks, KS_VERTIA, 0x08, 0x81 ); /* scaler fullbw, luma comb off */
-
- ks0127_and_or( ks, KS_CHROMB, 0x0f, reg_defaults[KS_CHROMB]&0xf0 );
-
- ks0127_and_or( ks, KS_CON, 0x00, 0x00);
- ks0127_and_or( ks, KS_BRT, 0x00, 32); /* spec: 34 */
- ks0127_and_or( ks, KS_SAT, 0x00, 0xe8); /* spec: 229 (e5) */
- ks0127_and_or( ks, KS_HUE, 0x00, 0);
-
- ks0127_and_or( ks, KS_UGAIN, 0x00, 238);
- ks0127_and_or( ks, KS_VGAIN, 0x00, 0x00);
-
- ks0127_and_or( ks, KS_UVOFFH, 0x00, 0x4f); /*UOFF:0x30, VOFF:0x30, TSTCGN=1 */
- ks0127_and_or( ks, KS_UVOFFL, 0x00, 0x00);
+ dprintk("ks0127: command DECODER_SET_INPUT 15: "
+ "YUV656\n");
+ if (ks->norm == VIDEO_MODE_NTSC ||
+ ks->norm == KS_STD_PAL_M)
+ /* force 60 Hz */
+ ks0127_and_or(ks, KS_CMDA, 0xfc, 0x03);
+ else
+ /* force 50 Hz */
+ ks0127_and_or(ks, KS_CMDA, 0xfc, 0x02);
+
+ ks0127_and_or(ks, KS_CMDA, 0xff, 0x40); /* VSE=1 */
+ /* set input line and VALIGN */
+ ks0127_and_or(ks, KS_CMDB, 0xb0, (*iarg | 0x40));
+ /* freerunning mode, */
+ /* TSTGEN = 1 TSTGFR=11 TSTGPH=0 TSTGPK=0 VMEM=1*/
+ ks0127_and_or(ks, KS_CMDC, 0x70, 0x87);
+ /* digital input, SYNDIR = 0 INPSL=01 CLKDIR=0 EAV=0 */
+ ks0127_and_or(ks, KS_CMDD, 0x03, 0x08);
+ /* disable chroma demodulation */
+ ks0127_and_or(ks, KS_CTRACK, 0xcf, 0x30);
+ /* HYPK =01 CTRAP = 0 HYBWR=0 PED=1 RGBH=1 UNIT=1 */
+ ks0127_and_or(ks, KS_LUMA, 0x00, 0x71);
+ ks0127_and_or(ks, KS_VERTIC, 0x0f,
+ reg_defaults[KS_VERTIC]&0xf0);
+
+ /* scaler fullbw, luma comb off */
+ ks0127_and_or(ks, KS_VERTIA, 0x08, 0x81);
+
+ ks0127_and_or(ks, KS_CHROMB, 0x0f,
+ reg_defaults[KS_CHROMB]&0xf0);
+
+ ks0127_and_or(ks, KS_CON, 0x00, 0x00);
+ ks0127_and_or(ks, KS_BRT, 0x00, 32); /* spec: 34 */
+ /* spec: 229 (e5) */
+ ks0127_and_or(ks, KS_SAT, 0x00, 0xe8);
+ ks0127_and_or(ks, KS_HUE, 0x00, 0);
+
+ ks0127_and_or(ks, KS_UGAIN, 0x00, 238);
+ ks0127_and_or(ks, KS_VGAIN, 0x00, 0x00);
+
+ /*UOFF:0x30, VOFF:0x30, TSTCGN=1 */
+ ks0127_and_or(ks, KS_UVOFFH, 0x00, 0x4f);
+ ks0127_and_or(ks, KS_UVOFFL, 0x00, 0x00);
break;
default:
- dprintk( "ks0127: command DECODER_SET_INPUT: Unknown input %d\n", *iarg );
+ dprintk("ks0127: command DECODER_SET_INPUT: "
+ "Unknown input %d\n", *iarg);
break;
}
- /* hack: CDMLPF sometimes spontaneously switches on; force back off */
- ks0127_write( ks, KS_DEMOD, reg_defaults[KS_DEMOD] );
+ /* hack: CDMLPF sometimes spontaneously switches on; */
+ /* force back off */
+ ks0127_write(ks, KS_DEMOD, reg_defaults[KS_DEMOD]);
break;
case DECODER_SET_OUTPUT:
- switch( *iarg ) {
+ switch(*iarg) {
case KS_OUTPUT_YUV656E:
- dprintk( "ks0127: command DECODER_SET_OUTPUT: OUTPUT_YUV656E (Missing)\n" );
+ dprintk("ks0127: command DECODER_SET_OUTPUT: "
+ "OUTPUT_YUV656E (Missing)\n");
return -EINVAL;
break;
case KS_OUTPUT_EXV:
- dprintk( "ks0127: command DECODER_SET_OUTPUT: OUTPUT_EXV\n" );
- ks0127_and_or( ks, KS_OFMTA, 0xf0, 0x09 );
+ dprintk("ks0127: command DECODER_SET_OUTPUT: "
+ "OUTPUT_EXV\n");
+ ks0127_and_or(ks, KS_OFMTA, 0xf0, 0x09);
break;
}
break;
case DECODER_SET_NORM: //sam This block mixes old and new norm names...
/* Set to automatic SECAM/Fsc mode */
- ks0127_and_or( ks, KS_DEMOD, 0xf0, 0x00 );
+ ks0127_and_or(ks, KS_DEMOD, 0xf0, 0x00);
ks->norm = *iarg;
- switch( *iarg )
+ switch(*iarg)
{
- /* this is untested !! It just detects PAL_N/NTSC_M (no special frequencies)
- And you have to set the standard a second time afterwards */
+ /* this is untested !! */
+ /* It just detects PAL_N/NTSC_M (no special frequencies) */
+ /* And you have to set the standard a second time afterwards */
case VIDEO_MODE_AUTO:
- dprintk( "ks0127: command DECODER_SET_NORM: AUTO\n" );
+ dprintk("ks0127: command DECODER_SET_NORM: AUTO\n");
- /* The chip determines the format based on the current field rate */
- ks0127_and_or( ks, KS_CMDA, 0xfc, 0x00 );
- ks0127_and_or( ks, KS_CHROMA, 0x9f, 0x20 ); //0x40 );
- /* This is wrong for PAL ! As I said, you need to set the standard once again !! */
+ /* The chip determines the format */
+ /* based on the current field rate */
+ ks0127_and_or(ks, KS_CMDA, 0xfc, 0x00);
+ ks0127_and_or(ks, KS_CHROMA, 0x9f, 0x20);
+ /* This is wrong for PAL ! As I said, */
+ /* you need to set the standard once again !! */
ks->format_height = 240;
ks->format_width = 704;
break;
case VIDEO_MODE_NTSC:
- dprintk( "ks0127: command DECODER_SET_NORM: NTSC_M\n" );
- ks0127_and_or( ks, KS_CHROMA, 0x9f, 0x20 ); //0x00 );
+ dprintk("ks0127: command DECODER_SET_NORM: NTSC_M\n");
+ ks0127_and_or(ks, KS_CHROMA, 0x9f, 0x20);
ks->format_height = 240;
ks->format_width = 704;
break;
case KS_STD_NTSC_N:
- dprintk( "ks0127: command KS0127_SET_STANDARD: NTSC_N (fixme)\n" );
- ks0127_and_or( ks, KS_CHROMA, 0x9f, 0x40 ); //0x00 );
+ dprintk("ks0127: command KS0127_SET_STANDARD: "
+ "NTSC_N (fixme)\n");
+ ks0127_and_or(ks, KS_CHROMA, 0x9f, 0x40);
ks->format_height = 240;
ks->format_width = 704;
break;
case VIDEO_MODE_PAL:
- dprintk( "ks0127: command DECODER_SET_NORM: PAL_N\n" );
- ks0127_and_or( ks, KS_CHROMA, 0x9f, 0x20 ); //0x60 );
+ dprintk("ks0127: command DECODER_SET_NORM: PAL_N\n");
+ ks0127_and_or(ks, KS_CHROMA, 0x9f, 0x20);
ks->format_height = 290;
ks->format_width = 704;
break;
case KS_STD_PAL_M:
- dprintk( "ks0127: command KS0127_SET_STANDARD: PAL_M (fixme)\n" );
- ks0127_and_or( ks, KS_CHROMA, 0x9f, 0x40 ); //0x60 );
+ dprintk("ks0127: command KS0127_SET_STANDARD: "
+ "PAL_M (fixme)\n");
+ ks0127_and_or(ks, KS_CHROMA, 0x9f, 0x40);
ks->format_height = 290;
ks->format_width = 704;
break;
case VIDEO_MODE_SECAM:
- dprintk( "ks0127: command KS0127_SET_STANDARD: SECAM\n" );
+ dprintk("ks0127: command KS0127_SET_STANDARD: "
+ "SECAM\n");
ks->format_height = 290;
ks->format_width = 704;
/* set to secam autodetection */
- ks0127_and_or( ks, KS_CHROMA, 0xdf, 0x20 );
- ks0127_and_or( ks, KS_DEMOD, 0xf0, 0x00 );
- current->state = TASK_INTERRUPTIBLE;
- schedule_timeout(HZ/10+1);
+ ks0127_and_or(ks, KS_CHROMA, 0xdf, 0x20);
+ ks0127_and_or(ks, KS_DEMOD, 0xf0, 0x00);
+ schedule_timeout_interruptible(HZ/10+1);
/* did it autodetect? */
- if( ks0127_read( ks, KS_DEMOD ) & 0x40 )
+ if (ks0127_read(ks, KS_DEMOD) & 0x40)
break;
/* force to secam mode */
- ks0127_and_or( ks, KS_DEMOD, 0xf0, 0x0f );
+ ks0127_and_or(ks, KS_DEMOD, 0xf0, 0x0f);
break;
default:
- dprintk( "ks0127: command DECODER_SET_NORM: Unknown norm %d\n", *iarg );
+ dprintk("ks0127: command DECODER_SET_NORM: "
+ "Unknown norm %d\n", *iarg);
break;
}
break;
case DECODER_SET_PICTURE:
- dprintk( "ks0127: command DECODER_SET_PICTURE not yet supported (fixme)\n" );
+ dprintk("ks0127: command DECODER_SET_PICTURE "
+ "not yet supported (fixme)\n");
return -EINVAL;
//sam todo: KS0127_SET_BRIGHTNESS: Merge into DECODER_SET_PICTURE
@@ -650,13 +683,21 @@ ks0127_command(struct i2c_client *client
int *iarg = arg;
int enable = (*iarg != 0);
if (enable) {
- dprintk( "ks0127: command DECODER_ENABLE_OUTPUT on (%d)\n", enable );
- ks0127_and_or( ks, KS_OFMTA, 0xcf, 0x30 ); // All output pins on
- ks0127_and_or( ks, KS_CDEM, 0x7f, 0x00 ); // Obey the OEN pin
+ dprintk("ks0127: command "
+ "DECODER_ENABLE_OUTPUT on "
+ "(%d)\n", enable);
+ /* All output pins on */
+ ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x30);
+ /* Obey the OEN pin */
+ ks0127_and_or(ks, KS_CDEM, 0x7f, 0x00);
} else {
- dprintk( "ks0127: command DECODER_ENABLE_OUTPUT off (%d)\n", enable );
- ks0127_and_or( ks, KS_OFMTA, 0xcf, 0x00 ); // Video output pins off
- ks0127_and_or( ks, KS_CDEM, 0x7f, 0x80 ); // Ignore the OEN pin
+ dprintk("ks0127: command "
+ "DECODER_ENABLE_OUTPUT off "
+ "(%d)\n", enable);
+ /* Video output pins off */
+ ks0127_and_or(ks, KS_OFMTA, 0xcf, 0x00);
+ /* Ignore the OEN pin */
+ ks0127_and_or(ks, KS_CDEM, 0x7f, 0x80);
}
}
break;
@@ -667,23 +708,22 @@ ks0127_command(struct i2c_client *client
//sam todo: KS0127_SET_HSCALE:
case DECODER_GET_STATUS:
- dprintk( "ks0127: command DECODER_GET_STATUS\n" );
+ dprintk("ks0127: command DECODER_GET_STATUS\n");
*iarg = 0;
- status = ks0127_read( ks, KS_STAT );
- if(!(status & 0x20)) /* NOVID not set */
+ status = ks0127_read(ks, KS_STAT);
+ if (!(status & 0x20)) /* NOVID not set */
*iarg = (*iarg & DECODER_STATUS_GOOD);
- if((status & 0x01)) /* CLOCK set */
+ if ((status & 0x01)) /* CLOCK set */
*iarg = (*iarg & DECODER_STATUS_COLOR);
- if((status & 0x08)) { /* PALDET set */
+ if ((status & 0x08)) /* PALDET set */
*iarg = (*iarg & DECODER_STATUS_PAL);
- } else {
+ else
*iarg = (*iarg & DECODER_STATUS_NTSC);
- }
break;
//Catch any unknown command
default:
- dprintk( "ks0127: command unknown: %04X\n", cmd );
+ dprintk("ks0127: command unknown: %04X\n", cmd);
return -EINVAL;
}
return 0;
@@ -694,14 +734,16 @@ ks0127_command(struct i2c_client *client
static int ks0127_probe(struct i2c_adapter *adapter);
static int ks0127_detach(struct i2c_client *client);
-static int ks0127_command(struct i2c_client *client, unsigned int cmd, void *arg );
+static int ks0127_command(struct i2c_client *client,
+ unsigned int cmd, void *arg);
/* Addresses to scan */
-static unsigned short normal_i2c[] = { I2C_KS0127_ADDON>>1, I2C_KS0127_ONBOARD>>1, I2C_CLIENT_END };
-static unsigned short probe[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
-static unsigned short ignore[2] = { I2C_CLIENT_END, I2C_CLIENT_END };
+static unsigned short normal_i2c[] = {I2C_KS0127_ADDON>>1,
+ I2C_KS0127_ONBOARD>>1, I2C_CLIENT_END};
+static unsigned short probe[2] = {I2C_CLIENT_END, I2C_CLIENT_END};
+static unsigned short ignore[2] = {I2C_CLIENT_END, I2C_CLIENT_END};
static struct i2c_client_address_data addr_data = {
normal_i2c,
probe,
@@ -709,12 +751,8 @@ static struct i2c_client_address_data ad
};
static struct i2c_driver i2c_driver_ks0127 = {
- .driver = {
- .name = "ks0127",
- },
-
+ .driver.name = "ks0127",
.id = I2C_DRIVERID_KS0127,
-
.attach_adapter = ks0127_probe,
.detach_client = ks0127_detach,
.command = ks0127_command
@@ -735,13 +773,13 @@ static int ks0127_found_proc(struct i2c_
struct i2c_client *client;
client = kzalloc(sizeof(*client), GFP_KERNEL);
- if(client == NULL)
+ if (client == NULL)
return -ENOMEM;
- memcpy( client, &ks0127_client_tmpl, sizeof(*client) );
+ memcpy(client, &ks0127_client_tmpl, sizeof(*client));
- ks = kzalloc( sizeof(*ks), GFP_KERNEL );
- if( ks == NULL ) {
- kfree( client );
+ ks = kzalloc(sizeof(*ks), GFP_KERNEL);
+ if (ks == NULL) {
+ kfree(client);
return -ENOMEM;
}
@@ -755,11 +793,11 @@ static int ks0127_found_proc(struct i2c_
ks->ks_type = KS_TYPE_UNKNOWN;
/* power up */
- ks0127_write( ks, KS_CMDA, 0x2c );
+ ks0127_write(ks, KS_CMDA, 0x2c);
mdelay(10);
/* reset the device */
- ks0127_reset( ks );
+ ks0127_reset(ks);
printk(KERN_INFO "ks0127: attach: %s video decoder\n",
ks->addr==(I2C_KS0127_ADDON>>1) ? "addon" : "on-board");
@@ -779,26 +817,26 @@ static int ks0127_detach(struct i2c_clie
{
struct ks0127 *ks = i2c_get_clientdata(client);
- ks0127_write( ks, KS_OFMTA, 0x20 ); /*tristate*/
- ks0127_write( ks, KS_CMDA, 0x2c | 0x80 ); /* power down */
+ ks0127_write(ks, KS_OFMTA, 0x20); /*tristate*/
+ ks0127_write(ks, KS_CMDA, 0x2c | 0x80); /* power down */
i2c_detach_client(client);
kfree(ks);
kfree(client);
- dprintk( "ks0127: detach\n" );
+ dprintk("ks0127: detach\n");
return 0;
}
-static int ks0127_init_module(void)
+static int __devinit ks0127_init_module(void)
{
init_reg_defaults();
i2c_add_driver(&i2c_driver_ks0127);
return 0;
}
-static void ks0127_cleanup_module(void)
+static void __devexit ks0127_cleanup_module(void)
{
i2c_del_driver(&i2c_driver_ks0127);
}
@@ -806,12 +844,3 @@ static void ks0127_cleanup_module(void)
module_init(ks0127_init_module);
module_exit(ks0127_cleanup_module);
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-basic-offset: 8
- * compile-command: "cd ../../.. && make modules SUBDIRS=drivers/media/video"
- * End:
- */
^ permalink raw reply
page: next (older) | prev (newer) | latest
- recent:[subjects (threaded)|topics (new)|topics (active)]
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.