Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/external/bsd/drm2/include/linux Elide up to one excess d...
details: https://anonhg.NetBSD.org/src/rev/4d13e4c5d5cb
branches: trunk
changeset: 797445:4d13e4c5d5cb
user: riastradh <riastradh%NetBSD.org@localhost>
date: Thu Jul 17 20:56:14 2014 +0000
description:
Elide up to one excess driver-named component from firmware pathnames.
diffstat:
sys/external/bsd/drm2/include/linux/firmware.h | 16 +++++++++++++---
1 files changed, 13 insertions(+), 3 deletions(-)
diffs (36 lines):
diff -r 3e47b5113065 -r 4d13e4c5d5cb sys/external/bsd/drm2/include/linux/firmware.h
--- a/sys/external/bsd/drm2/include/linux/firmware.h Thu Jul 17 20:41:22 2014 +0000
+++ b/sys/external/bsd/drm2/include/linux/firmware.h Thu Jul 17 20:56:14 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: firmware.h,v 1.4 2014/07/17 20:37:01 riastradh Exp $ */
+/* $NetBSD: firmware.h,v 1.5 2014/07/17 20:56:14 riastradh Exp $ */
/*-
* Copyright (c) 2013 The NetBSD Foundation, Inc.
@@ -51,14 +51,24 @@
request_firmware(const struct firmware **fwp, const char *image_name,
struct device *dev)
{
+ const char *drvname;
struct firmware *fw;
int ret;
fw = kmem_alloc(sizeof(*fw), KM_SLEEP);
+ /*
+ * If driver xyz(4) asks for xyz/foo/bar.bin, turn that into
+ * just foo/bar.bin. This leaves open the possibility of name
+ * collisions. Let's hope upstream is sensible about this.
+ */
+ drvname = device_cfdriver(dev)->cd_name;
+ if ((strncmp(drvname, image_name, strlen(drvname)) == 0) &&
+ (image_name[strlen(drvname)] == '/'))
+ image_name += (strlen(drvname) + 1);
+
/* XXX errno NetBSD->Linux */
- ret = -firmware_open(device_cfdriver(dev)->cd_name, image_name,
- &fw->fw_h);
+ ret = -firmware_open(drvname, image_name, &fw->fw_h);
if (ret)
goto fail0;
fw->size = firmware_get_size(fw->fw_h);
Home |
Main Index |
Thread Index |
Old Index