All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH RFC 0/2] addition of audio to backports
@ 2015-09-17 21:47 Pierre-Louis Bossart
  2015-09-17 21:47 ` [PATCH RFC 1/2] Add required changes for audio packports Pierre-Louis Bossart
  2015-09-17 21:47 ` [PATCH RFC 2/2] add script to enable audio backport Pierre-Louis Bossart
  0 siblings, 2 replies; 9+ messages in thread
From: Pierre-Louis Bossart @ 2015-09-17 21:47 UTC (permalink / raw)
  To: backports; +Cc: Pierre-Louis Bossart

First pass (compile-tested only) to get feedback before next steps.
All drivers for PCI, USB, SPI, Firewire compile on a 3.13 kernel 
HDAudio and Asoc need more work
The first patch adds the needed dependencies and fixes.
The second patch adds the means to enable audio in a local copy

KNOWN ISSUES/LIMITATIONS:
0. the copylist has issues with bluetooth backport unrelated to audio, this 
would be fixed when the master branch works.
1. HDaudio will not work due to a dependency on DRM/i915. It's probably not
possible to support HDMI in the backport
2. ASoC drivers have issues with DMA, GPIO, DSD/OF properties
3. no default config was added.

TODO:
0. take feedback into account
1. look into known limitations
2. find a more elegant way to comment out sound/core.h and sound/pcm.h
3. implement backport for hrtimer_resolution
4. try with older kernels with ckmake (?)

Pierre-Louis Bossart (2):
  Add required changes for audio packports
  add script to enable audio backport

 backport/Kconfig.sources                           |   2 +
 backport/Makefile.kernel                           |   2 +
 backport/backport-include/linux/firewire.h         |  12 +
 backport/backport-include/linux/genalloc.h         |   9 +
 backport/backport-include/linux/hrtimer.h          |  12 +
 backport/backport-include/linux/skbuff.h           |   2 +
 backport/backport-include/linux/uio.h              | 246 +++++++++++++++++++++
 copy-list.patch                                    |  37 ++++
 dependencies                                       |   2 +
 enable-audio.sh                                    |   3 +
 .../sound/0001-pcm-native-fix-v41-changes.patch    | 128 +++++++++++
 patches/collateral-evolutions/sound/README         |   1 +
 sound_headers.patch                                |  38 ++++
 13 files changed, 494 insertions(+)
 create mode 100644 backport/backport-include/linux/firewire.h
 create mode 100644 backport/backport-include/linux/genalloc.h
 create mode 100644 backport/backport-include/linux/hrtimer.h
 create mode 100644 backport/backport-include/linux/uio.h
 create mode 100644 copy-list.patch
 create mode 100644 enable-audio.sh
 create mode 100644 patches/collateral-evolutions/sound/0001-pcm-native-fix-v41-changes.patch
 create mode 100644 patches/collateral-evolutions/sound/README
 create mode 100644 sound_headers.patch

-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH RFC 1/2] Add required changes for audio packports
  2015-09-17 21:47 [PATCH RFC 0/2] addition of audio to backports Pierre-Louis Bossart
