mirror of https://gitee.com/openkylin/linux.git
greybus: kill off the last of gbuf.c
Only three functions remain in "gbuf.c". Move one of them into "connection.c" and the other two into "operation.c". Some more cleanup is coming that will further straighten out gbufs but for now there's no sense in drawing this out any longer. Signed-off-by: Alex Elder <elder@linaro.org> Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This commit is contained in:
parent
4e5007e5c2
commit
374e6a269c
|
@ -1,5 +1,4 @@
|
|||
greybus-y := core.o \
|
||||
gbuf.o \
|
||||
sysfs.o \
|
||||
debugfs.o \
|
||||
ap.o \
|
||||
|
|
|
@ -29,6 +29,21 @@ struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd,
|
|||
return connection;
|
||||
}
|
||||
|
||||
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
|
||||
u8 *data, size_t length)
|
||||
{
|
||||
struct gb_connection *connection;
|
||||
|
||||
connection = gb_hd_connection_find(hd, cport_id);
|
||||
if (!connection) {
|
||||
dev_err(hd->parent,
|
||||
"nonexistent connection (%zu bytes dropped)\n", length);
|
||||
return;
|
||||
}
|
||||
gb_connection_operation_recv(connection, data, length);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(greybus_cport_in);
|
||||
|
||||
/*
|
||||
* Allocate an available CPort Id for use for the host side of the
|
||||
* given connection. The lowest-available id is returned, so the
|
||||
|
|
|
@ -53,6 +53,8 @@ void gb_connection_exit(struct gb_connection *connection);
|
|||
struct gb_connection *gb_hd_connection_find(struct greybus_host_device *hd,
|
||||
u16 cport_id);
|
||||
|
||||
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
|
||||
u8 *data, size_t length);
|
||||
__printf(2, 3)
|
||||
void gb_connection_err(struct gb_connection *connection, const char *fmt, ...);
|
||||
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
/*
|
||||
* Greybus gbuf handling
|
||||
*
|
||||
* Copyright 2014 Google Inc.
|
||||
*
|
||||
* Released under the GPLv2 only.
|
||||
*/
|
||||
|
||||
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/moduleparam.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/device.h>
|
||||
|
||||
#include "greybus.h"
|
||||
|
||||
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
|
||||
{
|
||||
gbuf->status = -EINPROGRESS;
|
||||
|
||||
return gbuf->hd->driver->submit_gbuf(gbuf, gfp_mask);
|
||||
}
|
||||
|
||||
void greybus_kill_gbuf(struct gbuf *gbuf)
|
||||
{
|
||||
if (gbuf->status != -EINPROGRESS)
|
||||
return;
|
||||
|
||||
gbuf->hd->driver->kill_gbuf(gbuf);
|
||||
}
|
||||
|
||||
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
|
||||
u8 *data, size_t length)
|
||||
{
|
||||
struct gb_connection *connection;
|
||||
|
||||
connection = gb_hd_connection_find(hd, cport_id);
|
||||
if (!connection) {
|
||||
dev_err(hd->parent,
|
||||
"nonexistent connection (%zu bytes dropped)\n", length);
|
||||
return;
|
||||
}
|
||||
gb_connection_operation_recv(connection, data, length);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(greybus_cport_in);
|
|
@ -102,12 +102,6 @@ struct greybus_host_device {
|
|||
struct greybus_host_device *greybus_create_hd(struct greybus_host_driver *hd,
|
||||
struct device *parent);
|
||||
void greybus_remove_hd(struct greybus_host_device *hd);
|
||||
void greybus_cport_in(struct greybus_host_device *hd, u16 cport_id,
|
||||
u8 *data, size_t length);
|
||||
|
||||
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t mem_flags);
|
||||
void greybus_kill_gbuf(struct gbuf *gbuf);
|
||||
|
||||
|
||||
struct greybus_driver {
|
||||
const char *name;
|
||||
|
|
|
@ -103,6 +103,20 @@ gb_pending_operation_find(struct gb_connection *connection, u16 id)
|
|||
return found ? operation : NULL;
|
||||
}
|
||||
|
||||
static int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
|
||||
{
|
||||
gbuf->status = -EINPROGRESS;
|
||||
|
||||
return gbuf->hd->driver->submit_gbuf(gbuf, gfp_mask);
|
||||
}
|
||||
|
||||
static void greybus_kill_gbuf(struct gbuf *gbuf)
|
||||
{
|
||||
if (gbuf->status != -EINPROGRESS)
|
||||
return;
|
||||
|
||||
gbuf->hd->driver->kill_gbuf(gbuf);
|
||||
}
|
||||
/*
|
||||
* An operations's response message has arrived. If no callback was
|
||||
* supplied it was submitted for asynchronous completion, so we notify
|
||||
|
|
Loading…
Reference in New Issue