- 16 6月, 2015 1 次提交
-
-
由 Alex Elder 提交于
Define a public predicate that defines whether a CPort ID is valid. Use it in the message_send() routine, and make the message reported more accurately reflect the error. Also use it to check whether the CPort ID in a received message is valid; if it is not, just drop the message. Get rid of local variable "buffer" in message_send(); it adds no value. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 13 6月, 2015 7 次提交
-
-
由 Alex Elder 提交于
Currently, if an error occurs creating a bundle, we simply return an error without cleaning up any of the bundles that had already been successfully set up. Add code to destroy bundles that have been created in the event an error occurs. Add a check to ensure the interface's list of bundles was empty before parsing for bundles begins. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Currently gb_bundle_destroy() takes an interface as an argument, and really doesn't do what a function by that name should do. What it now does is delete all bundles associated with a given interface. What it should do is destroy a single bundle. Move the looping logic out of gb_bundle_destroy() and into its caller, gb_interface_destroy(). Pass each bundle in an interface to gb_bundle_destroy(), which will do what's required to destroy a single bundle (including removing it from its interface's bundle list under protection of the lock). Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Rearrange gb_bundle_find() so it follows the pattern used by gb_connection_find(). Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Currently, if an error occurs creating a connection, we simply return an error without cleaning up any of the connections that had already been successfully set up. Add code to destroy connections that have been created in the event an error occurs. Add a check to ensure the bundle's list of connections was empty before parsing for CPorts begins. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
I did this recently for the endo id allocation code. It's clearer now that the allocation of a CPort ID to use for the AP side of a connection is not very complicated, and it happens in a pretty controlled environment. The functions that abstract getting and releasing those ids don't really add that much value. This patch removes gb_connection_hd_cport_id_alloc() and gb_connection_hd_cport_id_free(), and just open-codes their activity in the few places they are called. It is obvious now that the CPort ID allocation isn't done in atomic context, so we can change the ida_simple_get() call to use GFP_KERNEL. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Although a connection records its protocol id when it gets created, its protocol handler doesn't actually get assigned until gb_connection_bind_protocol() is called. In gb_connection_create() there are some error paths in which a reference to the connection's protocol is released before the protocol handler has been associated with the connection. Get rid of those calls. As a result, we will never pass a null protocol pointer to gb_protocol_put(). Add a precautionary warning in that function in the event that ever occurs. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
When an error occurs in the device_add() call for a connection, the device reference is dropped as required. Because that's the device's only reference, that will also lead to gb_connection_release() being called, which frees the connection structure. Right now we're then making an extra request to free the connection, which is wrong. Fix that. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 12 6月, 2015 3 次提交
-
-
由 Phong Tran 提交于
There is lack of unregister and free the tty driver. This patch fixes it. Signed-off-by: NPhong Tran <tranmanphong@gmail.com> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Greg Kroah-Hartman 提交于
__init does not belong in a .h file, as it does not do anything there, so remove all instances of it. Reviewed-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Viresh Kumar 提交于
WARNING: /home/viresh/work/repos/ara/greybus/greybus.o(.init.text+0xb8): Section mismatch in reference from the function init_module() to the function .exit.text:gb_endo_exit() The function __init init_module() references a function __exit gb_endo_exit(). Fix it by removing __exit from endo_exit(). Fixes: cf64356c5151 ("endo: define endo_init() and endo_exit()") Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 11 6月, 2015 12 次提交
-
-
由 Alex Elder 提交于
Check at connection creation time for an attempt to create a connection with an interface CPort ID that's the same as one that's already been created. Define a new helper function to look for such a duplicate. The check for a duplicate is only performed at initialization time, and CPorts are initialized serially for each bundle, so there's no need to acquire the list lock for this search. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Check at bundle creation time to ensure we're not creating a bundle with an id that's the same as one that's already been created. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Rework the the code that parses the manifest for bundles so it only touches each manifest descriptor once. (Previously the list was scanned from the beginning repeatedly until all bundles were found.) Shorten the name of the descriptor variable, to avoid line wrap. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Rework the the code that parses the manifest for CPorts associated with a bundle so it only touches each manifest descriptor once. (Previously the list was scanned from the beginning repeatedly until all bundle CPorts were found.) Shorten the name of the descriptor variable, to avoid line wrap. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
An initialized bundle structure contains a pointer to its interface. Because of this there's no need to provide the interface pointer to gb_manifest_parse_cports(). This also precludes the possibility of passing a bad interface pointer. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
This patch incorporates some very small cleanups to "manifest.c": - Rearrange code a bit in gb_manifest_parse() that ensures a manifest is big enough to hold a header. If the manifest is exactly the size of a header, the error reported will now be "...must have 1 interface..." rather than "short manifest". - Fix the function comment for gb_manifest_parse_cports(). - Use "an interface," not "a interface," and don't capitalize. - Delete some braces when getting interface product string. - A few other minor changes to comments and white space. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Recently code was added (back) to assign a unique id to each endo, so satisfy uniqueness requirements of the Linux device subsystem. An ID allocator is used to manage the space of IDs. Now that we have gb_endo_init(), we can initialize the map there, and fully hide the ID map within "endo.c". The original functions gb_endo_id_alloc() and gb_endo_id_free() provided a nice abstract interface, but the direct ID allocation calls are quite simple, so just call them directly. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Define init and exit functions to do one-time setup and teardown of endo-related functionality. Currently they're place holders; the next patch will populate them. Note that we now call gb_operation_exit() from gb_init(), so we can no longer mark that function with __exit. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
The top-level functions gb_init() and gb_exit() are tagged with __init and __exit, respectively. These functions call a few other functions that are similarly used only at initialization and termination time. So mark those functions accordingly. Note that, because gb_ap_exit() and gb_debugfs_cleanup() are called by gb_init() in error paths, these functions cannot be declared with the __exit attribute. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
There's no need to include anything other than "greybus.h" in "connection.c". Same thing in "core.c" and "manifest.c" and "svc.c". Some files need headers included, but most come along with "greybus.h". Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Mark Greer 提交于
The sample count placed in Greybus I2S audio messages should be reset every time a new audio stream is set up. However, the current code does not do the reset so make it so it does. Signed-off-by: NMark Greer <mgreer@animalcreek.com> Acked-by: NJohn Stultz <john.stultz@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Greg Kroah-Hartman 提交于
The firmware is having a hard time with 4k buffers and memory allocation, so decrease the size on the host side to 2k. Also move away from using PAGE_SIZE to denote 4k as that's not the case on all architectures, and someone, someday, might get a rude surprise. Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 10 6月, 2015 3 次提交
-
-
由 Phong Tran 提交于
The unregister_chrdev_region() does twice here. The chrdev region was unregistered inside tty_unregister_driver(). Signed-off-by: NPhong Tran <tranmanphong@gmail.com> Reviewed-by: NAlex Elder <elder@linaro.org> Reviewed-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Phong Tran 提交于
There is a sparse warning. The endo id map is also used in endo.c. Should define in endo.h Signed-off-by: NPhong Tran <tranmanphong@gmail.com> Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Viresh Kumar 提交于
Normally, its a good practice to free resources in the reverse order in which they are allocated, so that all the dependencies can be sorted out properly. This is true while creating/destroying devices as well. For example consider this scenario (I faced a crash with control protocol due to this). For a new module, we will first create a bundle+connection for the control cport and then create other bundles/connections after parsing manifest. And while destroying interface on module hot unplug, we are removing the devices in the order they are added. And so the bundle/connection for the control cport are destroyed first. But, control cport was still required while destroying other bundles/connections. To solve this problem, lets destroy the resources in the reverse order in which they are added. Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 09 6月, 2015 7 次提交
-
-
由 Alex Elder 提交于
Provide a little more information in two pr_err() calls. Also enclose a reported condition in parentheses, to match the style used everywhere else in the file. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Rename greybus_deregister() to be greybus_deregister_driver(), so its name mirrors the greybus_register_driver() function it matches. Define greybus_deregister() to be a trivial macro. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
In gb_uart_request_recv(), the receive data size is in little-endian format. Do the proper byte swapping of that value before using it. Found by "make check". Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
Give gb_connection_hd_find() static scope; it's never used outside "connection.c". Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Alex Elder 提交于
The SVC protocol driver should have been defined as a basic Greybus protocol driver, not a GP Bridge protocol driver. Signed-off-by: NAlex Elder <elder@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Viresh Kumar 提交于
Prefix module-id with endo-id to uniquely identify it for the entire kernel. Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Viresh Kumar 提交于
Currently we name the endo device as "endo". And it shows up with the same name in sysfs directory: /sys/bus/greybus/devices/. But each device in kernel should be represented by a unique id in kernel, and "endo" isn't unique. Lets generate unique ids for endo devices. The ida mechanism for allocating ids may be overkill but it works. Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
- 04 6月, 2015 7 次提交
-
-
由 Viresh Kumar 提交于
This isn't unique just for the bundle but the complete interface. Its wrong to call it bundle_cport_id. Lets name it intf_cport_id to make things clear. Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Viresh Kumar 提交于
'buffer' isn't used in this function, remove it. Reviewed-by: NJohan Hovold <johan@hovoldconsulting.com> Reviewed-by: NAlex Elder <elder@linaro.org> Signed-off-by: NViresh Kumar <viresh.kumar@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Bryan O'Donoghue 提交于
Use defines for the data format command. Tidy up naming of gb_tty variables. Signed-off-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Bryan O'Donoghue 提交于
gb_uart_request_recv job in life is to process unsolicited greybus mesages from the UART. Hook the incoming UART data and pass to the TTY layer. Line-state changes still TBD. Signed-off-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Bryan O'Donoghue 提交于
Make kmalloc for the send buffer a one time alloc based on the MTU for a given greybus link. The write_room for an gb_operation_sync then will be the size of the buffer we use for a single operation. Signed-off-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Bryan O'Donoghue 提交于
gb_operation_sync returns 0 on success but the calling function expects the number of bytes written on success or a negative errno Signed-off-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-
由 Bryan O'Donoghue 提交于
For each new UART connection we need to do a tty_port_init else we'll crash when trying to access the tty mutex later on. Base the TTY major/minor numbers on non-zero values. Supply an empty operations structure for the newly regitered port. Signed-off-by: NBryan O'Donoghue <bryan.odonoghue@linaro.org> Signed-off-by: NGreg Kroah-Hartman <gregkh@google.com>
-