mirror of
https://github.com/FEX-Emu/linux.git
synced 2025-01-10 03:20:49 +00:00
9f7344fbaf
This patch is to fix compilation error and warning on the arm and blackfin. Add linux/slab.h head file to driver/usb/core/port.c. These are reported from 0-DAY kernel build testing backend. head:6e30d7cba9
commit:6e30d7cba9
[26/26] usb: Add driver/usb/core/(port.c,hub.h) files config: make ARCH=arm at91_dt_defconfig All error/warnings: drivers/usb/core/port.c: In function 'usb_port_device_release': >> drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration] drivers/usb/core/port.c: In function 'usb_hub_create_port_device': >> drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration] >> drivers/usb/core/port.c:38:40: error: 'GFP_KERNEL' undeclared (first use in this function) drivers/usb/core/port.c:38:40: note: each undeclared identifier is reported only once for each function it appears in cc1: some warnings being treated as errors head:6e30d7cba9
commit:6e30d7cba9
[26/26] usb: Add driver/usb/core/(port.c,hub.h) files config: make ARCH=blackfin BF526-EZBRD_defconfig All warnings: drivers/usb/core/port.c: In function 'usb_port_device_release': drivers/usb/core/port.c:25:2: error: implicit declaration of function 'kfree' [-Werror=implicit-function-declaration] drivers/usb/core/port.c: In function 'usb_hub_create_port_device': drivers/usb/core/port.c:38:2: error: implicit declaration of function 'kzalloc' [-Werror=implicit-function-declaration] >> drivers/usb/core/port.c:38:11: warning: assignment makes pointer from integer without a cast [enabled by default] cc1: some warnings being treated as errors Reported-by: Fengguang Wu <wfg@linux.intel.com> Signed-off-by: Lan Tianyu <tianyu.lan@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
69 lines
1.5 KiB
C
69 lines
1.5 KiB
C
/*
|
|
* usb port device code
|
|
*
|
|
* Copyright (C) 2012 Intel Corp
|
|
*
|
|
* Author: Lan Tianyu <tianyu.lan@intel.com>
|
|
*
|
|
* This program is free software; you can redistribute it and/or modify
|
|
* it under the terms of the GNU General Public License version 2 as
|
|
* published by the Free Software Foundation.
|
|
*
|
|
* 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.
|
|
*
|
|
*/
|
|
|
|
#include <linux/slab.h>
|
|
|
|
#include "hub.h"
|
|
|
|
static void usb_port_device_release(struct device *dev)
|
|
{
|
|
struct usb_port *port_dev = to_usb_port(dev);
|
|
|
|
kfree(port_dev);
|
|
}
|
|
|
|
struct device_type usb_port_device_type = {
|
|
.name = "usb_port",
|
|
.release = usb_port_device_release,
|
|
};
|
|
|
|
int usb_hub_create_port_device(struct usb_hub *hub, int port1)
|
|
{
|
|
struct usb_port *port_dev = NULL;
|
|
int retval;
|
|
|
|
port_dev = kzalloc(sizeof(*port_dev), GFP_KERNEL);
|
|
if (!port_dev) {
|
|
retval = -ENOMEM;
|
|
goto exit;
|
|
}
|
|
|
|
hub->ports[port1 - 1] = port_dev;
|
|
port_dev->dev.parent = hub->intfdev;
|
|
port_dev->dev.type = &usb_port_device_type;
|
|
dev_set_name(&port_dev->dev, "port%d", port1);
|
|
|
|
retval = device_register(&port_dev->dev);
|
|
if (retval)
|
|
goto error_register;
|
|
|
|
return 0;
|
|
|
|
error_register:
|
|
put_device(&port_dev->dev);
|
|
exit:
|
|
return retval;
|
|
}
|
|
|
|
void usb_hub_remove_port_device(struct usb_hub *hub,
|
|
int port1)
|
|
{
|
|
device_unregister(&hub->ports[port1 - 1]->dev);
|
|
}
|
|
|