@ 2015-09-17 21:47 ` Pierre-Louis Bossart
  2015-09-18  7:15   ` Johannes Berg
  2015-09-17 21:47 ` [PATCH RFC 2/2] add script to enable audio backport Pierre-Louis Bossart
  1 sibling, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2015-09-17 21:47 UTC (permalink / raw)
  To: backports; +Cc: Pierre-Louis Bossart

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 backport/Kconfig.sources                           |   2 +
 backport/Makefile.kernel                           |   2 +
 backport/backport-include/linux/firewire.h         |  12 +
 backport/backport-include/linux/genalloc.h         |   9 +
 backport/backport-include/linux/hrtimer.h          |  12 +
 backport/backport-include/linux/skbuff.h           |   2 +
 backport/backport-include/linux/uio.h              | 246 +++++++++++++++++++++
 dependencies                                       |   2 +
 .../sound/0001-pcm-native-fix-v41-changes.patch    | 128 +++++++++++
 patches/collateral-evolutions/sound/README         |   1 +
 10 files changed, 416 insertions(+)
 create mode 100644 backport/backport-include/linux/firewire.h
 create mode 100644 backport/backport-include/linux/genalloc.h
 create mode 100644 backport/backport-include/linux/hrtimer.h
 create mode 100644 backport/backport-include/linux/uio.h
 create mode 100644 patches/collateral-evolutions/sound/0001-pcm-native-fix-v41-changes.patch
 create mode 100644 patches/collateral-evolutions/sound/README

diff --git a/backport/Kconfig.sources b/backport/Kconfig.sources
index 5711433..b076648 100644
--- a/backport/Kconfig.sources
+++ b/backport/Kconfig.sources
@@ -22,3 +22,5 @@ source "$BACKPORT_DIR/net/mac802154/Kconfig"
 source "$BACKPORT_DIR/drivers/net/ieee802154/Kconfig"
 
 source "$BACKPORT_DIR/drivers/usb/class/Kconfig"
+
+source "$BACKPORT_DIR/sound/Kconfig"
\ No newline at end of file
diff --git a/backport/Makefile.kernel b/backport/Makefile.kernel
index 42333ad..cbdcd28 100644
--- a/backport/Makefile.kernel
+++ b/backport/Makefile.kernel
@@ -54,3 +54,5 @@ obj-$(CPTCFG_IEEE802154) += drivers/net/ieee802154/
 
 obj-$(CPTCFG_USB_WDM) += drivers/usb/class/
 obj-$(CPTCFG_USB_USBNET) += drivers/net/usb/
+
+obj-$(CPTCFG_SOUND) += sound/
diff --git a/backport/backport-include/linux/firewire.h b/backport/backport-include/linux/firewire.h
new file mode 100644
index 0000000..3306ce8
--- /dev/null
+++ b/backport/backport-include/linux/firewire.h
@@ -0,0 +1,12 @@
+#ifndef __BACKPORT_LINUX_FIREWIRE_H
+#define __BACKPORT_LINUX_FIREWIRE_H
+#include_next <linux/firewire.h>
+#include <linux/version.h>
+
+#if  LINUX_VERSION_CODE < KERNEL_VERSION(3,16,0)
+
+void fw_schedule_bus_reset(struct fw_card *card, bool delayed,
+			   bool short_reset);
+#endif /* < 3.16 */
+
+#endif /* __BACKPORT_LINUX_FIREWIRE_H */
diff --git a/backport/backport-include/linux/genalloc.h b/backport/backport-include/linux/genalloc.h
new file mode 100644
index 0000000..a7917f3
--- /dev/null
+++ b/backport/backport-include/linux/genalloc.h
@@ -0,0 +1,9 @@
+#ifndef __BACKPORT_LINUX_GENALLOC_H
+#define __BACKPORT_LINUX_GENALLOC_H
+#include_next <linux/genalloc.h>
+
+#if LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+#define of_gen_pool_get of_get_named_gen_pool
+#endif /* LINUX_VERSION_CODE < KERNEL_VERSION(4, 2, 0) */
+
+#endif /* __BACKPORT_LINUX_GENALLOC_H */
diff --git a/backport/backport-include/linux/hrtimer.h b/backport/backport-include/linux/hrtimer.h
new file mode 100644
index 0000000..e951315
--- /dev/null
+++ b/backport/backport-include/linux/hrtimer.h
@@ -0,0 +1,12 @@
+#ifndef __BACKPORT_LINUX_HRTIMER_H
+#define __BACKPORT_LINUX_HRTIMER_H
+#include_next <linux/hrtimer.h>
+#include <linux/version.h>
+
+#if  LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
+
+#define hrtimer_resolution	(unsigned int)LOW_RES_NSEC
+
+#endif /* < 4.2 */
+
+#endif /* __BACKPORT_LINUX_HRTIMER_H */
diff --git a/backport/backport-include/linux/skbuff.h b/backport/backport-include/linux/skbuff.h
index a21e6cc..2c56141 100644
--- a/backport/backport-include/linux/skbuff.h
+++ b/backport/backport-include/linux/skbuff.h
@@ -258,6 +258,8 @@ static inline struct page *dev_alloc_page(void)
 #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
 
 #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+
+#include <linux/uio.h>
 #define skb_copy_datagram_msg LINUX_BACKPORT(skb_copy_datagram_msg)
 static inline int skb_copy_datagram_msg(const struct sk_buff *from, int offset,
 					struct msghdr *msg, int size)
diff --git a/backport/backport-include/linux/uio.h b/backport/backport-include/linux/uio.h
new file mode 100644
index 0000000..0aa5e87
--- /dev/null
+++ b/backport/backport-include/linux/uio.h
@@ -0,0 +1,246 @@
+#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
+#include_next <linux/uio.h>
+
+#ifndef __iter_is_iovec_h_
+#define __iter_is_iovec_h_
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0))
+
+#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
+
+/* iov_iter is defined elsewhere */
+#include_next <linux/fs.h>
+static inline bool iter_is_iovec(struct iov_iter *i)
+{
+	return true;
+}
+
+#else
+static inline bool iter_is_iovec(struct iov_iter *i)
+{
+	return !(i->type & (ITER_BVEC | ITER_KVEC));
+}
+#endif
+#endif
+
+#endif /* __iter_is_iovec_h_ */
+
+#else
+
+#ifndef _LINUX_UIO_H
+#define _LINUX_UIO_H
+
+/*
+ * A set of types for the internal kernel types representing uids and gids.
+ *
+ * The types defined in this header allow distinguishing which uids and gids in
+ * the kernel are values used by userspace and which uid and gid values are
+ * the internal kernel values.  With the addition of user namespaces the values
+ * can be different.  Using the type system makes it possible for the compiler
+ * to detect when we overlook these differences.
+ *
+ */
+#include <linux/types.h>
+#include <linux/highuid.h>
+
+struct user_namespace;
+extern struct user_namespace init_user_ns;
+
+#ifdef CONFIG_UIO_STRICT_TYPE_CHECKS
+
+typedef struct {
+	uid_t val;
+} kuid_t;
+
+
+typedef struct {
+	gid_t val;
+} kgid_t;
+
+#define KUIDT_INIT(value) (kuid_t){ value }
+#define KGIDT_INIT(value) (kgid_t){ value }
+
+static inline uid_t __kuid_val(kuid_t uid)
+{
+	return uid.val;
+}
+
+static inline gid_t __kgid_val(kgid_t gid)
+{
+	return gid.val;
+}
+
+#else
+
+typedef uid_t kuid_t;
+typedef gid_t kgid_t;
+
+static inline uid_t __kuid_val(kuid_t uid)
+{
+	return uid;
+}
+
+static inline gid_t __kgid_val(kgid_t gid)
+{
+	return gid;
+}
+
+#define KUIDT_INIT(value) ((kuid_t) value )
+#define KGIDT_INIT(value) ((kgid_t) value )
+
+#endif
+
+#define GLOBAL_ROOT_UID KUIDT_INIT(0)
+#define GLOBAL_ROOT_GID KGIDT_INIT(0)
+
+#define INVALID_UID KUIDT_INIT(-1)
+#define INVALID_GID KGIDT_INIT(-1)
+
+static inline bool uid_eq(kuid_t left, kuid_t right)
+{
+	return __kuid_val(left) == __kuid_val(right);
+}
+
+static inline bool gid_eq(kgid_t left, kgid_t right)
+{
+	return __kgid_val(left) == __kgid_val(right);
+}
+
+static inline bool uid_gt(kuid_t left, kuid_t right)
+{
+	return __kuid_val(left) > __kuid_val(right);
+}
+
+static inline bool gid_gt(kgid_t left, kgid_t right)
+{
+	return __kgid_val(left) > __kgid_val(right);
+}
+
+static inline bool uid_gte(kuid_t left, kuid_t right)
+{
+	return __kuid_val(left) >= __kuid_val(right);
+}
+
+static inline bool gid_gte(kgid_t left, kgid_t right)
+{
+	return __kgid_val(left) >= __kgid_val(right);
+}
+
+static inline bool uid_lt(kuid_t left, kuid_t right)
+{
+	return __kuid_val(left) < __kuid_val(right);
+}
+
+static inline bool gid_lt(kgid_t left, kgid_t right)
+{
+	return __kgid_val(left) < __kgid_val(right);
+}
+
+static inline bool uid_lte(kuid_t left, kuid_t right)
+{
+	return __kuid_val(left) <= __kuid_val(right);
+}
+
+static inline bool gid_lte(kgid_t left, kgid_t right)
+{
+	return __kgid_val(left) <= __kgid_val(right);
+}
+
+static inline bool uid_valid(kuid_t uid)
+{
+	return !uid_eq(uid, INVALID_UID);
+}
+
+static inline bool gid_valid(kgid_t gid)
+{
+	return !gid_eq(gid, INVALID_GID);
+}
+
+#ifdef CONFIG_USER_NS
+
+#define make_kuid LINUX_BACKPORT(make_kuid)
+extern kuid_t make_kuid(struct user_namespace *from, uid_t uid);
+#define make_kgid LINUX_BACKPORT(make_kgid)
+extern kgid_t make_kgid(struct user_namespace *from, gid_t gid);
+
+#define from_kuid LINUX_BACKPORT(from_kuid)
+extern uid_t from_kuid(struct user_namespace *to, kuid_t uid);
+#define from_kgid LINUX_BACKPORT(from_kgid)
+extern gid_t from_kgid(struct user_namespace *to, kgid_t gid);
+#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged)
+extern uid_t from_kuid_munged(struct user_namespace *to, kuid_t uid);
+#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged)
+extern gid_t from_kgid_munged(struct user_namespace *to, kgid_t gid);
+
+#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping)
+static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
+{
+	return from_kuid(ns, uid) != (uid_t) -1;
+}
+
+#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping)
+static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
+{
+	return from_kgid(ns, gid) != (gid_t) -1;
+}
+
+#else
+
+#define make_kuid LINUX_BACKPORT(make_kuid)
+static inline kuid_t make_kuid(struct user_namespace *from, uid_t uid)
+{
+	return KUIDT_INIT(uid);
+}
+
+#define make_kgid LINUX_BACKPORT(make_kgid)
+static inline kgid_t make_kgid(struct user_namespace *from, gid_t gid)
+{
+	return KGIDT_INIT(gid);
+}
+
+#define from_kuid LINUX_BACKPORT(from_kuid)
+static inline uid_t from_kuid(struct user_namespace *to, kuid_t kuid)
+{
+	return __kuid_val(kuid);
+}
+
+#define from_kgid LINUX_BACKPORT(from_kgid)
+static inline gid_t from_kgid(struct user_namespace *to, kgid_t kgid)
+{
+	return __kgid_val(kgid);
+}
+
+#define from_kuid_munged LINUX_BACKPORT(from_kuid_munged)
+static inline uid_t from_kuid_munged(struct user_namespace *to, kuid_t kuid)
+{
+	uid_t uid = from_kuid(to, kuid);
+	if (uid == (uid_t)-1)
+		uid = overflowuid;
+	return uid;
+}
+
+#define from_kgid_munged LINUX_BACKPORT(from_kgid_munged)
+static inline gid_t from_kgid_munged(struct user_namespace *to, kgid_t kgid)
+{
+	gid_t gid = from_kgid(to, kgid);
+	if (gid == (gid_t)-1)
+		gid = overflowgid;
+	return gid;
+}
+
+#define kuid_has_mapping LINUX_BACKPORT(kuid_has_mapping)
+static inline bool kuid_has_mapping(struct user_namespace *ns, kuid_t uid)
+{
+	return true;
+}
+
+#define kgid_has_mapping LINUX_BACKPORT(kgid_has_mapping)
+static inline bool kgid_has_mapping(struct user_namespace *ns, kgid_t gid)
+{
+	return true;
+}
+
+#endif /* CONFIG_USER_NS */
+
+#endif /* _LINUX_UIO_H */
+#endif /* LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0) */
diff --git a/dependencies b/dependencies
index ba78004..bd84a6e 100644
--- a/dependencies
+++ b/dependencies
@@ -178,3 +178,5 @@ IGB 3.5
 
 # This driver needs mmc_hw_reset() which was added in kernel version 3.2
 MWIFIEX_SDIO 3.2
+
+SOUND 3.13
\ No newline at end of file
diff --git a/patches/collateral-evolutions/sound/0001-pcm-native-fix-v41-changes.patch b/patches/collateral-evolutions/sound/0001-pcm-native-fix-v41-changes.patch
new file mode 100644
index 0000000..12a57c5
--- /dev/null
+++ b/patches/collateral-evolutions/sound/0001-pcm-native-fix-v41-changes.patch
@@ -0,0 +1,128 @@
+diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
+index 75888dd..2b4a149 100644
+--- a/sound/core/pcm_native.c
++++ b/sound/core/pcm_native.c
+@@ -3068,6 +3068,91 @@ static ssize_t snd_pcm_write(struct file *file, const char __user *buf,
+ 	return result;
+ }
+ 
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++
++/*
++ * FIXME: this structure is in aio.h or linux/include.h,
++ * include it here for now to avoid compilation issues
++ */
++
++struct kiocb {
++	struct file		*ki_filp;
++	loff_t			ki_pos;
++	void (*ki_complete)(struct kiocb *iocb, long ret, long ret2);
++	void			*private;
++	int			ki_flags;
++};
++
++static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct iovec *iov,
++			     unsigned long nr_segs, loff_t pos)
++
++{
++	struct snd_pcm_file *pcm_file;
++	struct snd_pcm_substream *substream;
++	struct snd_pcm_runtime *runtime;
++	snd_pcm_sframes_t result;
++	unsigned long i;
++	void __user **bufs;
++	snd_pcm_uframes_t frames;
++
++	pcm_file = iocb->ki_filp->private_data;
++	substream = pcm_file->substream;
++	if (PCM_RUNTIME_CHECK(substream))
++		return -ENXIO;
++	runtime = substream->runtime;
++	if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
++		return -EBADFD;
++	if (nr_segs > 1024 || nr_segs != runtime->channels)
++		return -EINVAL;
++	if (!frame_aligned(runtime, iov->iov_len))
++		return -EINVAL;
++	frames = bytes_to_samples(runtime, iov->iov_len);
++	bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL);
++	if (bufs == NULL)
++		return -ENOMEM;
++	for (i = 0; i < nr_segs; ++i)
++		bufs[i] = iov[i].iov_base;
++	result = snd_pcm_lib_readv(substream, bufs, frames);
++	if (result > 0)
++		result = frames_to_bytes(runtime, result);
++	kfree(bufs);
++	return result;
++}
++
++static ssize_t snd_pcm_aio_write(struct kiocb *iocb, const struct iovec *iov,
++			      unsigned long nr_segs, loff_t pos)
++{
++	struct snd_pcm_file *pcm_file;
++	struct snd_pcm_substream *substream;
++	struct snd_pcm_runtime *runtime;
++	snd_pcm_sframes_t result;
++	unsigned long i;
++	void __user **bufs;
++	snd_pcm_uframes_t frames;
++
++	pcm_file = iocb->ki_filp->private_data;
++	substream = pcm_file->substream;
++	if (PCM_RUNTIME_CHECK(substream))
++		return -ENXIO;
++	runtime = substream->runtime;
++	if (runtime->status->state == SNDRV_PCM_STATE_OPEN)
++		return -EBADFD;
++	if (nr_segs > 128 || nr_segs != runtime->channels ||
++	    !frame_aligned(runtime, iov->iov_len))
++		return -EINVAL;
++	frames = bytes_to_samples(runtime, iov->iov_len);
++	bufs = kmalloc(sizeof(void *) * nr_segs, GFP_KERNEL);
++	if (bufs == NULL)
++		return -ENOMEM;
++	for (i = 0; i < nr_segs; ++i)
++		bufs[i] = iov[i].iov_base;
++	result = snd_pcm_lib_writev(substream, bufs, frames);
++	if (result > 0)
++		result = frames_to_bytes(runtime, result);
++	kfree(bufs);
++	return result;
++}
++#else
+ static ssize_t snd_pcm_readv(struct kiocb *iocb, struct iov_iter *to)
+ {
+ 	struct snd_pcm_file *pcm_file;
+@@ -3138,6 +3223,7 @@ static ssize_t snd_pcm_writev(struct kiocb *iocb, struct iov_iter *from)
+ 	kfree(bufs);
+ 	return result;
+ }
++#endif
+ 
+ static unsigned int snd_pcm_playback_poll(struct file *file, poll_table * wait)
+ {
+@@ -3669,7 +3755,11 @@ const struct file_operations snd_pcm_f_ops[2] = {
+ 	{
+ 		.owner =		THIS_MODULE,
+ 		.write =		snd_pcm_write,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++		.aio_write =             snd_pcm_aio_write,
++#else
+ 		.write_iter =		snd_pcm_writev,
++#endif
+ 		.open =			snd_pcm_playback_open,
+ 		.release =		snd_pcm_release,
+ 		.llseek =		no_llseek,
+@@ -3683,7 +3773,11 @@ const struct file_operations snd_pcm_f_ops[2] = {
+ 	{
+ 		.owner =		THIS_MODULE,
+ 		.read =			snd_pcm_read,
++#if LINUX_VERSION_CODE < KERNEL_VERSION(4,1,0)
++		.aio_read =             snd_pcm_aio_read,
++#else
+ 		.read_iter =		snd_pcm_readv,
++#endif
+ 		.open =			snd_pcm_capture_open,
+ 		.release =		snd_pcm_release,
+ 		.llseek =		no_llseek,
diff --git a/patches/collateral-evolutions/sound/README b/patches/collateral-evolutions/sound/README
new file mode 100644
index 0000000..4797e65
--- /dev/null
+++ b/patches/collateral-evolutions/sound/README
@@ -0,0 +1 @@
+This holds collateral evolutions that apply to any driver we backport
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH RFC 2/2] add script to enable audio backport
  2015-09-17 21:47 [PATCH RFC 0/2] addition of audio to backports Pierre-Louis Bossart
  2015-09-17 21:47 ` [PATCH RFC 1/2] Add required changes for audio packports Pierre-Louis Bossart
