Merge branch 'for-linus' into HEAD
ALSA: Create sysfs attribute files via groups

Instead of calling each time device_create_file(), create the groups
of sysfs attribute files at once in a normal way.  Add a new helper
function, snd_get_device(), to return the associated device object,
so that we can handle the sysfs addition locally.

Since the sysfs file addition is done differently now,
snd_add_device_sysfs_file() helper function is removed.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hwdep: Take private_data as drvdata for sysfs

For referring to a different object from sysfs ops, take hwdep
private_data as stored via dev_set_drvdata() at creating the device
object.  In that way, the same sysfs ops can be used by different
device types.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hwdep: Allow to assign the given parent

Just like PCM, allow hwdep to be assigned to a different parent device
than the card.  It'll be used for the HD-audio codec device in the
later patches.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Use priority list for managing device list

Basically, the device type specifies the priority of the device to be
registered / freed, too.  However, the priority value isn't well
utilized but only it's checked as a group.  This results in
inconsistent register and free order (where each of them should be in
reversed direction).

This patch simplifies the device list management code by simply
inserting a list entry at creation time in an incremental order for
the priority value.  Since we can just follow the link for register,
disconnect and free calls, we don't have to specify the group; so the
whole enum definitions are also simplified as well.

The visible change to outside is that the priorities of some object
types are revisited.  For example, now the SNDRV_DEV_LOWLEVEL object
is registered before others (control, PCM, etc) and, in return,
released after others.  Similarly, SNDRV_DEV_CODEC is in a lower
priority than SNDRV_DEV_BUS for ensuring the dependency.

Also, the unused SNDRV_DEV_TOPLEVEL, SNDRV_DEV_LOWLEVEL_PRE and
SNDRV_DEV_LOWLEVEL_NORMAL are removed as a cleanup.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: Clean up snd_device_*() codes

A few code cleanups and optimizations.  In addition, drop
snd_device_disconnect() that isn't used at all, and drop the return
values from snd_device_free*().

Another slight difference by this change is that now the device state
will become always SNDRV_DEV_REGISTERED no matter whether dev_register
ops is present or not.  It's for better consistency.  There should be
no impact for the current tree, as the state isn't checked.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Manage each codec instance individually

Now each snd_hda_codec instance is managed via the device chain, the
registration and release are done by its callback instead of calling
from bus.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Create own device struct for each codec

As the HD-audio is treated individually in each codec driver, it's
more convenient to assign an own struct device to each codec object.
Then we'll be able to use dev_err() more easily for each codec, for
example.

For achieving it, this patch just creates an object "hdaudioCxDy".
It belongs to sound class instead of creating a new bus, just for
simplicity, at this stage.  No pm ops is implemented in the device
struct level but currently it's merely a container.  The PCM and hwdep
devices are now children of this codec device.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Add sysfs to codec object, too

We have currently sysfs attributes for each hwdep, but basically these
should belong to the codec itself, per se.  Let's add them to the
codec object while keeping them for hwdep as is for compatibility.

While we are at it, split the sysfs-related stuff into a separate
source file, hda_sysfs.c, and keep only the stuff necessary for hwdep
in hda_hwdep.c.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Enable sysfs attributes without CONFIG_SND_HDA_RECONFIG

Some sysfs attributes like init_pin_configs or vendor_name are really
basic and should be available no matter whether the codec driver is
re-configurable or not.  Put them out of #ifdef
CONFIG_SND_HDA_RECONFIG and allow the read-only accesses.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
ALSA: hda - Replace with standard printk

Use dev_err() and co for messages from HD-audio controller and codec
drivers.  The codec drivers are mostly bound with codec objects, so
some helper macros, codec_err(), codec_info(), etc, are provided.
They merely wrap the corresponding dev_xxx().

There are a few places still calling snd_printk() and its variants
as they are called without the codec or device context.

Signed-off-by: Takashi Iwai <tiwai@suse.de>