@ 2015-09-17 21:47 ` Pierre-Louis Bossart
  2015-09-18  7:17   ` Johannes Berg
  1 sibling, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2015-09-17 21:47 UTC (permalink / raw)
  To: backports; +Cc: Pierre-Louis Bossart

bash enable_audio.sh will add the required files in copylist
and patch some of the backport headers

Signed-off-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>
---
 copy-list.patch     | 37 +++++++++++++++++++++++++++++++++++++
 enable-audio.sh     |  3 +++
 sound_headers.patch | 38 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 78 insertions(+)
 create mode 100644 copy-list.patch
 create mode 100644 enable-audio.sh
 create mode 100644 sound_headers.patch

diff --git a/copy-list.patch b/copy-list.patch
new file mode 100644
index 0000000..1bd3065
--- /dev/null
+++ b/copy-list.patch
@@ -0,0 +1,37 @@
+diff --git a/copy-list b/copy-list
+index 2264d01..9a7fcf4 100644
+--- a/copy-list
++++ b/copy-list
+@@ -100,9 +100,9 @@ drivers/net/usb/usbnet.c
+ 
+ 
+ # Bluetooth
+-include/net/bluetooth/
+-net/bluetooth/
+-drivers/bluetooth/
++#include/net/bluetooth/
++#net/bluetooth/
++#drivers/bluetooth/
+ 
+ 
+ # Ethernet drivers
+@@ -145,7 +145,7 @@ include/linux/platform_data/nfcmrvl.h
+ include/linux/platform_data/nxp-nci.h
+ include/linux/platform_data/pn544.h
+ include/linux/platform_data/st21nfca.h
+-include/linux/platform_data/st_nci.h
++include/linux/platform_data/st-nci.h
+ 
+ # Media
+ include/media/
+@@ -192,3 +192,9 @@ drivers/net/ieee802154/
+ # this right now, see 960d97f95
+ include/linux/mpls.h
+ include/uapi/linux/mpls.h
++
++# Sound support
++sound/
++include/sound/
++include/uapi/sound/
++include/linux/list.h
+\ No newline at end of file
diff --git a/enable-audio.sh b/enable-audio.sh
new file mode 100644
index 0000000..666d8d8
--- /dev/null
+++ b/enable-audio.sh
@@ -0,0 +1,3 @@
+#!/bin/bash
+patch -p1 < copy-list.patch
+patch -p1 < sound_headers.patch
diff --git a/sound_headers.patch b/sound_headers.patch
new file mode 100644
index 0000000..9c09108
--- /dev/null
+++ b/sound_headers.patch
@@ -0,0 +1,38 @@
+diff --git a/backport/backport-include/sound/core.h b/backport/backport-include/sound/core.h
+index beb8935..4b39e5b 100644
+--- a/backport/backport-include/sound/core.h
++++ b/backport/backport-include/sound/core.h
+@@ -2,6 +2,7 @@
+ #define _BACKPORT_SOUND_CORE_H
+ #include_next <sound/core.h>
+ 
++#if 0
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0)
+ #define snd_card_new LINUX_BACKPORT(snd_card_new)
+ static inline
+@@ -16,5 +17,6 @@ int snd_card_new(struct device *parent, int idx, const char *xid,
+ 	return ret;
+ }
+ #endif
++#endif
+ 
+ #endif /* _BACKPORT_SOUND_CORE_H */
+diff --git a/backport/backport-include/sound/pcm.h b/backport/backport-include/sound/pcm.h
+index 469e871..51dc152 100644
+--- a/backport/backport-include/sound/pcm.h
++++ b/backport/backport-include/sound/pcm.h
+@@ -3,6 +3,7 @@
+ #include_next <sound/pcm.h>
+ #include <linux/version.h>
+ 
++#if 0
+ #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
+ /**
+  * snd_pcm_stop_xrun - stop the running streams as XRUN
+@@ -25,5 +26,5 @@ static inline int snd_pcm_stop_xrun(struct snd_pcm_substream *substream)
+ 	return ret;
+ }
+ #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
+-
++#endif
+ #endif /* __BACKPORT_SOUND_PCM_H */
-- 
1.9.1

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Add required changes for audio packports
  2015-09-17 21:47 ` [PATCH RFC 1/2] Add required changes for audio packports Pierre-Louis Bossart
@ 2015-09-18  7:15   ` Johannes Berg
  2015-09-18 13:00     ` Pierre-Louis Bossart
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2015-09-18  7:15 UTC (permalink / raw)
  To: Pierre-Louis Bossart, backports

On Thu, 2015-09-17 at 16:47 -0500, Pierre-Louis Bossart wrote:

> +#if  LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
> +
> +#define hrtimer_resolution	(unsigned int)LOW_RES_NSEC
> +
> +#endif /* < 4.2 */

Do we need parentheses around that all?

> --- a/backport/backport-include/linux/skbuff.h
> +++ b/backport/backport-include/linux/skbuff.h
> @@ -258,6 +258,8 @@ static inline struct page *dev_alloc_page(void)
>  #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
>  
>  #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
> +
> +#include <linux/uio.h>

That's a bit odd? But perhaps necessary - just better to have the blank
line after the include :)

> --- /dev/null
> +++ b/backport/backport-include/linux/uio.h
> @@ -0,0 +1,246 @@
> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
> +#include_next <linux/uio.h>
> +
> +#ifndef __iter_is_iovec_h_
> +#define __iter_is_iovec_h_

Perhaps better to simply protect the whole file?

> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0))
> +
> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
> +
> +/* iov_iter is defined elsewhere */
> +#include_next <linux/fs.h>
> +static inline bool iter_is_iovec(struct iov_iter *i)
> +{
> +	return true;
> +}
> +
> +#else
> +static inline bool iter_is_iovec(struct iov_iter *i)
> +{
> +	return !(i->type & (ITER_BVEC | ITER_KVEC));
> +}
> +#endif
> +#endif

That could be written a bit clearer with #elif, I think.

> +#endif /* __iter_is_iovec_h_ */
> +
> +#else
> +
> +#ifndef _LINUX_UIO_H
> +#define _LINUX_UIO_H
> 

This part looks like a straight-up copy - perhaps better to add it to
copy-list and then provide a patch to patch around it the necessary
modifications - see for example the devcoredump patch in
patches/backport-adjustments/devcoredump.patch

> --- a/dependencies
> +++ b/dependencies
> @@ -178,3 +178,5 @@ IGB 3.5
>  
>  # This driver needs mmc_hw_reset() which was added in kernel version 
> 3.2
>  MWIFIEX_SDIO 3.2
> +
> +SOUND 3.13
> \ No newline at end of file

Please keep a newline at EOF.

> ++static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct 
> iovec *iov,
> ++			     unsigned long nr_segs, loff_t pos)
> ++

Is it possible to reduce this function to calling the existing
snd_pcm_readv (and aio_write to writev) by suitable data structure
manipulation?

If so, it might be possible to create an spatch to make these changes,
which would make them apply more generally and be less prone to
breaking.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 2/2] add script to enable audio backport
  2015-09-17 21:47 ` [PATCH RFC 2/2] add script to enable audio backport Pierre-Louis Bossart
@ 2015-09-18  7:17   ` Johannes Berg
  2015-09-18 13:06     ` Pierre-Louis Bossart
  0 siblings, 1 reply; 9+ messages in thread
From: Johannes Berg @ 2015-09-18  7:17 UTC (permalink / raw)
  To: Pierre-Louis Bossart, backports

On Thu, 2015-09-17 at 16:47 -0500, Pierre-Louis Bossart wrote:
> bash enable_audio.sh will add the required files in copylist
> and patch some of the backport headers
> 
I don't think this should be part of backports - the code modifications
shouldn't be necessary, you can add everything to copy-list as it
should be (and run with your own copy-list for just sound), and provide
a defconfig file.

Scripting really shouldn't be there I think.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Add required changes for audio packports
  2015-09-18  7:15   ` Johannes Berg
@ 2015-09-18 13:00     ` Pierre-Louis Bossart
  2015-09-18 13:09       ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2015-09-18 13:00 UTC (permalink / raw)
  To: Johannes Berg, backports

Thanks for the review.

On 9/18/15 2:15 AM, Johannes Berg wrote:
> On Thu, 2015-09-17 at 16:47 -0500, Pierre-Louis Bossart wrote:
>
>> +#if  LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0)
>> +
>> +#define hrtimer_resolution	(unsigned int)LOW_RES_NSEC
>> +
>> +#endif /* < 4.2 */
>
> Do we need parentheses around that all?

Yes, and this needs more love to use hr timers as well in the compat c 
code. this was just to get past the compilation.

>> --- a/backport/backport-include/linux/skbuff.h
>> +++ b/backport/backport-include/linux/skbuff.h
>> @@ -258,6 +258,8 @@ static inline struct page *dev_alloc_page(void)
>>   #endif /* LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0) */
>>
>>   #if LINUX_VERSION_CODE < KERNEL_VERSION(3,19,0)
>> +
>> +#include <linux/uio.h>
>
> That's a bit odd? But perhaps necessary - just better to have the blank
> line after the include :)
>
>> --- /dev/null
>> +++ b/backport/backport-include/linux/uio.h
>> @@ -0,0 +1,246 @@
>> +#if (LINUX_VERSION_CODE >= KERNEL_VERSION(3,5,0))
>> +#include_next <linux/uio.h>
>> +
>> +#ifndef __iter_is_iovec_h_
>> +#define __iter_is_iovec_h_
>
> Perhaps better to simply protect the whole file?
>
>> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(4,2,0))
>> +
>> +#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,15,0))
>> +
>> +/* iov_iter is defined elsewhere */
>> +#include_next <linux/fs.h>
>> +static inline bool iter_is_iovec(struct iov_iter *i)
>> +{
>> +	return true;
>> +}
>> +
>> +#else
>> +static inline bool iter_is_iovec(struct iov_iter *i)
>> +{
>> +	return !(i->type & (ITER_BVEC | ITER_KVEC));
>> +}
>> +#endif
>> +#endif
>
> That could be written a bit clearer with #elif, I think.
>
>> +#endif /* __iter_is_iovec_h_ */
>> +
>> +#else
>> +
>> +#ifndef _LINUX_UIO_H
>> +#define _LINUX_UIO_H
>>
>
> This part looks like a straight-up copy - perhaps better to add it to
> copy-list and then provide a patch to patch around it the necessary
> modifications - see for example the devcoredump patch in
> patches/backport-adjustments/devcoredump.patch

Ah this whole thing is a nightmare. The definitions moved between files, 
I kept having issues between uio.h, aio.h and fs.h and warnings/errors 
of the iovec/kuiocb structures being redefined. I'll look at the example 
mentioned.

>> --- a/dependencies
>> +++ b/dependencies
>> @@ -178,3 +178,5 @@ IGB 3.5
>>
>>   # This driver needs mmc_hw_reset() which was added in kernel version
>> 3.2
>>   MWIFIEX_SDIO 3.2
>> +
>> +SOUND 3.13
>> \ No newline at end of file
>
> Please keep a newline at EOF.

yep

>> ++static ssize_t snd_pcm_aio_read(struct kiocb *iocb, const struct
>> iovec *iov,
>> ++			     unsigned long nr_segs, loff_t pos)
>> ++
>
> Is it possible to reduce this function to calling the existing
> snd_pcm_readv (and aio_write to writev) by suitable data structure
> manipulation?
>
> If so, it might be possible to create an spatch to make these changes,
> which would make them apply more generally and be less prone to
> breaking.

This was a first-order ugly backport to revert to what existed before.
I have no idea what an spatch is, if there is an example of such a 
'suitable data structure manipulation' I am all ears.

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 2/2] add script to enable audio backport
  2015-09-18  7:17   ` Johannes Berg
@ 2015-09-18 13:06     ` Pierre-Louis Bossart
  2015-09-18 13:11       ` Johannes Berg
  0 siblings, 1 reply; 9+ messages in thread
From: Pierre-Louis Bossart @ 2015-09-18 13:06 UTC (permalink / raw)
  To: Johannes Berg, backports

On 9/18/15 2:17 AM, Johannes Berg wrote:
> On Thu, 2015-09-17 at 16:47 -0500, Pierre-Louis Bossart wrote:
>> bash enable_audio.sh will add the required files in copylist
>> and patch some of the backport headers
>>
> I don't think this should be part of backports - the code modifications
> shouldn't be necessary, you can add everything to copy-list as it
> should be (and run with your own copy-list for just sound), and provide
> a defconfig file.
>
> Scripting really shouldn't be there I think.

I guess I misunderstood an earlier email where you wrote

"You can submit this part upstream btw - it'll just be disabled in the
default copy-list... unless you also submit that upstream"

If you are ok to take the patches and have the upstream copy-list 
include the sound files then yes the script is not necessary. I just 
wanted to have a first pass that isn't intrusive or breaks all the 
backports, but simple enough for others to try and test.

--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 1/2] Add required changes for audio packports
  2015-09-18 13:00     ` Pierre-Louis Bossart
@ 2015-09-18 13:09       ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2015-09-18 13:09 UTC (permalink / raw)
  To: Pierre-Louis Bossart, backports

On Fri, 2015-09-18 at 08:00 -0500, Pierre-Louis Bossart wrote:
> 
> This was a first-order ugly backport to revert to what existed 
> before.

Fair enough.

> I have no idea what an spatch is,

A semantic patch (coccinelle)

>  if there is an example of such a 
> 'suitable data structure manipulation' I am all ears.

I don't have an example, but imagine you have this:

old code:
 my_read_data(struct my *my, void *out_buf, int len)

new code:
 my_read_data_sg(struct my *my, struct scatterlist *sg)


Then on old kernels you could do

backport_my_read_data(struct my *my, void *out_buf, int len)
{
 struct scatterlist sg;
 struct sg_ent ent;

 sg.nents = 1;
 sg.ents = &ent;
 ent.data = out_buf;
 ent.len = len;
 my_read_data_sg(&my, &sg);
}

(this absolutely won't compile, just to illustrate the idea)

That basically reduces the old function pointer to the new one with
static code inbetween, and then that can be embedded in an spatch that
automatically adds the wrapper where needed.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH RFC 2/2] add script to enable audio backport
  2015-09-18 13:06     ` Pierre-Louis Bossart
@ 2015-09-18 13:11       ` Johannes Berg
  0 siblings, 0 replies; 9+ messages in thread
From: Johannes Berg @ 2015-09-18 13:11 UTC (permalink / raw)
  To: Pierre-Louis Bossart, backports

On Fri, 2015-09-18 at 08:06 -0500, Pierre-Louis Bossart wrote:
> 
> "You can submit this part upstream btw - it'll just be disabled in 
> the
> default copy-list... unless you also submit that upstream"
> 
> If you are ok to take the patches and have the upstream copy-list 
> include the sound files then yes the script is not necessary. I just 
> wanted to have a first pass that isn't intrusive or breaks all the 
> backports, but simple enough for others to try and test.

Ah. Well I think that we'd probably wait until it compiles against all
kernels, but after that having them included in the upstream copy-list
isn't an issue at all.

And until then perhaps you'd just provide it as a separate tree or
patch somewhere, I don't think we should add it to backports like that.

johannes
--
To unsubscribe from this list: send the line "unsubscribe backports" in

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-09-18 13:11 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-09-17 21:47 [PATCH RFC 0/2] addition of audio to backports Pierre-Louis Bossart
2015-09-17 21:47 ` [PATCH RFC 1/2] Add required changes for audio packports Pierre-Louis Bossart
2015-09-18  7:15   ` Johannes Berg
2015-09-18 13:00     ` Pierre-Louis Bossart
2015-09-18 13:09       ` Johannes Berg
2015-09-17 21:47 ` [PATCH RFC 2/2] add script to enable audio backport Pierre-Louis Bossart
2015-09-18  7:17   ` Johannes Berg
2015-09-18 13:06     ` Pierre-Louis Bossart
2015-09-18 13:11       ` Johannes Berg

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.